[winedump 1/2] Allow several -I and nice speed up.

Peter Berg Larsen pebl at math.ku.dk
Fri Dec 17 10:26:56 CST 2004


Changelog:
   Allow several -I paramters to be given - currently just the last is
   used. Remove obvious wrong binaeries when searching for the
   definition of a functions definition. Really just strip a '.dll'
   extension and not also '.dll.foorbar.spec'.


diff -u -r wine-20041201-org/tools/winedump/main.c wine-20041201/tools/winedump/main.c
--- wine-20041201-org/tools/winedump/main.c	2004-01-15 02:47:46.000000000 +0100
+++ wine-20041201/tools/winedump/main.c	2004-12-16 20:37:45.000000000 +0100
@@ -27,16 +27,24 @@

 static void do_include (const char *arg)
 {
-  globals.directory = arg;
+  char *newIncludes;
+
+  if (!globals.directory)
+    globals.directory = strdup(arg);
+  else {
+    newIncludes = str_create (3,globals.directory," ",arg);
+    free(globals.directory);
+    globals.directory = newIncludes;
+  }
   globals.do_code = 1;
 }


 static inline const char* strip_ext (const char *str)
 {
-  char *ext = strstr(str, ".dll");
-  if (ext)
-    return str_substring (str, ext);
+  int len = strlen(str);
+  if (len>4 && strcmp(str+len-4,".dll") == 0)
+    return str_substring (str, str+len-4);
   else
     return strdup (str);
 }
@@ -193,7 +201,7 @@
   {"-t",    SPEC, 0, do_trace,    "-t           TRACE arguments (implies -c)"},
   {"-f",    SPEC, 1, do_forward,  "-f dll       Forward calls to 'dll' (implies -t)"},
   {"-D",    SPEC, 0, do_document, "-D           Generate documentation"},
-  {"-o",    SPEC, 1, do_name,     "-o name      Set the output dll name (default: dll)"},
+  {"-o",    SPEC, 1, do_name,     "-o name      Set the output dll name (default: dll). note: strips .dll extensions"},
   {"-C",    SPEC, 0, do_cdecl,    "-C           Assume __cdecl calls (default: __stdcall)"},
   {"-s",    SPEC, 1, do_start,    "-s num       Start prototype search after symbol 'num'"},
   {"-e",    SPEC, 1, do_end,      "-e num       End prototype search after symbol 'num'"},
diff -u -r wine-20041201-org/tools/winedump/search.c wine-20041201/tools/winedump/search.c
--- wine-20041201-org/tools/winedump/search.c	2002-04-26 21:05:18.000000000 +0200
+++ wine-20041201/tools/winedump/search.c	2004-12-16 20:58:17.000000000 +0100
@@ -81,10 +81,20 @@
     while (fgets (grep_buff, MAX_RESULT_LEN, grep))
     {
       int i;
-      for (i = 0; grep_buff[i] && grep_buff[i] != '\n' ; i++)
-        ;
+      const char *extension = grep_buff;
+      for (i = 0; grep_buff[i] && grep_buff[i] != '\n' ; i++) {
+	if (grep_buff[i] == '.')
+	  extension = &grep_buff[i];
+      }
       grep_buff[i] = '\0';

+      /* Definitly not in these: */
+      if (strcmp(extension,".dll") == 0 ||
+	  strcmp(extension,".lib") == 0 ||
+	  strcmp(extension,".so")  == 0 ||
+	  strcmp(extension,".o")   == 0)
+	continue;
+
       if (VERBOSE)
         puts (grep_buff);






More information about the wine-patches mailing list