]> granicus.if.org Git - postgresql/commitdiff
Fix a bug in multibyte_strchr().
authorHiroshi Inoue <inoue@tpf.co.jp>
Thu, 4 Apr 2002 01:36:17 +0000 (01:36 +0000)
committerHiroshi Inoue <inoue@tpf.co.jp>
Thu, 4 Apr 2002 01:36:17 +0000 (01:36 +0000)
src/interfaces/odbc/multibyte.c

index 3cc3efe350ace498a4344a06d6f1b6dc937bd2d3..476f3c42cd710b6807dfacff6a3f5fd32593d5fd 100644 (file)
@@ -253,18 +253,18 @@ unsigned char *
 pg_mbschr(int csc, const unsigned char *string, unsigned int character)
 {
        int                     mb_st = 0;
-       unsigned char *s;
-       s = (unsigned char *) string;
+       const unsigned char *s, *rs = NULL;
 
-       for(;;
+       for(s = string; *s ; s++
        {
                mb_st = pg_CS_stat(mb_st, (unsigned char) *s, csc);
-               if (mb_st == 0 && (*s == character || *s == 0))
+               if (mb_st == 0 && (*s == character))
+               {
+                       rs = s;
                        break;
-               else
-                       s++;
+               }
        }
-       return (s);
+       return (rs);
 }
 
 int