carbon2-commit: Don't use PATH_MAX_EXTERNAL, non-Win32.

Aidan Kehoe aidan-guest at alioth.debian.org
Wed Jan 9 05:37:53 EST 2008


changeset:   4401:1a14c304cb8ead170dfb5edbbbf341724629f2d1
user:        Aidan Kehoe <kehoea at parhasard.net>
date:        Wed Jan 09 00:28:17 2008 +0100
files:       src/ChangeLog src/dumper.c src/text.h
description:
Don't use PATH_MAX_EXTERNAL, non-Win32.

2008-01-08  Aidan Kehoe  <kehoea at 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.


diff -r 9aa16aa434b6c7378354c60985dc2218ceb60db0 -r 1a14c304cb8ead170dfb5edbbbf341724629f2d1 src/ChangeLog
--- 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  Jerry James  <james at xemacs.o
+2008-01-08  Aidan Kehoe  <kehoea at 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 at xemacs.org>
 
 	* config.h.in (INLINE_HEADER): adapt to C99 inline semantics.
diff -r 9aa16aa434b6c7378354c60985dc2218ceb60db0 -r 1a14c304cb8ead170dfb5edbbbf341724629f2d1 src/dumper.c
--- 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 @@ pdump_file_try (Wexttext *exe_path)
   return 0;
 }
 
+#define DUMP_SLACK 100 /* Enough to include dump ID, version name, .DMP */
+
 int
 pdump_load (const Wexttext *argv0)
 {
@@ -2637,7 +2639,6 @@ pdump_load (const Wexttext *argv0)
   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 @@ pdump_load (const Wexttext *argv0)
       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 @@ pdump_load (const Wexttext *argv0)
     {
       /* 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;
diff -r 9aa16aa434b6c7378354c60985dc2218ceb60db0 -r 1a14c304cb8ead170dfb5edbbbf341724629f2d1 src/text.h
--- 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 @@ int wcsncmp_ascii (const wchar_t *s1, co
 /* 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 @@ int XCDECL wext_retry_open (const Wextte
 #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




More information about the XEmacs-Patches mailing list