changeset 23302:78cf75ffd382

maint: tweak readability of code in lo-regexp.cc. * lo-regexp.cc: Adjust some indentation and reword some comments to make things clearer.
author Rik <rik@octave.org>
date Sat, 18 Mar 2017 10:15:50 -0700
parents 81bc57aa7024
children 4aa13310250c
files liboctave/util/lo-regexp.cc
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/util/lo-regexp.cc	Sat Mar 18 14:11:27 2017 +0100
+++ b/liboctave/util/lo-regexp.cc	Sat Mar 18 10:15:50 2017 -0700
@@ -225,7 +225,7 @@
     std::string buf_str = buf.str ();
 
     int pcre_options
-      = ((options.case_insensitive () ? PCRE_CASELESS : 0)
+      = (  (options.case_insensitive () ? PCRE_CASELESS : 0)
          | (options.dotexceptnewline () ? 0 : PCRE_DOTALL)
          | (options.lineanchors () ? PCRE_MULTILINE : 0)
          | (options.freespacing () ? PCRE_EXTENDED : 0));
@@ -262,7 +262,7 @@
 
     for (int i = 0; i < namecount; i++)
       {
-        // Index of subpattern in first two bytes MSB first of name.
+        // Index of subpattern in first two bytes of name (MSB first).
         // Extract index.
         nidx[i] = (static_cast<int> (nametable[i*nameentrysize])) << 8
                   | static_cast<int> (nametable[i*nameentrysize+1]);
@@ -313,7 +313,7 @@
 
         if (matches == PCRE_ERROR_NOMATCH)
           break;
-        else if (ovector[1] <= ovector[0] && ! options.emptymatch ())
+        else if (ovector[0] >= ovector[1] && ! options.emptymatch ())
           {
             // Zero length match.  Skip to next char.
             idx = ovector[0] + 1;