diff options
-rw-r--r-- | NEWS | 18 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/argparse.c | 37 | ||||
-rw-r--r-- | src/gpg-error.def.in | 13 | ||||
-rw-r--r-- | src/gpg-error.h.in | 73 | ||||
-rw-r--r-- | src/gpg-error.vers | 11 | ||||
-rw-r--r-- | src/gpgrt-int.h | 29 | ||||
-rw-r--r-- | src/stringutils.c | 26 | ||||
-rw-r--r-- | src/strlist.c | 296 | ||||
-rw-r--r-- | src/visibility.c | 59 | ||||
-rw-r--r-- | src/visibility.h | 20 |
11 files changed, 369 insertions, 214 deletions
@@ -1,14 +1,28 @@ Noteworthy changes in version 1.52 (unreleased) [C38/A38/R_] ----------------------------------------------- - * The KEY_WOW64_xxKEY flags can now be passed to the Regsiry read + * The KEY_WOW64_xxKEY flags can now be passed to the Registry read functions. * New command --getreg for gpg-error on Windows. + * New simple string list API. + * Interface changes relative to the 1.51 release: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - _gpgrt_w32_reg_query_string NEW (Windows only). + gpgrt_w32_reg_query_string NEW (Windows only). + gpgrt_strlist_t NEW type. + gpgrt_strlist_free NEW. + gpgrt_strlist_add NEW. + gpgrt_strlist_tokenize NEW. + gpgrt_strlist_copy NEW. + gpgrt_strlist_rev NEW. + gpgrt_strlist_prev NEW. + gpgrt_strlist_last NEW. + gpgrt_strlist_pop NEW. + gpgrt_strlist_find NEW. + GPGRT_STRLIST_APPEND NEW const. + GPGRT_STRLIST_WIPE NEW const. Release-info: https://dev.gnupg.org/T7385 diff --git a/src/Makefile.am b/src/Makefile.am index 9389e99..d6223d6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -198,6 +198,7 @@ libgpg_error_la_SOURCES = gettext.h $(arch_sources) \ visibility.c visibility.h \ sysutils.c \ stringutils.c \ + strlist.c \ syscall-clamp.c \ logging.c \ b64dec.c b64enc.c \ diff --git a/src/argparse.c b/src/argparse.c index c59e5b2..cb1527d 100644 --- a/src/argparse.c +++ b/src/argparse.c @@ -204,31 +204,6 @@ is_native_utf8 (void) } -static char * -trim_spaces (char *str) -{ - char *string, *p, *mark; - - string = str; - /* Find first non space character. */ - for (p=string; *p && isspace (*(unsigned char*)p) ; p++) - ; - /* Move characters. */ - for ((mark = NULL); (*string = *p); string++, p++) - if (isspace (*(unsigned char*)p)) - { - if (!mark) - mark = string; - } - else - mark = NULL; - if (mark) - *mark = '\0' ; /* Remove trailing spaces. */ - - return str ; -} - - static const char * map_fixed_string (const char *string) { @@ -1220,7 +1195,7 @@ handle_meta_let (gpgrt_argparse_t *arg, unsigned int alternate, char *args) if (*value) { *value++ = 0; - trim_spaces (value); + _gpgrt_trim_spaces (value); } if (!isascii (*name) || !isalpha (*name)) @@ -1273,7 +1248,7 @@ handle_meta_getenv (gpgrt_argparse_t *arg, unsigned int alternate, char *args) if (*varname) { *varname++ = 0; - trim_spaces (varname); + _gpgrt_trim_spaces (varname); } if (!isascii (*name) || !isalpha (*name)) @@ -1461,7 +1436,7 @@ handle_metacmd (gpgrt_argparse_t *arg, char *keyword) if (*rest) { *rest++ = 0; - trim_spaces (rest); + _gpgrt_trim_spaces (rest); } for (i=0; i < DIM (cmds); i++) @@ -1772,7 +1747,7 @@ _gpgrt_argparse (estream_t fp, gpgrt_argparse_t *arg, gpgrt_opt_t *opts_orig) { /* We are at the end of a line. */ gpgrt_assert (*keyword == '['); - trim_spaces (keyword+1); + _gpgrt_trim_spaces (keyword+1); if (!keyword[1]) { arg->r_opt = ARGPARSE_INVALID_META; /* Empty. */ @@ -1841,7 +1816,7 @@ _gpgrt_argparse (estream_t fp, gpgrt_argparse_t *arg, gpgrt_opt_t *opts_orig) if (p) { *p++ = 0; - trim_spaces (p); + _gpgrt_trim_spaces (p); } if (!p || !*p) @@ -1873,7 +1848,7 @@ _gpgrt_argparse (estream_t fp, gpgrt_argparse_t *arg, gpgrt_opt_t *opts_orig) if (buffer) { - trim_spaces (buffer); + _gpgrt_trim_spaces (buffer); p = buffer; if (*p == '"') { diff --git a/src/gpg-error.def.in b/src/gpg-error.def.in index fad6405..75e8537 100644 --- a/src/gpg-error.def.in +++ b/src/gpg-error.def.in @@ -258,4 +258,17 @@ EXPORTS gpgrt_w32_reg_get_string @198 + gpgrt_strlist_free @199 + gpgrt_strlist_add @200 + gpgrt_strlist_tokenize @201 + gpgrt_strlist_copy @202 + gpgrt_strlist_rev @203 + gpgrt_strlist_prev @204 + gpgrt_strlist_last @205 + gpgrt_strlist_pop @206 + gpgrt_strlist_find @207 + + + + ;; end of file with public symbols for Windows. diff --git a/src/gpg-error.h.in b/src/gpg-error.h.in index 8d4dd66..16b2c44 100644 --- a/src/gpg-error.h.in +++ b/src/gpg-error.h.in @@ -970,6 +970,79 @@ gpg_err_code_t gpgrt_b64dec_finish (gpgrt_b64state_t state); /* + * Simple string list + */ +struct _gpgrt_strlist_s +{ + struct _gpgrt_strlist_s *next; + unsigned int flags; + unsigned char _private_flags; /* Not of your business. */ + char d[1]; +}; +typedef struct _gpgrt_strlist_s *gpgrt_strlist_t; + + +#define GPGRT_STRLIST_APPEND 1 /* Append and not prepend to the list. */ +#define GPGRT_STRLIST_WIPE 2 /* Wipe the string on free. */ + + +/* Free the string list SL. */ +void gpgrt_strlist_free (gpgrt_strlist_t sl); + +/* Add STRING to the LIST. This function returns NULL and sets ERRNO + * on memory shortage. If STRING is NULL an empty string is stored + * instead. FLAGS */ +gpgrt_strlist_t gpgrt_strlist_add (gpgrt_strlist_t *list, const char *string, + unsigned int flags); + +/* Tokenize STRING using the delimiters from DELIM and append each + * token to the string list LIST. On success a pointer into LIST with + * the first new token is returned. Returns NULL on error and sets + * ERRNO. Take care, an error with ENOENT set mean that no tokens + * were found in STRING. */ +gpgrt_strlist_t gpgrt_strlist_tokenize (gpgrt_strlist_t *list, + const char *string, + const char *delim, unsigned int flags); + +/* Return a copy of LIST. On error ERRNO is set and NULL + * returned. */ +gpgrt_strlist_t gpgrt_strlist_copy (gpgrt_strlist_t list); + +/* Reverse the list *LIST in place. Will not fail. */ +gpgrt_strlist_t gpgrt_strlist_rev (gpgrt_strlist_t *list); + +/* In the list starting with HEAD return the item previous to NODE. + * Returns NULL if no previous item exists. */ +gpgrt_strlist_t gpgrt_strlist_prev (gpgrt_strlist_t head, gpgrt_strlist_t node); + +/* Return the last item in the list starting at NODE. */ +gpgrt_strlist_t gpgrt_strlist_last (gpgrt_strlist_t node); + +/* Remove the first item from LIST and return its content in an + * allocated buffer. This function returns NULl and sets ERRNO on + * error. */ +char *gpgrt_strlist_pop (gpgrt_strlist_t *list); + +/* Return the first item of the string list HAYSTACK whose value + * matches NEEDLE. If no items match, return NULL. */ +gpgrt_strlist_t gpgrt_strlist_find (gpgrt_strlist_t haystack, + const char *needle); + +/* Return the number of items in LIST. */ +static GPG_ERR_INLINE unsigned int +gpgrt_strlist_count (gpgrt_strlist_t list) +{ + unsigned int i = 0; + + for (i = 0; list; list = list->next) + i++; + + return i; +} + + + +/* * Logging functions */ diff --git a/src/gpg-error.vers b/src/gpg-error.vers index e340a5f..04a7bee 100644 --- a/src/gpg-error.vers +++ b/src/gpg-error.vers @@ -223,6 +223,17 @@ GPG_ERROR_1.0 { gpgrt_spawn_actions_set_atfork; gpgrt_spawn_actions_set_env_rev; + gpgrt_strlist_free; + gpgrt_strlist_add; + gpgrt_strlist_tokenize; + gpgrt_strlist_copy; + gpgrt_strlist_rev; + gpgrt_strlist_prev; + gpgrt_strlist_last; + gpgrt_strlist_pop; + gpgrt_strlist_find; + + local: *; }; diff --git a/src/gpgrt-int.h b/src/gpgrt-int.h index 5df3a95..279a2e2 100644 --- a/src/gpgrt-int.h +++ b/src/gpgrt-int.h @@ -760,9 +760,33 @@ void _gpgrt_set_confdir (int what, const char *name); int _gpgrt_cmp_version (const char *a, const char *b, int level); +/* + * strlist.c + */ +void _gpgrt_strlist_free (gpgrt_strlist_t sl); +gpgrt_strlist_t _gpgrt_strlist_add (gpgrt_strlist_t *list, + const char *string, unsigned int flags); +gpgrt_strlist_t _gpgrt_strlist_tokenize (gpgrt_strlist_t *list, + const char *string, const char *delim, + unsigned int flags); +gpgrt_strlist_t _gpgrt_strlist_copy (gpgrt_strlist_t list); +gpgrt_strlist_t _gpgrt_strlist_rev (gpgrt_strlist_t *list); +gpgrt_strlist_t _gpgrt_strlist_prev (gpgrt_strlist_t head, + gpgrt_strlist_t node); +gpgrt_strlist_t _gpgrt_strlist_last (gpgrt_strlist_t node); +char *_gpgrt_strlist_pop (gpgrt_strlist_t *list); +gpgrt_strlist_t _gpgrt_strlist_find (gpgrt_strlist_t haystack, + const char *needle); + + + + + + + /* - * Internal platform abstraction functions (sysutils.c) + * Internal platform abstraction functions (sysutils.c and stringutil.c) */ /* Return true if FD is valid. */ @@ -802,6 +826,9 @@ char *_gpgrt_fnameconcat (const char *first_part, char *_gpgrt_absfnameconcat (const char *first_part, ... ) GPGRT_ATTR_SENTINEL(0); +/* What the name says. */ +char *_gpgrt_trim_spaces (char *str); + /* * Platform specific functions (Windows) diff --git a/src/stringutils.c b/src/stringutils.c index 11a31ab..9cba1c2 100644 --- a/src/stringutils.c +++ b/src/stringutils.c @@ -23,6 +23,7 @@ #include <stdlib.h> #include <stdint.h> #include <string.h> +#include <ctype.h> #include <stdarg.h> #include <errno.h> #ifdef HAVE_STAT @@ -33,6 +34,31 @@ #include "gpgrt-int.h" +char * +_gpgrt_trim_spaces (char *str) +{ + char *string, *p, *mark; + + string = str; + /* Find first non space character. */ + for (p=string; *p && isspace (*(unsigned char*)p) ; p++) + ; + /* Move characters. */ + for ((mark = NULL); (*string = *p); string++, p++) + if (isspace (*(unsigned char*)p)) + { + if (!mark) + mark = string; + } + else + mark = NULL; + if (mark) + *mark = '\0' ; /* Remove trailing spaces. */ + + return str ; +} + + /* Helper for _gpgrt_fnameconcat. The additional flag WANT_ABS tells * whether an absolute file name is requested. */ char * diff --git a/src/strlist.c b/src/strlist.c index 1a63c9f..78fedcd 100644 --- a/src/strlist.c +++ b/src/strlist.c @@ -33,113 +33,42 @@ #include "gpgrt-int.h" - -void -free_strlist( strlist_t sl ) -{ - strlist_t sl2; - - for(; sl; sl = sl2 ) { - sl2 = sl->next; - xfree(sl); - } -} +#define SL_PRIV_FLAG_WIPE 0x01 void -free_strlist_wipe (strlist_t sl) -{ - strlist_t sl2; - - for(; sl; sl = sl2 ) { - sl2 = sl->next; - wipememory (sl, sizeof *sl + strlen (sl->d)); - xfree(sl); - } -} - - -/* Add STRING to the LIST at the front. This function terminates the - process on memory shortage. */ -strlist_t -add_to_strlist( strlist_t *list, const char *string ) +_gpgrt_strlist_free (gpgrt_strlist_t sl) { - strlist_t sl; + gpgrt_strlist_t sl2; - sl = xmalloc( sizeof *sl + strlen(string)); - sl->flags = 0; - strcpy(sl->d, string); - sl->next = *list; - *list = sl; - return sl; -} - - -/* Add STRING to the LIST at the front. This function returns NULL - and sets ERRNO on memory shortage. */ -strlist_t -add_to_strlist_try (strlist_t *list, const char *string) -{ - strlist_t sl; - - sl = xtrymalloc (sizeof *sl + strlen (string)); - if (sl) + for (; sl; sl = sl2) { - sl->flags = 0; - strcpy (sl->d, string); - sl->next = *list; - *list = sl; - } - return sl; -} - - -/* Same as add_to_strlist() but if IS_UTF8 is *not* set, a conversion - to UTF-8 is done. This function terminates the process on memory - shortage. */ -strlist_t -add_to_strlist2( strlist_t *list, const char *string, int is_utf8 ) -{ - strlist_t sl; + sl2 = sl->next; + if ((sl->_private_flags & ~SL_PRIV_FLAG_WIPE)) + _gpgrt_log_fatal ("gpgrt_strlist_free: corrupted object %p\n", sl); - if (is_utf8) - sl = add_to_strlist( list, string ); - else - { - char *p = native_to_utf8( string ); - sl = add_to_strlist( list, p ); - xfree ( p ); + if ((sl->_private_flags & SL_PRIV_FLAG_WIPE)) + _gpgrt_wipememory (sl, sizeof *sl + strlen (sl->d)); + xfree(sl); } - return sl; } -/* Add STRING to the LIST at the end. This function terminates the - process on memory shortage. */ -strlist_t -append_to_strlist( strlist_t *list, const char *string ) -{ - strlist_t sl; - sl = append_to_strlist_try (list, string); - if (!sl) - xoutofcore (); - return sl; -} - - -/* Core of append_to_strlist_try which take the length of the string. +/* Core of gpgrt_strlist_append which take the length of the string. * Return the item added to the end of the list. Or NULL in case of * an error. */ -static strlist_t -do_append_to_strlist (strlist_t *list, const char *string, size_t stringlen) +static gpgrt_strlist_t +do_strlist_append (gpgrt_strlist_t *list, const char *string, size_t stringlen, + unsigned int flags) { - strlist_t r, sl; + gpgrt_strlist_t r, sl; sl = xtrymalloc (sizeof *sl + stringlen); if (!sl) return NULL; sl->flags = 0; + sl->_private_flags = (flags & GPGRT_STRLIST_WIPE)? SL_PRIV_FLAG_WIPE : 0; memcpy (sl->d, string, stringlen); sl->d[stringlen] = 0; sl->next = NULL; @@ -155,43 +84,53 @@ do_append_to_strlist (strlist_t *list, const char *string, size_t stringlen) } -/* Add STRING to the LIST at the end. */ -strlist_t -append_to_strlist_try (strlist_t *list, const char *string) +/* Add STRING to the LIST. This function returns NULL and sets ERRNO + * on memory shortage. If STRING is NULL an empty string is stored + * instead. FLAGS are these bits: + * GPGRT_STRLIST_APPEND - Append to the list; default is to prepend + * GPGRT_STRLIST_WIPE - Set a marker to wipe the string on free. + */ +gpgrt_strlist_t +_gpgrt_strlist_add (gpgrt_strlist_t *list, const char *string, + unsigned int flags) { - return do_append_to_strlist (list, string, strlen (string)); -} + gpgrt_strlist_t sl; + if (!string) + string = ""; -strlist_t -append_to_strlist2( strlist_t *list, const char *string, int is_utf8 ) -{ - strlist_t sl; + if ((flags & GPGRT_STRLIST_APPEND)) + return do_strlist_append (list, string, strlen (string), flags); - if( is_utf8 ) - sl = append_to_strlist( list, string ); - else + /* Default is to prepend. */ + sl = xtrymalloc (sizeof *sl + strlen (string)); + if (sl) { - char *p = native_to_utf8 (string); - sl = append_to_strlist( list, p ); - xfree( p ); + sl->flags = 0; + sl->_private_flags = (flags & GPGRT_STRLIST_WIPE)? SL_PRIV_FLAG_WIPE : 0; + strcpy (sl->d, string); + sl->next = *list; + *list = sl; } return sl; } - /* Tokenize STRING using the delimiters from DELIM and append each - * token to the string list LIST. On success a pinter into LIST with + * token to the string list LIST. On success a pointer into LIST with * the first new token is returned. Returns NULL on error and sets * ERRNO. Take care, an error with ENOENT set mean that no tokens - * were found in STRING. */ -strlist_t -tokenize_to_strlist (strlist_t *list, const char *string, const char *delim) + * were found in STRING. Only GPGRT_STRLIST_WIPE has an effect here. */ +gpgrt_strlist_t +_gpgrt_strlist_tokenize (gpgrt_strlist_t *list, const char *string, + const char *delim, unsigned int flags) { const char *s, *se; size_t n; - strlist_t newlist = NULL; - strlist_t tail; + gpgrt_strlist_t newlist = NULL; + gpgrt_strlist_t tail; + + if (!string) + string = ""; s = string; do @@ -203,24 +142,24 @@ tokenize_to_strlist (strlist_t *list, const char *string, const char *delim) n = strlen (s); if (!n) continue; /* Skip empty string. */ - tail = do_append_to_strlist (&newlist, s, n); + tail = do_strlist_append (&newlist, s, n, flags); if (!tail) { - free_strlist (newlist); + _gpgrt_strlist_free (newlist); return NULL; } - trim_spaces (tail->d); + _gpgrt_trim_spaces (tail->d); if (!*tail->d) /* Remove new but empty item from the list. */ { - tail = strlist_prev (newlist, tail); + tail = _gpgrt_strlist_prev (newlist, tail); if (tail) { - free_strlist (tail->next); + _gpgrt_strlist_free (tail->next); tail->next = NULL; } else if (newlist) { - free_strlist (newlist); + _gpgrt_strlist_free (newlist); newlist = NULL; } continue; @@ -232,7 +171,7 @@ tokenize_to_strlist (strlist_t *list, const char *string, const char *delim) { /* Not items found. Indicate this by returnning NULL with errno * set to ENOENT. */ - gpg_err_set_errno (ENOENT); + _gpg_err_set_errno (ENOENT); return NULL; } @@ -249,19 +188,25 @@ tokenize_to_strlist (strlist_t *list, const char *string, const char *delim) } -/* Return a copy of LIST. This function terminates the process on - memory shortage.*/ -strlist_t -strlist_copy (strlist_t list) +/* Return a copy of LIST. On error set ERRNO and return NULL. */ +gpgrt_strlist_t +_gpgrt_strlist_copy (gpgrt_strlist_t list) { - strlist_t newlist = NULL, sl, *last; + gpgrt_strlist_t newlist = NULL; + gpgrt_strlist_t sl, *last; last = &newlist; for (; list; list = list->next) { - sl = xmalloc (sizeof *sl + strlen (list->d)); + sl = xtrymalloc (sizeof *sl + strlen (list->d)); + if (!sl) + { + _gpgrt_strlist_free (newlist); + return NULL; + } sl->flags = list->flags; - strcpy(sl->d, list->d); + sl->_private_flags = list->_private_flags; + strcpy (sl->d, list->d); sl->next = NULL; *last = sl; last = &sl; @@ -269,87 +214,78 @@ strlist_copy (strlist_t list) return newlist; } +/* Reverse the list *LIST in place. */ +gpgrt_strlist_t +_gpgrt_strlist_rev (gpgrt_strlist_t *list) +{ + gpgrt_strlist_t l = *list; + gpgrt_strlist_t lrev = NULL; + while (l) + { + gpgrt_strlist_t tail = l->next; + l->next = lrev; + lrev = l; + l = tail; + } -strlist_t -strlist_prev( strlist_t head, strlist_t node ) + *list = lrev; + return lrev; +} + + +gpgrt_strlist_t +_gpgrt_strlist_prev (gpgrt_strlist_t head, gpgrt_strlist_t node) { - strlist_t n; + gpgrt_strlist_t n = NULL; - for(n=NULL; head && head != node; head = head->next ) - n = head; - return n; + for (; head && head != node; head = head->next ) + n = head; + return n; } -strlist_t -strlist_last( strlist_t node ) + +gpgrt_strlist_t +_gpgrt_strlist_last (gpgrt_strlist_t node) { - if( node ) - for( ; node->next ; node = node->next ) - ; - return node; + if (node) + for (; node->next ; node = node->next) + ; + return node; } /* Remove the first item from LIST and return its content in an - allocated buffer. This function terminates the process on memory - shortage. */ + * allocated buffer. This function returns NULl and sets ERRNO on + * error. */ char * -strlist_pop (strlist_t *list) +_gpgrt_strlist_pop (gpgrt_strlist_t *list) { - char *str=NULL; - strlist_t sl=*list; + char *str = NULL; + gpgrt_strlist_t sl = *list; - if(sl) + if (sl) { - str = xmalloc(strlen(sl->d)+1); - strcpy(str,sl->d); + str = xtrystrdup (sl->d); + if (!str) + return NULL; - *list=sl->next; - xfree(sl); + *list = sl->next; + sl->next = NULL; + xfree (sl); } return str; } + /* Return the first element of the string list HAYSTACK whose string matches NEEDLE. If no elements match, return NULL. */ -strlist_t -strlist_find (strlist_t haystack, const char *needle) +gpgrt_strlist_t +_gpgrt_strlist_find (gpgrt_strlist_t haystack, const char *needle) { - for (; - haystack; - haystack = haystack->next) - if (strcmp (haystack->d, needle) == 0) + for (; haystack; haystack = haystack->next) + if (!strcmp (haystack->d, needle)) return haystack; return NULL; } - -int -strlist_length (strlist_t list) -{ - int i; - for (i = 0; list; list = list->next) - i ++; - - return i; -} - -/* Reverse the list *LIST in place. */ -strlist_t -strlist_rev (strlist_t *list) -{ - strlist_t l = *list; - strlist_t lrev = NULL; - - while (l) - { - strlist_t tail = l->next; - l->next = lrev; - lrev = l; - l = tail; - } - - *list = lrev; - return lrev; -} diff --git a/src/visibility.c b/src/visibility.c index 836d4d0..367b6ef 100644 --- a/src/visibility.c +++ b/src/visibility.c @@ -1345,6 +1345,65 @@ gpgrt_absfnameconcat (const char *first, ... ) +void +gpgrt_strlist_free (gpgrt_strlist_t sl) +{ + _gpgrt_strlist_free (sl); +} + +gpgrt_strlist_t +gpgrt_strlist_add (gpgrt_strlist_t *list, const char *string, + unsigned int flags) +{ + return _gpgrt_strlist_add (list, string, flags); +} + +gpgrt_strlist_t +gpgrt_strlist_tokenize (gpgrt_strlist_t *list, const char *string, + const char *delim, unsigned int flags) +{ + return _gpgrt_strlist_tokenize (list, string, delim, flags); +} + +gpgrt_strlist_t +gpgrt_strlist_copy (gpgrt_strlist_t list) +{ + return _gpgrt_strlist_copy (list); +} + +gpgrt_strlist_t +gpgrt_strlist_rev (gpgrt_strlist_t *list) +{ + return _gpgrt_strlist_rev (list); +} + +gpgrt_strlist_t +gpgrt_strlist_prev (gpgrt_strlist_t head, gpgrt_strlist_t node) +{ + return _gpgrt_strlist_prev (head, node); +} + +gpgrt_strlist_t +gpgrt_strlist_last (gpgrt_strlist_t node) +{ + return _gpgrt_strlist_last (node); +} + +char * +gpgrt_strlist_pop (gpgrt_strlist_t *list) +{ + return _gpgrt_strlist_pop (list); +} + +gpgrt_strlist_t +gpgrt_strlist_find (gpgrt_strlist_t haystack, const char *needle) +{ + return _gpgrt_strlist_find (haystack, needle); +} + + + + /* For consistency reasons we use function wrappers also for Windows * specific function despite that they are technically not needed. */ #ifdef HAVE_W32_SYSTEM diff --git a/src/visibility.h b/src/visibility.h index 079dfb9..d466374 100644 --- a/src/visibility.h +++ b/src/visibility.h @@ -229,6 +229,16 @@ MARK_VISIBLE (gpgrt_cmp_version) MARK_VISIBLE (gpgrt_fnameconcat) MARK_VISIBLE (gpgrt_absfnameconcat) +MARK_VISIBLE (gpgrt_strlist_free) +MARK_VISIBLE (gpgrt_strlist_add) +MARK_VISIBLE (gpgrt_strlist_tokenize) +MARK_VISIBLE (gpgrt_strlist_copy) +MARK_VISIBLE (gpgrt_strlist_rev) +MARK_VISIBLE (gpgrt_strlist_prev) +MARK_VISIBLE (gpgrt_strlist_last) +MARK_VISIBLE (gpgrt_strlist_pop) +MARK_VISIBLE (gpgrt_strlist_find) + MARK_VISIBLE (gpgrt_spawn_actions_new) MARK_VISIBLE (gpgrt_spawn_actions_release) MARK_VISIBLE (gpgrt_spawn_actions_set_env_rev) @@ -449,6 +459,16 @@ MARK_VISIBLE (gpgrt_spawn_actions_set_atfork) #define gpgrt_fnameconcat _gpgrt_USE_UNDERSCORED_FUNCTION #define gpgrt_absfnameconcat _gpgrt_USE_UNDERSCORED_FUNCTION +#define gpgrt_strlist_free _gpgrt_USE_UNDERSCORED_FUNCTION +#define gpgrt_strlist_add _gpgrt_USE_UNDERSCORED_FUNCTION +#define gpgrt_strlist_tokenize _gpgrt_USE_UNDERSCORED_FUNCTION +#define gpgrt_strlist_copy _gpgrt_USE_UNDERSCORED_FUNCTION +#define gpgrt_strlist_rev _gpgrt_USE_UNDERSCORED_FUNCTION +#define gpgrt_strlist_prev _gpgrt_USE_UNDERSCORED_FUNCTION +#define gpgrt_strlist_last _gpgrt_USE_UNDERSCORED_FUNCTION +#define gpgrt_strlist_pop _gpgrt_USE_UNDERSCORED_FUNCTION +#define gpgrt_strlist_find _gpgrt_USE_UNDERSCORED_FUNCTION + /* Windows specific functions. */ #define gpgrt_free_wchar _gpgrt_USE_UNDERSCORED_FUNCTION #define gpgrt_utf8_to_wchar _gpgrt_USE_UNDERSCORED_FUNCTION |