mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +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:
parent
154f3ed2bf
commit
17bcd08708
15 changed files with 197 additions and 324 deletions
|
@ -56,9 +56,10 @@
|
|||
#include <assert.h>
|
||||
|
||||
|
||||
#define JNLIB_NEED_LOG_LOGV 1
|
||||
#define JNLIB_NEED_AFLOCAL 1
|
||||
#include "libjnlib-config.h"
|
||||
#include "util.h"
|
||||
#include "i18n.h"
|
||||
#include "common-defs.h"
|
||||
#include "logging.h"
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
|
@ -261,7 +262,7 @@ fun_writer (void *cookie_arg, const void *buffer, size_t size)
|
|||
void *addrbuf = NULL;
|
||||
#endif /*HAVE_INET_PTON*/
|
||||
|
||||
addrstr = jnlib_malloc (strlen (name) + 1);
|
||||
addrstr = xtrymalloc (strlen (name) + 1);
|
||||
if (!addrstr)
|
||||
addrlen = 0; /* This indicates an error. */
|
||||
else if (*name == '[')
|
||||
|
@ -271,7 +272,7 @@ fun_writer (void *cookie_arg, const void *buffer, size_t size)
|
|||
p = strchr (addrstr, ']');
|
||||
if (!p || p[1] != ':' || !parse_portno (p+2, &port))
|
||||
{
|
||||
jnlib_set_errno (EINVAL);
|
||||
gpg_err_set_errno (EINVAL);
|
||||
addrlen = 0;
|
||||
}
|
||||
else
|
||||
|
@ -289,7 +290,7 @@ fun_writer (void *cookie_arg, const void *buffer, size_t size)
|
|||
srvr_addr = (struct sockaddr *)&srvr_addr_in6;
|
||||
addrlen = sizeof srvr_addr_in6;
|
||||
#else
|
||||
jnlib_set_errno (EAFNOSUPPORT);
|
||||
gpg_err_set_errno (EAFNOSUPPORT);
|
||||
addrlen = 0;
|
||||
#endif
|
||||
}
|
||||
|
@ -301,7 +302,7 @@ fun_writer (void *cookie_arg, const void *buffer, size_t size)
|
|||
p = strchr (addrstr, ':');
|
||||
if (!p || !parse_portno (p+1, &port))
|
||||
{
|
||||
jnlib_set_errno (EINVAL);
|
||||
gpg_err_set_errno (EINVAL);
|
||||
addrlen = 0;
|
||||
}
|
||||
else
|
||||
|
@ -334,7 +335,7 @@ fun_writer (void *cookie_arg, const void *buffer, size_t size)
|
|||
#endif /*!HAVE_INET_PTON*/
|
||||
}
|
||||
|
||||
jnlib_free (addrstr);
|
||||
xfree (addrstr);
|
||||
}
|
||||
|
||||
cookie->fd = addrlen? socket (pf, SOCK_STREAM, 0) : -1;
|
||||
|
@ -425,7 +426,7 @@ fun_closer (void *cookie_arg)
|
|||
|
||||
if (cookie->fd != -1 && cookie->fd != 2)
|
||||
sock_close (cookie->fd);
|
||||
jnlib_free (cookie);
|
||||
xfree (cookie);
|
||||
log_socket = -1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -487,7 +488,7 @@ set_file_fd (const char *name, int fd)
|
|||
/* The xmalloc below is justified because we can expect that this
|
||||
function is called only during initialization and there is no
|
||||
easy way out of this error condition. */
|
||||
cookie = jnlib_xmalloc (sizeof *cookie + (name? strlen (name):0));
|
||||
cookie = xmalloc (sizeof *cookie + (name? strlen (name):0));
|
||||
strcpy (cookie->name, name? name:"");
|
||||
cookie->quiet = 0;
|
||||
cookie->is_socket = 0;
|
||||
|
@ -648,7 +649,7 @@ do_logv (int level, int ignore_arg_ptr, const char *fmt, va_list arg_ptr)
|
|||
: read_w32_registry_string (NULL, GNUPG_REGISTRY_DIR,
|
||||
"DefaultLogFile"));
|
||||
log_set_file (tmp && *tmp? tmp : NULL);
|
||||
jnlib_free (tmp);
|
||||
xfree (tmp);
|
||||
#else
|
||||
log_set_file (NULL); /* Make sure a log stream has been set. */
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue