Skip to content

Commit a431568

Browse files
committed
ext/standard/scanf: use type bool instead of int for variables in ValidateFormat()
1 parent fe61460 commit a431568

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

ext/standard/scanf.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,9 @@ static void ReleaseCharSet(CharSet *cset)
307307
static int ValidateFormat(char *format, int numVars, uint32_t *totalSubs)
308308
{
309309
#define STATIC_LIST_SIZE 16
310-
int gotXpg, gotSequential, value, i, flags;
310+
int value, i, flags;
311+
bool gotXpg = false;
312+
bool gotSequential = false;
311313
char *end, *ch = NULL;
312314
int staticAssign[STATIC_LIST_SIZE];
313315
int *nassign = staticAssign;
@@ -327,7 +329,7 @@ static int ValidateFormat(char *format, int numVars, uint32_t *totalSubs)
327329
nassign[i] = 0;
328330
}
329331

330-
xpgSize = objIndex = gotXpg = gotSequential = 0;
332+
xpgSize = objIndex = 0;
331333

332334
while (*format != '\0') {
333335
ch = format++;
@@ -358,7 +360,7 @@ static int ValidateFormat(char *format, int numVars, uint32_t *totalSubs)
358360
}
359361
format = end+1;
360362
ch = format++;
361-
gotXpg = 1;
363+
gotXpg = true;
362364
if (gotSequential) {
363365
goto mixedXPG;
364366
}
@@ -387,7 +389,7 @@ static int ValidateFormat(char *format, int numVars, uint32_t *totalSubs)
387389
}
388390

389391
notXpg:
390-
gotSequential = 1;
392+
gotSequential = true;
391393
if (gotXpg) {
392394
mixedXPG:
393395
zend_value_error("%s", "cannot mix \"%\" and \"%n$\" conversion specifiers");

0 commit comments

Comments
 (0)