X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flibudev%2Flibudev-list.c;h=1cf53b074f2c5958235149ade434726ae984eba6;hp=aec334bcfc52875b25a622ec27b7f33a7241c2e6;hb=051dfe8708e394a64e8ef6c281228763481ad32c;hpb=b27ee00bf5e377a4b59b454c68c8617ea9666bc8 diff --git a/src/libudev/libudev-list.c b/src/libudev/libudev-list.c index aec334bcf..1cf53b074 100644 --- a/src/libudev/libudev-list.c +++ b/src/libudev/libudev-list.c @@ -1,13 +1,21 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ +/*** + This file is part of systemd. + + Copyright 2008-2012 Kay Sievers + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see . +***/ #include #include @@ -94,7 +102,7 @@ void udev_list_init(struct udev *udev, struct udev_list *list, bool unique) } /* insert entry into a list as the last element */ -void udev_list_entry_append(struct udev_list_entry *new, struct udev_list *list) +static void udev_list_entry_append(struct udev_list_entry *new, struct udev_list *list) { /* inserting before the list head make the node the last node in the list */ udev_list_node_insert_between(&new->node, list->node.prev, &list->node); @@ -102,7 +110,7 @@ void udev_list_entry_append(struct udev_list_entry *new, struct udev_list *list) } /* insert entry into a list, before a given existing entry */ -void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry) +static void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry) { udev_list_node_insert_between(&new->node, entry->node.prev, &entry->node); new->list = entry->list; @@ -177,17 +185,20 @@ struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char * if (list->unique) { /* allocate or enlarge sorted array if needed */ if (list->entries_cur >= list->entries_max) { + struct udev_list_entry **entries; unsigned int add; add = list->entries_max; if (add < 1) add = 64; - list->entries = realloc(list->entries, (list->entries_max + add) * sizeof(struct udev_list_entry *)); - if (list->entries == NULL) { + entries = realloc(list->entries, (list->entries_max + add) * sizeof(struct udev_list_entry *)); + if (entries == NULL) { free(entry->name); free(entry->value); + free(entry); return NULL; } + list->entries = entries; list->entries_max += add; }