* libmisc/list.c: Added assertions for non NULL parameters.
This commit is contained in:
parent
d2c11f8bee
commit
05e4cf9aae
@ -1,6 +1,7 @@
|
|||||||
2008-08-29 Nicolas François <nicolas.francois@centraliens.net>
|
2008-08-29 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* libmisc/list.c: Remove historical comment.
|
* libmisc/list.c: Remove historical comment.
|
||||||
|
* libmisc/list.c: Added assertions for non NULL parameters.
|
||||||
|
|
||||||
2008-08-29 Nicolas François <nicolas.francois@centraliens.net>
|
2008-08-29 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ char **add_list (char **list, const char *member)
|
|||||||
char **tmp;
|
char **tmp;
|
||||||
|
|
||||||
assert (NULL != member);
|
assert (NULL != member);
|
||||||
|
assert (NULL != list);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scan the list for the new name. Return the original list
|
* Scan the list for the new name. Return the original list
|
||||||
@ -98,6 +99,7 @@ char **del_list (char **list, const char *member)
|
|||||||
char **tmp;
|
char **tmp;
|
||||||
|
|
||||||
assert (NULL != member);
|
assert (NULL != member);
|
||||||
|
assert (NULL != list);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scan the list for the old name. Return the original list
|
* Scan the list for the old name. Return the original list
|
||||||
@ -144,6 +146,8 @@ char **dup_list (char *const *list)
|
|||||||
int i;
|
int i;
|
||||||
char **tmp;
|
char **tmp;
|
||||||
|
|
||||||
|
assert (NULL != list);
|
||||||
|
|
||||||
for (i = 0; NULL != list[i]; i++);
|
for (i = 0; NULL != list[i]; i++);
|
||||||
|
|
||||||
tmp = (char **) xmalloc ((i + 1) * sizeof (char *));
|
tmp = (char **) xmalloc ((i + 1) * sizeof (char *));
|
||||||
@ -162,6 +166,7 @@ char **dup_list (char *const *list)
|
|||||||
bool is_on_list (char *const *list, const char *member)
|
bool is_on_list (char *const *list, const char *member)
|
||||||
{
|
{
|
||||||
assert (NULL != member);
|
assert (NULL != member);
|
||||||
|
assert (NULL != list);
|
||||||
|
|
||||||
while (NULL != *list) {
|
while (NULL != *list) {
|
||||||
if (strcmp (*list, member) == 0) {
|
if (strcmp (*list, member) == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user