Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/alpm_list.c
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2007-01-23 01:34:58 +0000
committerAaron Griffin <aaron@archlinux.org>2007-01-23 01:34:58 +0000
commit4db24ca28a31d1d0d97b30b186fd5255a0ae0113 (patch)
tree0ffe8319426d9ad84a6563883c445fc0fa0d6f40 /lib/libalpm/alpm_list.c
parent2a8b835dda8cf38636cad618bc01b433ef9eefa5 (diff)
* Added some calloc calls to replace the malloc-then-set-to-zero functionality
* Fixed -Ss output so as not to call alpm_list_getdata with a NULl list * Added a NULL check in alpm_list_getdata * Fixed alpm_list_add_sorted to properly handle a new / beginning insertions
Diffstat (limited to 'lib/libalpm/alpm_list.c')
-rw-r--r--lib/libalpm/alpm_list.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libalpm/alpm_list.c b/lib/libalpm/alpm_list.c
index a43f8211..26fcb3dc 100644
--- a/lib/libalpm/alpm_list.c
+++ b/lib/libalpm/alpm_list.c
@@ -145,8 +145,10 @@ alpm_list_t *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cm
if(prev != NULL) {
prev->next = add; /* In middle. */
+ } else {
+ list = add; /* At beginning, or new list */
}
-
+
return(list);
}
}
@@ -369,6 +371,7 @@ alpm_list_t *alpm_list_last(alpm_list_t *list)
*/
void *alpm_list_getdata(const alpm_list_t *entry)
{
+ if(entry == NULL) return(NULL);
return(entry->data);
}