From 4b8a0f3f3dcf60dac2ce308ea08d413a535af29f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 21:12:14 +0200 Subject: Adding upstream version 5.4.4. Signed-off-by: Daniel Baumann --- strlist.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 strlist.h (limited to 'strlist.h') diff --git a/strlist.h b/strlist.h new file mode 100644 index 0000000..8a14cc8 --- /dev/null +++ b/strlist.h @@ -0,0 +1,50 @@ +#ifndef REPREPRO_STRLIST_H +#define REPREPRO_STRLIST_H + +#ifndef REPREPRO_ERROR_H +#include "error.h" +#warning "What's hapening here?" +#endif +#ifndef REPREPRO_GLOBALS_H +#include "globals.h" +#warning "What's hapening here?" +#endif + +struct strlist { + char **values; + int count, size; +}; + +void strlist_init(/*@out@*/struct strlist *); +retvalue strlist_init_n(int /*startsize*/, /*@out@*/struct strlist *); +retvalue strlist_init_singleton(/*@only@*/char *, /*@out@*/struct strlist *); +void strlist_done(/*@special@*/struct strlist *strlist) /*@releases strlist->values @*/; + +/* add a string, will get property of the strlist and free'd by it */ +retvalue strlist_add(struct strlist *, /*@only@*/char *); +/* include a string at the beginning, otherwise like strlist_add */ +retvalue strlist_include(struct strlist *, /*@only@*/char *); +/* add a string alphabetically, discarding if already there. */ +retvalue strlist_adduniq(struct strlist *, /*@only@*/char *); +/* like strlist_add, but strdup it first */ +retvalue strlist_add_dup(struct strlist *strlist, const char *todup); + +/* print a space separated list of elements */ +retvalue strlist_fprint(FILE *, const struct strlist *); + +/* replace the contents of dest with those from orig, which get emptied */ +void strlist_move(/*@out@*/struct strlist *dest, /*@special@*/struct strlist *orig) /*@releases orig->values @*/; + +bool strlist_in(const struct strlist *, const char *); +int strlist_ofs(const struct strlist *, const char *); + +bool strlist_intersects(const struct strlist *, const struct strlist *); +/* if missing != NULL And subset no subset of strlist, set *missing to the first missing one */ +bool strlist_subset(const struct strlist *, const struct strlist * /*subset*/, const char ** /*missing_p*/); + +/* concatenate */ +char *strlist_concat(const struct strlist *, const char * /*prefix*/, const char * /*infix*/, const char * /*suffix*/); + +/* remove all strings equal to the argument */ +void strlist_remove(struct strlist *, const char *); +#endif -- cgit v1.2.3