From: Christian Grothoff Date: Thu, 29 Jun 2017 13:02:31 +0000 (+0200) Subject: fix FTBFS issues if --enable-logging=no is set X-Git-Tag: gnunet-0.11.0rc0~202 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=24cbb7fda2486ee9d2ae8e145d6ff8fe19df92b0;p=oweals%2Fgnunet.git fix FTBFS issues if --enable-logging=no is set --- diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c index 739b68228..1a2b32be0 100644 --- a/src/cadet/gnunet-service-cadet_channel.c +++ b/src/cadet/gnunet-service-cadet_channel.c @@ -2049,6 +2049,7 @@ void GCCH_debug (struct CadetChannel *ch, enum GNUNET_ErrorType level) { +#if !defined(GNUNET_CULL_LOGGING) int do_log; do_log = GNUNET_get_log_call_status (level & (~GNUNET_ERROR_TYPE_BULK), @@ -2088,6 +2089,7 @@ GCCH_debug (struct CadetChannel *ch, ntohl (ch->mid_recv.mid), (unsigned long long) ch->mid_futures, ntohl (ch->mid_send.mid)); +#endif } diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c index 7b66f61a2..82ab5cc2c 100644 --- a/src/cadet/gnunet-service-cadet_connection.c +++ b/src/cadet/gnunet-service-cadet_connection.c @@ -1066,6 +1066,7 @@ void GCC_debug (struct CadetConnection *cc, enum GNUNET_ErrorType level) { +#if !defined(GNUNET_CULL_LOGGING) int do_log; do_log = GNUNET_get_log_call_status (level & (~GNUNET_ERROR_TYPE_BULK), @@ -1086,6 +1087,7 @@ GCC_debug (struct CadetConnection *cc, GCPP_2s (cc->path), cc->state, (GNUNET_YES == cc->mqm_ready) ? "ready" : "busy"); +#endif } -/* end of gnunet-service-cadet-new_connection.c */ +/* end of gnunet-service-cadet_connection.c */ diff --git a/src/cadet/gnunet-service-cadet_tunnels.c b/src/cadet/gnunet-service-cadet_tunnels.c index 28004debc..22e19ef70 100644 --- a/src/cadet/gnunet-service-cadet_tunnels.c +++ b/src/cadet/gnunet-service-cadet_tunnels.c @@ -3404,6 +3404,7 @@ void GCT_debug (const struct CadetTunnel *t, enum GNUNET_ErrorType level) { +#if !defined(GNUNET_CULL_LOGGING) struct CadetTConnection *iter_c; int do_log; @@ -3435,7 +3436,8 @@ GCT_debug (const struct CadetTunnel *t, LOG2 (level, "TTT TUNNEL END\n"); +#endif } -/* end of gnunet-service-cadet-new_tunnels.c */ +/* end of gnunet-service-cadet_tunnels.c */ diff --git a/src/util/bandwidth.c b/src/util/bandwidth.c index bc0c3b9b4..f551bbb82 100644 --- a/src/util/bandwidth.c +++ b/src/util/bandwidth.c @@ -327,7 +327,6 @@ static void update_tracker (struct GNUNET_BANDWIDTH_Tracker *av) { struct GNUNET_TIME_Absolute now; - struct GNUNET_TIME_Relative delta; uint64_t delta_time; uint64_t delta_avail; uint64_t left_bytes; @@ -354,14 +353,20 @@ update_tracker (struct GNUNET_BANDWIDTH_Tracker *av) else av->consumption_since_last_update__ = - max_carry; } - delta.rel_value_us = delta_time; - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Tracker %p updated, consumption at %lld at %u Bps, last update was %s ago\n", - av, - (long long) av->consumption_since_last_update__, - (unsigned int) av->available_bytes_per_s__, - GNUNET_STRINGS_relative_time_to_string (delta, - GNUNET_YES)); +#if !defined(GNUNET_CULL_LOGGING) + { + struct GNUNET_TIME_Relative delta; + + delta.rel_value_us = delta_time; + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Tracker %p updated, consumption at %lld at %u Bps, last update was %s ago\n", + av, + (long long) av->consumption_since_last_update__, + (unsigned int) av->available_bytes_per_s__, + GNUNET_STRINGS_relative_time_to_string (delta, + GNUNET_YES)); + } +#endif } diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 7d5b50b8b..34481fe13 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c @@ -203,6 +203,8 @@ struct LogDef int force; }; + +#if !defined(GNUNET_CULL_LOGGING) /** * Dynamic array of logging definitions */ @@ -219,19 +221,20 @@ static int logdefs_size; static int logdefs_len; /** - * GNUNET_YES if GNUNET_LOG environment variable is already parsed. + * #GNUNET_YES if GNUNET_LOG environment variable is already parsed. */ static int gnunet_log_parsed; /** - * GNUNET_YES if GNUNET_FORCE_LOG environment variable is already parsed. + * #GNUNET_YES if GNUNET_FORCE_LOG environment variable is already parsed. */ static int gnunet_force_log_parsed; /** - * GNUNET_YES if at least one definition with forced == 1 is available. + * #GNUNET_YES if at least one definition with forced == 1 is available. */ static int gnunet_force_log_present; +#endif #ifdef WINDOWS /** @@ -269,18 +272,6 @@ get_type (const char *log) } -#if !defined(GNUNET_CULL_LOGGING) -/** - * Utility function - reallocates logdefs array to be twice as large. - */ -static void -resize_logdefs () -{ - logdefs_size = (logdefs_size + 1) * 2; - logdefs = GNUNET_realloc (logdefs, logdefs_size * sizeof (struct LogDef)); -} - - /** * Abort the process, generate a core dump if possible. */ @@ -294,6 +285,18 @@ GNUNET_abort_ () } +#if !defined(GNUNET_CULL_LOGGING) +/** + * Utility function - reallocates logdefs array to be twice as large. + */ +static void +resize_logdefs () +{ + logdefs_size = (logdefs_size + 1) * 2; + logdefs = GNUNET_realloc (logdefs, logdefs_size * sizeof (struct LogDef)); +} + + #if ! TALER_WALLET_ONLY /** * Rotate logs, deleting the oldest log. @@ -715,7 +718,7 @@ GNUNET_log_setup (const char *comp, log_file_name = GNUNET_STRINGS_filename_expand (logfile); if (NULL == log_file_name) return GNUNET_SYSERR; -#if TALER_WALLET_ONLY +#if TALER_WALLET_ONLY || defined(GNUNET_CULL_LOGGING) /* log file option not allowed for wallet logic */ GNUNET_assert (NULL == logfile); return GNUNET_OK; @@ -1030,7 +1033,7 @@ mylog (enum GNUNET_ErrorType kind, } #endif VSNPRINTF (buf, size, message, va); -#if ! TALER_WALLET_ONLY +#if ! (defined(GNUNET_CULL_LOGGING) || TALER_WALLET_ONLY) if (NULL != tmptr) (void) setup_log_file (tmptr); #endif diff --git a/src/util/crypto_ecc_setup.c b/src/util/crypto_ecc_setup.c index 2f2e2f122..64610ddd3 100644 --- a/src/util/crypto_ecc_setup.c +++ b/src/util/crypto_ecc_setup.c @@ -119,7 +119,8 @@ GNUNET_CRYPTO_eddsa_key_create_from_file (const char *filename) { ec = errno; LOG (GNUNET_ERROR_TYPE_ERROR, - _("Could not acquire lock on file `%s': %s...\n"), filename, + _("Could not acquire lock on file `%s': %s...\n"), + filename, STRERROR (ec)); } } @@ -313,7 +314,8 @@ GNUNET_CRYPTO_ecdsa_key_create_from_file (const char *filename) { ec = errno; LOG (GNUNET_ERROR_TYPE_ERROR, - _("Could not acquire lock on file `%s': %s...\n"), filename, + _("Could not acquire lock on file `%s': %s...\n"), + filename, STRERROR (ec)); LOG (GNUNET_ERROR_TYPE_ERROR, _ diff --git a/src/util/gnunet-service-resolver.c b/src/util/gnunet-service-resolver.c index 12e484845..d26bdd212 100644 --- a/src/util/gnunet-service-resolver.c +++ b/src/util/gnunet-service-resolver.c @@ -666,6 +666,8 @@ handle_get (void *cls, return; } ip = &msg[1]; + +#if !defined(GNUNET_CULL_LOGGING) { char buf[INET6_ADDRSTRLEN]; @@ -676,6 +678,7 @@ handle_get (void *cls, buf, sizeof (buf))); } +#endif get_ip_as_string (client, af, ip); diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index 0c915932c..e7bba3000 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c @@ -821,6 +821,7 @@ handle_lookup_timeout (void *cls) } else { +#if !defined(GNUNET_CULL_LOGGING) char buf[INET6_ADDRSTRLEN]; LOG (GNUNET_ERROR_TYPE_INFO, @@ -829,6 +830,7 @@ handle_lookup_timeout (void *cls) (const void *) &rh[1], buf, sizeof(buf))); +#endif if (GNUNET_NO == rh->received_response) { char *nret; diff --git a/src/util/test_common_logging_dummy.c b/src/util/test_common_logging_dummy.c index 0d971eac5..cb191ddab 100644 --- a/src/util/test_common_logging_dummy.c +++ b/src/util/test_common_logging_dummy.c @@ -47,11 +47,15 @@ my_log (void *ctx, enum GNUNET_ErrorType kind, const char *component, fflush (stdout); } + +#if !defined(GNUNET_CULL_LOGGING) static int expensive_func () { return GNUNET_NETWORK_socket_select (NULL, NULL, NULL, OUTPUT_DELAY); } +#endif + #define pr(kind,lvl) {\ struct GNUNET_TIME_Absolute t1, t2;\