1 /* pkg_src_list.c - the opkg 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.
18 #include "pkg_src_list.h"
19 #include "void_list.h"
20 #include "libbb/libbb.h"
22 void pkg_src_list_init(pkg_src_list_t
* list
)
24 void_list_init((void_list_t
*) list
);
27 void pkg_src_list_deinit(pkg_src_list_t
* list
)
29 pkg_src_list_elt_t
*iter
, *n
;
32 list_for_each_entry_safe(iter
, n
, &list
->head
, node
) {
33 pkg_src
= (pkg_src_t
*) iter
->data
;
34 pkg_src_deinit(pkg_src
);
36 /* malloced in pkg_src_list_append */
40 void_list_deinit((void_list_t
*) list
);
43 pkg_src_t
*pkg_src_list_append(pkg_src_list_t
* list
,
44 const char *name
, const char *base_url
,
45 const char *extra_data
, int gzip
)
47 /* freed in pkg_src_list_deinit */
48 pkg_src_t
*pkg_src
= xcalloc(1, sizeof(pkg_src_t
));
49 pkg_src_init(pkg_src
, name
, base_url
, extra_data
, gzip
);
51 void_list_append((void_list_t
*) list
, pkg_src
);