aboutsummaryrefslogtreecommitdiffstats
path: root/src/common.h
diff options
context:
space:
mode:
authorJason Woodward2010-06-09 00:24:07 -0400
committerJason Woodward2010-06-09 00:38:39 -0400
commit33eb4afdaaae102ce44232d28c227ba98318d5d3 (patch)
treeceb93c84dbafdac28af7f0063e5e30bb05bdca83 /src/common.h
parent8f196b6232e9f4eba6fe340e25c11af917215d17 (diff)
downloadslapt-get-33eb4afdaaae102ce44232d28c227ba98318d5d3.tar.gz
Updated API, generalizing several types into slapt_list_t
Replaced slapt_pkg_action_args_t, struct slapt_exclude_list, and struct slapt_suggests with slapt_list_t, a generic string list type. Added support functions slapt_parse_delimited_list, slapt_init_list, slapt_add_list_item, slapt_remove_list_item, and slapt_free_list in support of slapt_list_t. Removed now unnecessary slapt_init_exclude_list, slapt_add_exclude, slapt_remove_exclude, slapt_free_exclude_list, slapt_init_pkg_action_args, slapt_add_pkg_action_args, and slapt_free_pkg_action_args. Added convenience function slapt_parse_delimited_list that can generate a slapt_list_t from the exclude list, suggestions, dependencies, and conflicts. This greatly simplified the exclude parsing and dependency parsing.
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h
index 0390e45..a889a66 100644
--- a/src/common.h
+++ b/src/common.h
@@ -49,6 +49,11 @@ typedef struct {
int reg_return;
} slapt_regex_t;
+typedef struct {
+ char **items;
+ unsigned int count;
+} slapt_list_t;
+
FILE *slapt_open_file(const char *file_name,const char *mode);
slapt_regex_t *slapt_init_regex(const char *regex_string);
void slapt_execute_regex(slapt_regex_t *regex_t,const char *string);
@@ -73,3 +78,10 @@ const char *slapt_strerror(slapt_code_t code);
/* return human readable priority */
const char *slapt_priority_to_str(SLAPT_PRIORITY_T priority);
SLAPT_BOOL_T slapt_disk_space_check (const char *path,double space_needed);
+
+/* general list management */
+slapt_list_t *slapt_parse_delimited_list(char *line, char delim);
+slapt_list_t *slapt_init_list(void);
+void slapt_add_list_item(slapt_list_t *list,const char *item);
+void slapt_remove_list_item(slapt_list_t *list,const char *item);
+void slapt_free_list(slapt_list_t *list);