changeset 4388:1a14c304cb8e

Don't use PATH_MAX_EXTERNAL, non-Win32. 2008-01-08 Aidan Kehoe <kehoea@parhasard.net> * text.h (MAX_XETCHAR_SIZE): Remove, eliminating a redefinition warning on Win32. * dumper.c (pdump_load): Don't use PATH_MAX_EXTERNAL, instead allocate enough for the path + DUMP_SLACK (space for .dmp and version information), already used on Win32 and #defined to be 100.
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 09 Jan 2008 00:28:17 +0100
parents 9aa16aa434b6
children 4c5cd87620e4
files src/ChangeLog src/dumper.c src/text.h
diffstat 3 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Tue Jan 08 12:47:42 2008 -0700
+++ b/src/ChangeLog	Wed Jan 09 00:28:17 2008 +0100
@@ -1,3 +1,12 @@
+2008-01-08  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* text.h (MAX_XETCHAR_SIZE): Remove, eliminating a redefinition
+	warning on Win32.
+	* dumper.c (pdump_load): 
+	Don't use PATH_MAX_EXTERNAL, instead allocate enough for the path
+	+ DUMP_SLACK (space for .dmp and version information), already
+	used on Win32 and #defined to be 100.
+
 2008-01-08  Jerry James  <james@xemacs.org>
 
 	* config.h.in (INLINE_HEADER): adapt to C99 inline semantics.
--- a/src/dumper.c	Tue Jan 08 12:47:42 2008 -0700
+++ b/src/dumper.c	Wed Jan 09 00:28:17 2008 +0100
@@ -2630,6 +2630,8 @@
   return 0;
 }
 
+#define DUMP_SLACK 100 /* Enough to include dump ID, version name, .DMP */
+
 int
 pdump_load (const Wexttext *argv0)
 {
@@ -2637,7 +2639,6 @@
   Wexttext *exe_path = NULL;
   int bufsize = 4096;
   int cchpathsize;
-#define DUMP_SLACK 100 /* Enough to include dump ID, version name, .DMP */
 
   /* Copied from mswindows_get_module_file_name ().  Not clear if it's
      kosher to malloc() yet. */
@@ -2659,7 +2660,7 @@
       wext_strcpy (exe_path, wexe);
     }
 #else /* !WIN32_NATIVE */
-  Wexttext exe_path[PATH_MAX_EXTERNAL];
+  Wexttext *exe_path;
   Wexttext *w;
   const Wexttext *dir, *p;
 
@@ -2694,13 +2695,17 @@
     {
       /* invocation-name includes a directory component -- presumably it
 	 is relative to cwd, not $PATH. */
+      exe_path = alloca_array (Wexttext, 1 + wext_strlen (dir) + DUMP_SLACK);
       wext_strcpy (exe_path, dir);
     }
   else
     {
       const Wexttext *path = wext_getenv ("PATH"); /* not egetenv --
-						     not yet init. */
+                                                      not yet init. */
       const Wexttext *name = p;
+      exe_path = alloca_array (Wexttext,
+			       1 + DUMP_SLACK + max (wext_strlen (name),
+                                                     wext_strlen (path)));
       for (;;)
 	{
 	  p = path;
--- a/src/text.h	Tue Jan 08 12:47:42 2008 -0700
+++ b/src/text.h	Wed Jan 09 00:28:17 2008 +0100
@@ -2988,7 +2988,6 @@
 /* Extra indirection needed in case of manifest constant as arg */
 #define WEXTSTRING_1(arg) L##arg
 #define WEXTSTRING(arg) WEXTSTRING_1(arg)
-#define MAX_XETCHAR_SIZE sizeof (WCHAR)
 #define wext_strlen wcslen
 #define wext_strcmp wcscmp
 #define wext_strncmp wcsncmp
@@ -3014,7 +3013,6 @@
 #else
 #define WEXTTEXT_ZTERM_SIZE sizeof (char)
 #define WEXTSTRING(arg) arg
-#define MAX_XETCHAR_SIZE sizeof (char)
 #define wext_strlen strlen
 #define wext_strcmp strcmp
 #define wext_strncmp strncmp