1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-23 00:08:50 -05:00

More cleanup to alpm_list

* Remove some #include statements that are not strictly necessary
* Remove node_new function that is really just a one-liner

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2008-02-24 18:07:44 -06:00
parent 8cfccf68c1
commit ca1a187131

View File

@ -1,7 +1,7 @@
/* /*
* alpm_list.c * alpm_list.c
* *
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2008 by Judd Vinet <jvinet@zeroflux.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -17,15 +17,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "config.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
/* libalpm */ /* libalpm */
#include "alpm_list.h" #include "alpm_list.h"
#include "util.h"
/* check exported library symbols with: nm -C -D <lib> */
#define SYMEXPORT __attribute__((visibility("default")))
#define SYMHIDDEN __attribute__((visibility("internal")))
/** /**
* @addtogroup alpm_list List Functions * @addtogroup alpm_list List Functions
@ -39,20 +40,6 @@
/* Allocation */ /* Allocation */
/**
* @brief Allocate a new node for alpm_list_t (with empty ->data)
*
* @return a new node item, or NULL on failure
*/
static alpm_list_t *node_new()
{
alpm_list_t *list = NULL;
list = calloc(1, sizeof(alpm_list_t));
return(list);
}
/** /**
* @brief Free a list, but not the contained data. * @brief Free a list, but not the contained data.
* *
@ -102,7 +89,7 @@ alpm_list_t SYMEXPORT *alpm_list_add(alpm_list_t *list, void *data)
{ {
alpm_list_t *ptr, *lp; alpm_list_t *ptr, *lp;
ptr = node_new(); ptr = calloc(1, sizeof(alpm_list_t));
if(ptr == NULL) { if(ptr == NULL) {
return(list); return(list);
} }
@ -140,7 +127,7 @@ alpm_list_t SYMEXPORT *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_
} else { } else {
alpm_list_t *add = NULL, *prev = NULL, *next = list; alpm_list_t *add = NULL, *prev = NULL, *next = list;
add = node_new(); add = calloc(1, sizeof(alpm_list_t));
if(add == NULL) { if(add == NULL) {
return(list); return(list);
} }