diff options
author | Thomas Haller <thaller@redhat.com> | 2024-04-22 07:39:40 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2024-04-22 08:30:56 (GMT) |
commit | 264b244e4d0044d6598d247e94f6d39defaede90 (patch) | |
tree | 304aae9f35b76405958ded3dd1daa79d280d9754 | |
parent | dbe21b8d64cdfd38476cddee0bb766fa7d4a7c3c (diff) | |
download | libnl-264b244e4d0044d6598d247e94f6d39defaede90.zip libnl-264b244e4d0044d6598d247e94f6d39defaede90.tar.gz libnl-264b244e4d0044d6598d247e94f6d39defaede90.tar.bz2 |
utils: always define nl_debug_dp
Otherwise, whether libnl-3.so exports nl_debug_dp depends on NL_DEBUG.
That is ugly. It also breaks the linker checking the symbol versioning
file with the "--no-undefined-version" flag.
Instead, always define it. It's small anyway.
Reported-by: lch361 <lch361@skiff.com>
See-also: https://github.com/thom311/libnl/pull/375
-rw-r--r-- | lib/cache_mngr.c | 10 | ||||
-rw-r--r-- | lib/utils.c | 4 |
2 files changed, 5 insertions, 9 deletions
diff --git a/lib/cache_mngr.c b/lib/cache_mngr.c index 0caf10d..7b2a9bd 100644 --- a/lib/cache_mngr.c +++ b/lib/cache_mngr.c @@ -58,10 +58,9 @@ static int include_cb(struct nl_object *obj, struct nl_parser_param *p) struct nl_cache_ops *ops = ca->ca_cache->c_ops; NL_DBG(2, "Including object %p into cache %p\n", obj, ca->ca_cache); -#if NL_DEBUG - if (nl_debug >= 4) + + if (NL_DEBUG && nl_debug >= 4) nl_object_dump(obj, &nl_debug_dp); -#endif if (ops->co_event_filter) if (ops->co_event_filter(ca->ca_cache, obj) != NL_OK) @@ -93,10 +92,9 @@ static int event_input(struct nl_msg *msg, void *arg) NL_DBG(2, "Cache manager %p, handling new message %p as event\n", mngr, msg); -#if NL_DEBUG - if (nl_debug >= 4) + + if (NL_DEBUG && nl_debug >= 4) nl_msg_dump(msg, stderr); -#endif if (mngr->cm_protocol != protocol) BUG(); diff --git a/lib/utils.c b/lib/utils.c index 2363c02..471cd21 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -52,7 +52,6 @@ int nl_debug = 0; /** @cond SKIP */ -#if NL_DEBUG struct nl_dump_params nl_debug_dp = { .dp_type = NL_DUMP_DETAILS, }; @@ -61,7 +60,7 @@ static void _nl_init nl_debug_init(void) { char *nldbg, *end; - if ((nldbg = getenv("NLDBG"))) { + if (NL_DEBUG && (nldbg = getenv("NLDBG"))) { long level = strtol(nldbg, &end, 0); if (nldbg != end) nl_debug = level; @@ -69,7 +68,6 @@ static void _nl_init nl_debug_init(void) nl_debug_dp.dp_fd = stderr; } -#endif int __nl_read_num_str_file(const char *path, int (*cb)(long, const char *)) { |