Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit af10378

Browse files
author
Hiroshi Inoue
committed
Fix a bug in multibyte_strchr().
1 parent 867901d commit af10378

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/interfaces/odbc/multibyte.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,18 +253,18 @@ unsigned char *
253253
pg_mbschr(int csc, const unsigned char *string, unsigned int character)
254254
{
255255
int mb_st = 0;
256-
unsigned char *s;
257-
s = (unsigned char *) string;
256+
const unsigned char *s, *rs = NULL;
258257

259-
for(;;)
258+
for(s = string; *s ; s++)
260259
{
261260
mb_st = pg_CS_stat(mb_st, (unsigned char) *s, csc);
262-
if (mb_st == 0 && (*s == character || *s == 0))
261+
if (mb_st == 0 && (*s == character))
262+
{
263+
rs = s;
263264
break;
264-
else
265-
s++;
265+
}
266266
}
267-
return (s);
267+
return (rs);
268268
}
269269

270270
int

0 commit comments

Comments
 (0)