Now return NULLified struct in case of empty config file

(previous variant return NULL pointer for both empty file case and error case,
so caller can't sense error properly).

It not affect existen programs because property_find() now returns NULL
for both NULL pointer and NULLified struct.
This commit is contained in:
Andrey A. Chernov 2003-01-27 03:39:33 +00:00
parent 33a155e400
commit 5fe03aba37
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=109916

View File

@ -216,20 +216,23 @@ properties_read(int fd)
break;
}
}
if (head == NULL && (head = property_alloc(NULL, NULL)) == NULL)
return (NULL);
return (head);
}
char *
property_find(properties list, const char *name)
{
if (!list || !name || !name[0])
return NULL;
while (list) {
if (!strcmp(list->name, name))
return list->value;
if (list == NULL || name == NULL || !name[0])
return (NULL);
while (list != NULL) {
if (list->name != NULL && strcmp(list->name, name) == 0)
return (list->value);
list = list->next;
}
return NULL;
return (NULL);
}
void