projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
no need to initialize result ptr of getaddrinfo
[collectd.git]
/
src
/
daemon
/
utils_llist.c
diff --git
a/src/daemon/utils_llist.c
b/src/daemon/utils_llist.c
index
09c9834
..
6027338
100644
(file)
--- a/
src/daemon/utils_llist.c
+++ b/
src/daemon/utils_llist.c
@@
-24,8
+24,6
@@
* Florian Forster <octo at collectd.org>
*/
* Florian Forster <octo at collectd.org>
*/
-#include "config.h"
-
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
@@
-48,12
+46,10
@@
llist_t *llist_create (void)
{
llist_t *ret;
{
llist_t *ret;
- ret =
(llist_t *) malloc (sizeof (llist_
t));
+ ret =
calloc (1, sizeof (*re
t));
if (ret == NULL)
return (NULL);
if (ret == NULL)
return (NULL);
- memset (ret, '\0', sizeof (llist_t));
-
return (ret);
}
return (ret);
}
@@
-78,7
+74,7
@@
llentry_t *llentry_create (char *key, void *value)
{
llentry_t *e;
{
llentry_t *e;
- e =
(llentry_t *) malloc (sizeof (llentry_t
));
+ e =
malloc (sizeof (*e
));
if (e)
{
e->key = key;
if (e)
{
e->key = key;
@@
-123,6
+119,9
@@
void llist_remove (llist_t *l, llentry_t *e)
{
llentry_t *prev;
{
llentry_t *prev;
+ if ((l == NULL) || (e == NULL))
+ return;
+
prev = l->head;
while ((prev != NULL) && (prev->next != e))
prev = prev->next;
prev = l->head;
while ((prev != NULL) && (prev->next != e))
prev = prev->next;