From fbf2e3cf8fc07ef9f8b7cc4627fec82885560f98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Sat, 12 Dec 2015 02:34:47 +0000 Subject: Make init_progfile_dir() take a function pointer [-Wpedantic] Change-Id: I45f8ea5ee6ccc5a484c60ad6e686aaf30f6b0c98 Reviewed-on: https://code.wireshark.org/review/12557 Petri-Dish: Alexis La Goutte Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris --- wsutil/filesystem.c | 8 ++++++-- wsutil/filesystem.h | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'wsutil') diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c index 787ad6ebb4..e8bdea325a 100644 --- a/wsutil/filesystem.c +++ b/wsutil/filesystem.c @@ -62,6 +62,7 @@ #include #include #include +#include #include /* for WTAP_ERR_SHORT_WRITE */ @@ -454,7 +455,7 @@ init_progfile_dir(const char *arg0 #ifdef _WIN32 _U_ #endif -, void *function_addr +, int (*function_addr)(int, char **) #if defined(_WIN32) || !defined(HAVE_DLADDR) _U_ #endif @@ -560,8 +561,11 @@ init_progfile_dir(const char *arg0 * path and obviate the need for us to determine the absolute * path. */ - if (dladdr(function_addr, &info)) +DIAG_OFF(pedantic) + if (dladdr((void *)function_addr, &info)) { +DIAG_ON(pedantic) execname = info.dli_fname; + } } #endif if (execname == NULL) { diff --git a/wsutil/filesystem.h b/wsutil/filesystem.h index 03d2877e65..137f0dae63 100644 --- a/wsutil/filesystem.h +++ b/wsutil/filesystem.h @@ -40,7 +40,7 @@ extern "C" { * and save it for future use. Returns NULL on success, and a * g_mallocated string containing an error on failure. */ -WS_DLL_PUBLIC char *init_progfile_dir(const char *arg0, void *function_addr); +WS_DLL_PUBLIC char *init_progfile_dir(const char *arg0, int (*function_addr)(int, char **)); /* * Get the directory in which the program resides. -- cgit v1.2.3