1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

common: Remove libjnlib-config.h (jnlib merge).

* common/libjnlib-config.h: Remove.
* common/common-defs.h (getenv) [HAVE_GETENV]: New.  From removed
header.
(getpid) [HAVE_W32CE_SYSTEM]: New.  From removed header.
* common/argparse.c: Include util.h and common-defs.h.  Replace
jnlib_ macro names for non-GNUPG builds by x* names.
* common/dotlock.c: Ditto.
* common/logging.c: Include util.h and common-defs.h.  Replace jnlib_
symbol names by x* names.
* common/strlist.c: Ditto.
* common/utf8conv.c: Ditto.
* common/w32-reg.c: Ditto.
* common/mischelp.c: Ditto.  Also remove _jnlib_free.
* common/stringhelp.c: Ditto.
(JNLIB_LOG_WITH_PREFIX): Do not depend on this macro.
* common/logging.h (JNLIB_LOG_WITH_PREFIX): Do not depend on this
macro.
--

This is part 1 of the patches to merge the jnlib files into common/.
It does not make much sense to keep jnlib/ files separate.  They are
not often use elsewhere and maintaining the complex marcos stuff is
too troublesome for the future.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-04-24 15:19:10 +02:00
parent 154f3ed2bf
commit 17bcd08708
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
15 changed files with 197 additions and 324 deletions

View file

@ -35,11 +35,10 @@
#include <stdarg.h>
#include <ctype.h>
#include "libjnlib-config.h"
#include "util.h"
#include "common-defs.h"
#include "strlist.h"
#ifdef JNLIB_NEED_UTF8CONV
#include "utf8conv.h"
#endif
void
free_strlist( strlist_t sl )
@ -48,7 +47,7 @@ free_strlist( strlist_t sl )
for(; sl; sl = sl2 ) {
sl2 = sl->next;
jnlib_free(sl);
xfree(sl);
}
}
@ -60,7 +59,7 @@ add_to_strlist( strlist_t *list, const char *string )
{
strlist_t sl;
sl = jnlib_xmalloc( sizeof *sl + strlen(string));
sl = xmalloc( sizeof *sl + strlen(string));
sl->flags = 0;
strcpy(sl->d, string);
sl->next = *list;
@ -76,7 +75,7 @@ add_to_strlist_try (strlist_t *list, const char *string)
{
strlist_t sl;
sl = jnlib_malloc (sizeof *sl + strlen (string));
sl = xtrymalloc (sizeof *sl + strlen (string));
if (sl)
{
sl->flags = 0;
@ -91,7 +90,6 @@ add_to_strlist_try (strlist_t *list, const char *string)
/* 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. */
#ifdef JNLIB_NEED_UTF8CONV
strlist_t
add_to_strlist2( strlist_t *list, const char *string, int is_utf8 )
{
@ -103,11 +101,10 @@ add_to_strlist2( strlist_t *list, const char *string, int is_utf8 )
{
char *p = native_to_utf8( string );
sl = add_to_strlist( list, p );
jnlib_free ( p );
xfree ( p );
}
return sl;
}
#endif /* JNLIB_NEED_UTF8CONV*/
/* Add STRING to the LIST at the end. This function terminates the
@ -117,7 +114,7 @@ append_to_strlist( strlist_t *list, const char *string )
{
strlist_t r, sl;
sl = jnlib_xmalloc( sizeof *sl + strlen(string));
sl = xmalloc( sizeof *sl + strlen(string));
sl->flags = 0;
strcpy(sl->d, string);
sl->next = NULL;
@ -132,7 +129,6 @@ append_to_strlist( strlist_t *list, const char *string )
}
#ifdef JNLIB_NEED_UTF8CONV
strlist_t
append_to_strlist2( strlist_t *list, const char *string, int is_utf8 )
{
@ -144,11 +140,10 @@ append_to_strlist2( strlist_t *list, const char *string, int is_utf8 )
{
char *p = native_to_utf8 (string);
sl = append_to_strlist( list, p );
jnlib_free( p );
xfree( p );
}
return sl;
}
#endif /* JNLIB_NEED_UTF8CONV */
/* Return a copy of LIST. This function terminates the process on
@ -161,7 +156,7 @@ strlist_copy (strlist_t list)
last = &newlist;
for (; list; list = list->next)
{
sl = jnlib_xmalloc (sizeof *sl + strlen (list->d));
sl = xmalloc (sizeof *sl + strlen (list->d));
sl->flags = list->flags;
strcpy(sl->d, list->d);
sl->next = NULL;
@ -204,11 +199,11 @@ strlist_pop (strlist_t *list)
if(sl)
{
str=jnlib_xmalloc(strlen(sl->d)+1);
str = xmalloc(strlen(sl->d)+1);
strcpy(str,sl->d);
*list=sl->next;
jnlib_free(sl);
xfree(sl);
}
return str;