While discussing the new gets_s.c in D12785, ed@ suggested putting
{}'s around the if (c == EOF) block to prevent potential 'trailing else' issues from being introduced when refactoring. As my gets_s() code is based on this, it makes sense to fix the same issue here first here and now, then do an svn copy again to capture this history). Suggested by: ed@ in D12785
This commit is contained in:
parent
8974782e89
commit
aee1526ce7
@ -61,13 +61,13 @@ gets(char *buf)
|
||||
warned = 1;
|
||||
}
|
||||
for (s = buf; (c = __sgetc(stdin)) != '\n'; ) {
|
||||
if (c == EOF)
|
||||
if (c == EOF) {
|
||||
if (s == buf) {
|
||||
ret = NULL;
|
||||
goto end;
|
||||
} else
|
||||
break;
|
||||
else
|
||||
} else
|
||||
*s++ = c;
|
||||
}
|
||||
*s = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user