Diff of /main/trunk/interpreter/classes/support/StringUtil.cpp [r8281] .. [r8282] Maximize Restore

  Switch to side-by-side view

--- a/main/trunk/interpreter/classes/support/StringUtil.cpp
+++ b/main/trunk/interpreter/classes/support/StringUtil.cpp
@@ -1412,6 +1412,7 @@
     // get the reference string information
     ref = stringArgument(ref, ARG_ONE);
     size_t referenceLen = ref->getLength();
+    const char *refSet = ref->getStringData();
                                          /* get the option, default 'Nomatch' */
     char opt = optionalOptionArgument(option, VERIFY_NOMATCH, ARG_TWO);
     // validate the possibilities
@@ -1453,25 +1454,10 @@
             if (opt == VERIFY_NOMATCH)
             {
                 while (stringRange-- != 0)
-                {            /* while input left                  */
-                    char ch = *current++;          /* get next char                     */
-                                                   /* get reference string              */
-                    const char *reference = ref->getStringData();
-                    size_t temp = referenceLen;           /* copy the reference length         */
-
-                    while (temp != 0)
-                    {               /* spin thru reference               */
-                        if (ch == *reference++)
-                        {
-                            // we have a match, so we can leave
-                            break;
-                        }
-                        temp--;
-                    }
-                    // terminate because we tested all characters?
-                    if (temp == 0)
+                {
+                    // if no match at this position, return this position
+                    if (!StringUtil::matchCharacter(*current++, refSet, referenceLen))
                     {
-                        // mismatch at this offset
                         return new_integer(current - data);
                     }
                 }
@@ -1481,20 +1467,11 @@
             else
             {
                 while (stringRange-- != 0)
-                {            /* while input left                  */
-                    char ch = *current++;          /* get next char                     */
-                                                   /* get reference string              */
-                    const char *reference = ref->getStringData();
-                    size_t temp = referenceLen;           /* copy the reference length         */
-
-                    while (temp != 0)
-                    {               /* spin thru reference               */
-                        if (ch == *reference++)
-                        {
-                            // we found a matching character, return that position
-                            return new_integer(current - data);
-                        }
-                        temp--;
+                {
+                    // if we have a match at this position, trigger this
+                    if (StringUtil::matchCharacter(*current++, refSet, referenceLen))
+                    {
+                        return new_integer(current - data);
                     }
                 }
                 // this is always a non matching situation to get here