diff options
author | Werner Koch <wk@gnupg.org> | 2009-10-19 11:18:46 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2009-10-19 11:18:46 +0200 |
commit | 97be197d31314ce89b91683e6440c4630075296d (patch) | |
tree | ffe2d357588e22e0b06bdb16574ffca72c0d7412 /jnlib | |
parent | Removed audit.h cruft which forced us to link against libksba. (diff) | |
download | gnupg2-97be197d31314ce89b91683e6440c4630075296d.tar.xz gnupg2-97be197d31314ce89b91683e6440c4630075296d.zip |
[g13] Add RECIPEINT and CREATE command.
[sm] Chnage --include-certs default
Diffstat (limited to 'jnlib')
-rw-r--r-- | jnlib/ChangeLog | 4 | ||||
-rw-r--r-- | jnlib/strlist.c | 19 | ||||
-rw-r--r-- | jnlib/strlist.h | 1 |
3 files changed, 24 insertions, 0 deletions
diff --git a/jnlib/ChangeLog b/jnlib/ChangeLog index 84e37c52f..54984930d 100644 --- a/jnlib/ChangeLog +++ b/jnlib/ChangeLog @@ -1,3 +1,7 @@ +2009-10-19 Werner Koch <wk@g10code.com> + + * strlist.c (add_to_strlist_try): New. + 2009-09-22 Werner Koch <wk@g10code.com> * dotlock.h (DOTLOCK): Rename to dotlock_t. Change all users. diff --git a/jnlib/strlist.c b/jnlib/strlist.c index d45a1648a..b31e6213a 100644 --- a/jnlib/strlist.c +++ b/jnlib/strlist.c @@ -57,6 +57,25 @@ add_to_strlist( strlist_t *list, const char *string ) } +/* 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 = jnlib_malloc (sizeof *sl + strlen (string)); + if (sl) + { + 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. */ diff --git a/jnlib/strlist.h b/jnlib/strlist.h index 4191624ae..1e2ffa8da 100644 --- a/jnlib/strlist.h +++ b/jnlib/strlist.h @@ -30,6 +30,7 @@ typedef struct string_list *strlist_t; void free_strlist (strlist_t sl); strlist_t add_to_strlist (strlist_t *list, const char *string); +strlist_t add_to_strlist_try (strlist_t *list, const char *string); strlist_t add_to_strlist2( strlist_t *list, const char *string, int is_utf8); |