Browse Source

fix #94: _list_append behaviour on NULL list head is now to return NULL (both for stringpair_list_append and stringlist_append)

doc_update_sequoia
Krista Grothoff 6 years ago
parent
commit
d1feaca254
4 changed files with 6 additions and 17 deletions
  1. +2
    -0
      src/stringlist.c
  2. +1
    -0
      src/stringlist.h
  3. +2
    -17
      src/stringpair.c
  4. +1
    -0
      src/stringpair.h

+ 2
- 0
src/stringlist.c View File

@ -88,6 +88,8 @@ DYNAMIC_API stringlist_t *stringlist_append(
)
{
assert(stringlist);
if (stringlist == NULL)
return NULL;
if (second == NULL || second->value == NULL)
return stringlist;


+ 1
- 0
src/stringlist.h View File

@ -67,6 +67,7 @@ DYNAMIC_API stringlist_t *stringlist_add(
//
// return value:
// pointer to last element in stringlist or NULL if out of memory
// or stringpair_list is NULL
//
// caveat:
// all values are being copied before being added to the list


+ 2
- 17
src/stringpair.c View File

@ -125,23 +125,6 @@ DYNAMIC_API stringpair_list_t *stringpair_list_add(
return list_curr->next;
// if (stringpair_list == NULL)
// return new_stringpair_list(value);
//
// if (stringpair_list->next)
// return stringpair_list_add(stringpair_list->next, value);
//
// if (stringpair_list->value == NULL) {
// assert(stringpair_list->next == NULL);
// stringpair_list->value = value;
// return stringpair_list;
// }
//
// stringpair_list->next = new_stringpair_list(value);
// if (stringpair_list->next == NULL)
// return NULL;
//
// return stringpair_list->next;
}
DYNAMIC_API stringpair_list_t *stringpair_list_append(
@ -150,6 +133,8 @@ DYNAMIC_API stringpair_list_t *stringpair_list_append(
)
{
assert(stringpair_list);
if (stringpair_list == NULL)
return NULL;
if (second == NULL || second->value == NULL)
return stringpair_list;


+ 1
- 0
src/stringpair.h View File

@ -109,6 +109,7 @@ DYNAMIC_API stringpair_list_t *stringpair_list_add(
//
// return value:
// pointer to last element in stringpair_list or NULL if out of memory
// or stringpair_list is NULL
//
// caveat:
// all values are being copied before being added to the list


Loading…
Cancel
Save