Don't hardcode the length, there is an argument for that. Don't
do the NULL check as we already know thaty tmp cannot be NULL. This commit was SVN r16123.
Этот коммит содержится в:
родитель
4e66376e66
Коммит
61989cc4d4
@ -58,13 +58,13 @@ find_info(FILE* fp, char *str, char *buf, size_t buflen)
|
||||
char *tmp;
|
||||
|
||||
rewind(fp);
|
||||
while (NULL != fgets(buf, 1024, fp)) {
|
||||
while (NULL != fgets(buf, buflen, fp)) {
|
||||
if (strncmp(buf, str, strlen(str)) == 0) {
|
||||
/* we found the line. Now eat everything up to,
|
||||
including, and one past the : */
|
||||
for (tmp = buf ; (*tmp != '\0') && (*tmp != ':') ; ++tmp) ;
|
||||
for ( ++tmp ; *tmp == ' ' ; ++tmp);
|
||||
if (NULL != tmp && '\0' != *tmp) {
|
||||
if ('\0' != *tmp) {
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user