Change the signature of init_progfile_dir() so the casting of the
authorGuy Harris <guy@alum.mit.edu>
Sun, 22 Mar 2009 06:53:17 +0000 (06:53 -0000)
committerGuy Harris <guy@alum.mit.edu>
Sun, 22 Mar 2009 06:53:17 +0000 (06:53 -0000)
function pointer (to main) to an argument to dladdr() is done in
init_progfile_dir() rather than its callers.

svn path=/trunk/; revision=27814

capinfos.c
dftest.c
editcap.c
epan/filesystem.c
epan/filesystem.h
gtk/main.c
rawshark.c
tshark.c

index 777cc0fa562c9975f60acda656396871897a8a4a..a3e1c5b85e585df4cb3bb70a7d14b9a303c64e6f 100644 (file)
@@ -302,7 +302,7 @@ main(int argc, char *argv[])
 #ifdef HAVE_PLUGINS
   /* Register wiretap plugins */
 
-    if ((init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main))) {
+    if ((init_progfile_dir_error = init_progfile_dir(argv[0], main))) {
                g_warning("capinfos: init_progfile_dir(): %s", init_progfile_dir_error);
                g_free(init_progfile_dir_error);
     } else {
index eba59b0ea45eb2d59aaca54f4f712322a8ca184e..d8492e09150e9d65072e65eee544671e747aaed4 100644 (file)
--- a/dftest.c
+++ b/dftest.c
@@ -75,7 +75,7 @@ main(int argc, char **argv)
        /*
         * Attempt to get the pathname of the executable file.
         */
-       init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main);
+       init_progfile_dir_error = init_progfile_dir(argv[0], main);
        if (init_progfile_dir_error != NULL) {
                fprintf(stderr, "dftest: Can't get pathname of dftest program: %s.\n",
                    init_progfile_dir_error);
index 250730c7a89b69bec6813c30da578df5ed7664e6..cdcfa99a6fb78b71289e536e28e578b00258fa16 100644 (file)
--- a/editcap.c
+++ b/editcap.c
@@ -424,7 +424,7 @@ main(int argc, char *argv[])
 
 #ifdef HAVE_PLUGINS
   /* Register wiretap plugins */
-  if ((init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main))) {
+  if ((init_progfile_dir_error = init_progfile_dir(argv[0], main))) {
     g_warning("capinfos: init_progfile_dir(): %s", init_progfile_dir_error);
     g_free(init_progfile_dir_error);
   } else {
index dbf5e04f71577d71a88557879bd3999a1d9bcf8c..7b1fb617b28359b6ca8e772c61d5a8d9a908ef1e 100644 (file)
@@ -249,7 +249,7 @@ init_progfile_dir(const char *arg0
 #ifdef _WIN32
        _U_
 #endif
-, void *main_addr
+, int (*main_addr)(int, char **)
 #if defined(_WIN32) || !defined(DLADDR_FINDS_EXECUTABLE_PATH)
        _U_
 #endif
@@ -369,7 +369,7 @@ init_progfile_dir(const char *arg0
        /*
         * Try to use dladdr() to find the pathname of the executable.
         */
-       if (dladdr(main_addr, &info) && info.dli_fname[0] == '/') {
+       if (dladdr((void *)main_addr, &info) && info.dli_fname[0] == '/') {
                /*
                 * dladdr() succeeded, and we got an absolute path
                 * for the module containing main() (I don't know
index 96adeb74251b5b10ec5d07ad22e3b494da78205b..895f956be7bcbb3639460365d21960b80d9d0af2 100644 (file)
@@ -36,7 +36,7 @@
  * and save it for future use.  Returns NULL on success, and a
  * g_mallocated string containing an error on failure.
  */
-extern char *init_progfile_dir(const char *arg0, void *main_addr);
+extern char *init_progfile_dir(const char *arg0, int (*main)(int, char **));
 
 /*
  * Get the directory in which the program resides.
index d763aa87f13a9e50d7b51338a049ca1bf943ba10..0bae3d3d0652ef5fb093abd956a10aeb17100126 100644 (file)
@@ -1808,7 +1808,7 @@ main(int argc, char *argv[])
   /*
    * Attempt to get the pathname of the executable file.
    */
-  init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main);
+  init_progfile_dir_error = init_progfile_dir(argv[0], main);
 
   /* initialize the funnel mini-api */
   initialize_funnel_ops();
index f1f31c125e11a71c0432fffcc7e8d0cb73f52565..2b958cf70371c0effdb36cd1d0161e2fa1693b92 100644 (file)
@@ -460,7 +460,7 @@ main(int argc, char *argv[])
   /*
    * Attempt to get the pathname of the executable file.
    */
-  init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main);
+  init_progfile_dir_error = init_progfile_dir(argv[0], main);
   if (init_progfile_dir_error != NULL) {
     fprintf(stderr, "rawshark: Can't get pathname of rawshark program: %s.\n",
             init_progfile_dir_error);
index bf30086cce733db380c9b51b97a36173094e6482..5f3e060a95d68781269bbd03e97ece2f084c7594 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -773,7 +773,7 @@ main(int argc, char *argv[])
   /*
    * Attempt to get the pathname of the executable file.
    */
-  init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main);
+  init_progfile_dir_error = init_progfile_dir(argv[0], main);
   if (init_progfile_dir_error != NULL) {
     fprintf(stderr, "tshark: Can't get pathname of tshark program: %s.\n",
             init_progfile_dir_error);