1 /* pkg_src_list.c - the itsy package management system
5 Copyright (C) 2001 University of Southern California
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2, or (at
10 your option) any later version.
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
20 #include "pkg_src_list.h"
21 #include "void_list.h"
23 int pkg_src_list_init(pkg_src_list_t *list)
25 return void_list_init((void_list_t *) list);
28 void pkg_src_list_deinit(pkg_src_list_t *list)
30 pkg_src_list_elt_t *iter;
33 for (iter = list->head; iter; iter = iter->next) {
35 pkg_src_deinit(pkg_src);
37 /* malloced in pkg_src_list_append */
41 void_list_deinit((void_list_t *) list);
44 pkg_src_t *pkg_src_list_append(pkg_src_list_t *list,
45 const char *name, const char *base_url, const char *extra_data,
50 /* freed in pkg_src_list_deinit */
51 pkg_src_t *pkg_src = malloc(sizeof(pkg_src_t));
53 if (pkg_src == NULL) {
54 fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
57 pkg_src_init(pkg_src, name, base_url, extra_data, gzip);
59 err = void_list_append((void_list_t *) list, pkg_src);
67 int pkg_src_list_push(pkg_src_list_t *list, pkg_src_t *data)
69 return void_list_push((void_list_t *) list, data);
72 pkg_src_list_elt_t *pkg_src_list_pop(pkg_src_list_t *list)
74 return (pkg_src_list_elt_t *) void_list_pop((void_list_t *) list);