* src/unexmacosx.c: Add comment about include order.
authorJan Djärv <jan.h.d@swipnet.se>
Thu, 20 Jan 2011 06:43:04 +0000 (07:43 +0100)
committerJan Djärv <jan.h.d@swipnet.se>
Thu, 20 Jan 2011 06:43:04 +0000 (07:43 +0100)
src/ChangeLog
src/unexmacosx.c

index 8c6e8e8..44fbcc4 100644 (file)
@@ -1,3 +1,7 @@
+2011-01-20  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * unexmacosx.c: Add comment about include order.
+
 2011-01-20  Glenn Morris  <rgm@gnu.org>
 
        * minibuf.c (syms_of_minibuf) <read-expression-history>:
index d3cf74e..28e0497 100644 (file)
@@ -86,15 +86,20 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    be changed accordingly.
 */
 
-#include <stdio.h>
+/* config.h #define:s malloc/realloc/free and then includes stdlib.h.
+   We want the undefined versions, but if config.h includes stdlib.h
+   with the #define:s in place, the prototypes will be wrong and we get
+   warnings.  To prevent that, include stdlib.h before config.h.  */
+
 #include <stdlib.h>
-#include <fcntl.h>
-#include <stdarg.h>
-#include <sys/types.h>
 #include <config.h>
 #undef malloc
 #undef realloc
 #undef free
+#include <stdio.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <sys/types.h>
 #include <unistd.h>
 #include <mach/mach.h>
 #include <mach-o/loader.h>