diff options
author | Kevin E Martin <kem@kem.org> | 2005-12-09 15:28:41 +0000 |
---|---|---|
committer | Kevin E Martin <kem@kem.org> | 2005-12-09 15:28:41 +0000 |
commit | af0164c2ded2dcc95b72ca3b9bfbad9b790490f7 (patch) | |
tree | 5e2abbefb097cbb8d5b7797b4ba7de02b342849d | |
parent | 80c3aba8ac4af96c3d9407ecbed2f6c813adbbe1 (diff) |
Better macro to check whether any of malloc(0), realloc(ptr,0) or calloc(0)MODULAR_COPY
return NULL since Xlib expects all three to return a valid pointer.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | xorg-macros.m4 | 9 |
2 files changed, 15 insertions, 1 deletions
@@ -1,3 +1,10 @@ +2005-12-09 Kevin E. Martin <kem-at-freedesktop-dot-org> + + * xorg-macros.m4: + Better macro to check whether any of malloc(0), realloc(ptr,0) or + calloc(0) return NULL since Xlib expects all three to return a + valid pointer. + 2005-12-08 Kevin E. Martin <kem-at-freedesktop-dot-org> * xorg-macros.m4: diff --git a/xorg-macros.m4 b/xorg-macros.m4 index 0284399..e4b8980 100644 --- a/xorg-macros.m4 +++ b/xorg-macros.m4 @@ -241,8 +241,15 @@ AC_MSG_CHECKING([whether malloc(0) returns NULL]) if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then AC_RUN_IFELSE([ char *malloc(); +char *realloc(); +char *calloc(); main() { - exit(malloc(0) == NULL ? 0 : 1); + char *m0, *r0, *c0, *p; + m0 = malloc(0); + p = malloc(10); + r0 = realloc(p,0); + c0 = calloc(0); + exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1); }], [MALLOC_ZERO_RETURNS_NULL=yes], [MALLOC_ZERO_RETURNS_NULL=no]) |