diff options
Diffstat (limited to 'src/libstrongswan/printf_hook.c')
-rw-r--r-- | src/libstrongswan/printf_hook.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/libstrongswan/printf_hook.c b/src/libstrongswan/printf_hook.c index ceace27da..692ad9cf8 100644 --- a/src/libstrongswan/printf_hook.c +++ b/src/libstrongswan/printf_hook.c @@ -12,8 +12,6 @@ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. - * - * $Id: printf_hook.c 4975 2009-03-19 08:54:39Z martin $ */ #include "printf_hook.h" @@ -62,7 +60,7 @@ struct printf_hook_handler_t { */ int argtypes[ARGS_MAX]; -#ifndef HAVE_PRINTF_HOOKS +#ifdef USE_VSTR /** * name required for Vstr */ @@ -77,7 +75,7 @@ static printf_hook_handler_t *printf_hooks[NUM_HANDLERS]; #define SPEC_TO_INDEX(spec) ((int)(spec) - (int)'A') #define IS_VALID_SPEC(spec) (SPEC_TO_INDEX(spec) > -1 && SPEC_TO_INDEX(spec) < NUM_HANDLERS) -#ifdef HAVE_PRINTF_HOOKS +#if defined(HAVE_PRINTF_HOOKS) && !defined(USE_VSTR) /** * Printf hook print function. This is actually of type "printf_function", @@ -165,7 +163,7 @@ static int custom_fmt_cb(Vstr_base *base, size_t pos, Vstr_fmt_spec *fmt_spec) } /** - * Add a custom format handler to the given Vstr_conf object + * Add a custom format handler to the given Vstr_conf object */ static void vstr_fmt_add_handler(Vstr_conf *conf, printf_hook_handler_t *handler) { @@ -340,7 +338,7 @@ static void add_handler(private_printf_hook_t *this, char spec, return; } - handler = malloc_thing(printf_hook_handler_t); + handler = malloc_thing(printf_hook_handler_t); handler->hook = hook; va_start(args, hook); @@ -361,7 +359,7 @@ static void add_handler(private_printf_hook_t *this, char spec, if (handler->numargs > 0) { -#ifdef HAVE_PRINTF_HOOKS +#if defined(HAVE_PRINTF_HOOKS) && !defined(USE_VSTR) register_printf_function(spec, custom_print, custom_arginfo); #else Vstr_conf *conf = get_vstr_conf(); @@ -384,7 +382,7 @@ static void add_handler(private_printf_hook_t *this, char spec, static void destroy(private_printf_hook_t *this) { int i; -#ifndef HAVE_PRINTF_HOOKS +#ifdef USE_VSTR Vstr_conf *conf = get_vstr_conf(); #endif @@ -393,7 +391,7 @@ static void destroy(private_printf_hook_t *this) printf_hook_handler_t *handler = printf_hooks[i]; if (handler) { -#ifndef HAVE_PRINTF_HOOKS +#ifdef USE_VSTR vstr_fmt_del(conf, handler->name); free(handler->name); #endif @@ -401,7 +399,7 @@ static void destroy(private_printf_hook_t *this) } } -#ifndef HAVE_PRINTF_HOOKS +#ifdef USE_VSTR /* freeing the Vstr_conf of the main thread */ pthread_key_delete(vstr_conf_key); vstr_free_conf(conf); @@ -422,7 +420,7 @@ printf_hook_t *printf_hook_create() memset(printf_hooks, 0, sizeof(printf_hooks)); -#ifndef HAVE_PRINTF_HOOKS +#ifdef USE_VSTR if (!vstr_init()) { DBG1("failed to initialize Vstr library!"); |