bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

wcasestrstr patch incorrect?


From: Andrew J. Schorr
Subject: wcasestrstr patch incorrect?
Date: Fri, 12 Jan 2007 12:01:34 -0500
User-agent: Mutt/1.4.2.1i

In Savannah, I see this patch to node.c:wcasestrstr:

Mon Dec 11 12:43:04 2006  Arnold D. Robbins  <address@hidden>

        * node.c (wcasestr): Replace `goto' with `continue'.

@@ -842,11 +841,10 @@ wcasestrstr(const wchar_t *haystack, siz
                                h = towlower(*start);
                                n = towlower(needle[j]);
                                if (h != n)
-                                       goto out;
+                                       continue;
                        }
                        return haystack + i;
                }
-out:   ;
        }
 
        return NULL;


Most likely, I'm quite confused, but this looks like a bug
to me.  Isn't the 'continue' statement a no-op in this context?
The patched code results in this 'for' loop:

                        for (j = 0; j < needle_len; j++, start++) {
                                wchar_t h, n;

                                h = towlower(*start);
                                n = towlower(needle[j]);
                                if (h != n)
                                        continue;
                        }

Coming at the end of the 'for' loop, doesn't the continue statement
have no effect?  It seems to me like the previous 'goto out'
code was correct...

Regards,
Andy




reply via email to

[Prev in Thread] Current Thread [Next in Thread]