emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117834: Fix the MS-Windows build broken by SAFE_ALL


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r117834: Fix the MS-Windows build broken by SAFE_ALLOCA changes.
Date: Sun, 07 Sep 2014 17:05:21 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117834
revision-id: address@hidden
parent: address@hidden
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sun 2014-09-07 20:04:19 +0300
message:
  Fix the MS-Windows build broken by SAFE_ALLOCA changes.
  
   src/callproc.c (child_setup) [WINDOWSNT]: Don't call exec_failed if
   'alloca' gets passed arguments larger than MAX_ALLOCA.
   src/font.c (MAX): Define if not defined elsewhere.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/callproc.c                 callproc.c-20091113204419-o5vbwnq5f7feedwu-248
  src/font.c                     font.c-20091113204419-o5vbwnq5f7feedwu-8540
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-09-07 13:27:33 +0000
+++ b/src/ChangeLog     2014-09-07 17:04:19 +0000
@@ -1,3 +1,10 @@
+2014-09-07  Eli Zaretskii  <address@hidden>
+
+       * callproc.c (child_setup) [WINDOWSNT]: Don't call exec_failed if
+       'alloca' gets passed arguments larger than MAX_ALLOCA.
+
+       * font.c (MAX): Define if not defined elsewhere.
+
 2014-09-07  Paul Eggert  <address@hidden>
 
        * keyboard.c (read_decoded_event_from_main_queue): Reinstitute alloca

=== modified file 'src/callproc.c'
--- a/src/callproc.c    2014-09-07 07:04:01 +0000
+++ b/src/callproc.c    2014-09-07 17:04:19 +0000
@@ -1213,8 +1213,13 @@
        on that.  */
     pwd_var = xmalloc (i + 5);
 #else
+    /* WINDOWSNT doesn't define exec_failed, and doesn't need this
+       test, since a directory name cannot be longer than 260
+       characters, i.e. 260 * 4 = 1040 UTF-8 bytes.  */
+#ifndef WINDOWSNT
     if (MAX_ALLOCA - 5 < i)
       exec_failed (new_argv[0], ENOMEM);
+#endif
     pwd_var = alloca (i + 5);
 #endif
     temp = pwd_var + 4;
@@ -1281,8 +1286,10 @@
       }
 
     /* new_length + 2 to include PWD and terminating 0.  */
+#ifndef WINDOWSNT
     if (MAX_ALLOCA / sizeof *env - 2 < new_length)
       exec_failed (new_argv[0], ENOMEM);
+#endif
     env = new_env = alloca ((new_length + 2) * sizeof *env);
     /* If we have a PWD envvar, pass one down,
        but with corrected value.  */
@@ -1291,9 +1298,14 @@
 
     if (STRINGP (display))
       {
+       char *vdata;
+
+       /* WINDOWSNT doesn't have $DISPLAY.  */
+#ifndef WINDOWSNT
        if (MAX_ALLOCA - sizeof "DISPLAY=" < SBYTES (display))
          exec_failed (new_argv[0], ENOMEM);
-       char *vdata = alloca (sizeof "DISPLAY=" + SBYTES (display));
+#endif
+       vdata = alloca (sizeof "DISPLAY=" + SBYTES (display));
        strcpy (vdata, "DISPLAY=");
        strcat (vdata, SSDATA (display));
        new_env = add_env (env, new_env, vdata);

=== modified file 'src/font.c'
--- a/src/font.c        2014-09-07 07:04:01 +0000
+++ b/src/font.c        2014-09-07 17:04:19 +0000
@@ -41,6 +41,10 @@
 #include TERM_HEADER
 #endif /* HAVE_WINDOW_SYSTEM */
 
+#ifndef MAX
+# define MAX(a, b) ((a) > (b) ? (a) : (b))
+#endif
+
 Lisp_Object Qopentype;
 
 /* Important character set strings.  */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]