opkg: add a download progress callback hook to libopkg
[oweals/opkg-lede.git] / str_list.h
1 /* str_list.h - the itsy package management system
2
3    Carl D. Worth
4
5    Copyright (C) 2001 University of Southern California
6
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.
11
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.
16 */
17
18 #ifndef STR_LIST_H
19 #define STR_LIST_H
20
21 #include "void_list.h"
22
23 typedef struct str_list_elt str_list_elt_t;
24 struct str_list_elt
25 {
26     str_list_elt_t *next;
27     char *data;
28 };
29
30 typedef struct xstr_list str_list_t;
31 struct xstr_list
32 {
33     str_list_elt_t pre_head;
34     str_list_elt_t *head;
35     str_list_elt_t *tail;
36 };
37
38 int str_list_elt_init(str_list_elt_t *elt, char *data);
39 void str_list_elt_deinit(str_list_elt_t *elt);
40
41 str_list_t *str_list_alloc(void);
42 int str_list_init(str_list_t *list);
43 void str_list_deinit(str_list_t *list);
44
45 int str_list_append(str_list_t *list, char *data);
46 int str_list_push(str_list_t *list, char *data);
47 str_list_elt_t *str_list_pop(str_list_t *list);
48 str_list_elt_t *str_list_remove(str_list_t *list, str_list_elt_t **iter);
49 char *str_list_remove_elt(str_list_t *list, const char *target_str);
50
51 #endif