chiark
/
gitweb
/
~mdw
/
disorder
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
server/*.c: Don't try reading per-user configuration.
[disorder]
/
lib
/
mem.c
diff --git
a/lib/mem.c
b/lib/mem.c
index 89570ab6f413000236c3299d8f5dcf52f5f77e5c..22b7228c1f9e05342910f0838fe2c4f55399b7d4 100644
(file)
--- a/
lib/mem.c
+++ b/
lib/mem.c
@@
-72,7
+72,11
@@
void mem_init(void) {
do_free = free;
} else {
GC_init();
do_free = free;
} else {
GC_init();
+#ifdef HAVE_GC_GET_ALL_INTERIOR_POINTERS
+ assert(GC_get_all_interior_pointers());
+#else
assert(GC_all_interior_pointers);
assert(GC_all_interior_pointers);
+#endif
}
#endif
}
}
#endif
}
@@
-88,7
+92,7
@@
void *xmalloc(size_t n) {
void *ptr;
if(!(ptr = do_malloc(n)) && n)
void *ptr;
if(!(ptr = do_malloc(n)) && n)
- fatal(errno, "error allocating memory");
+
disorder_
fatal(errno, "error allocating memory");
return ptr;
}
return ptr;
}
@@
-102,7
+106,7
@@
void *xmalloc(size_t n) {
*/
void *xrealloc(void *ptr, size_t n) {
if(!(ptr = do_realloc(ptr, n)) && n)
*/
void *xrealloc(void *ptr, size_t n) {
if(!(ptr = do_realloc(ptr, n)) && n)
- fatal(errno, "error allocating memory");
+
disorder_
fatal(errno, "error allocating memory");
return ptr;
}
return ptr;
}
@@
-116,7
+120,7
@@
void *xrealloc(void *ptr, size_t n) {
*/
void *xcalloc(size_t count, size_t size) {
if(count > SIZE_MAX / size)
*/
void *xcalloc(size_t count, size_t size) {
if(count > SIZE_MAX / size)
- fatal(0, "excessively large calloc");
+
disorder_
fatal(0, "excessively large calloc");
return xmalloc(count * size);
}
return xmalloc(count * size);
}
@@
-132,7
+136,7
@@
void *xmalloc_noptr(size_t n) {
void *ptr;
if(!(ptr = do_malloc_atomic(n)) && n)
void *ptr;
if(!(ptr = do_malloc_atomic(n)) && n)
- fatal(errno, "error allocating memory");
+
disorder_
fatal(errno, "error allocating memory");
return ptr;
}
return ptr;
}
@@
-146,7
+150,7
@@
void *xmalloc_noptr(size_t n) {
*/
void *xcalloc_noptr(size_t count, size_t size) {
if(count > SIZE_MAX / size)
*/
void *xcalloc_noptr(size_t count, size_t size) {
if(count > SIZE_MAX / size)
- fatal(0, "excessively large calloc");
+
disorder_
fatal(0, "excessively large calloc");
return xmalloc_noptr(count * size);
}
return xmalloc_noptr(count * size);
}
@@
-163,7
+167,7
@@
void *xrealloc_noptr(void *ptr, size_t n) {
if(ptr == 0)
return xmalloc_noptr(n);
if(!(ptr = do_realloc(ptr, n)) && n)
if(ptr == 0)
return xmalloc_noptr(n);
if(!(ptr = do_realloc(ptr, n)) && n)
- fatal(errno, "error allocating memory");
+
disorder_
fatal(errno, "error allocating memory");
return ptr;
}
return ptr;
}
@@
-177,7
+181,7
@@
char *xstrdup(const char *s) {
char *t;
if(!(t = do_malloc_atomic(strlen(s) + 1)))
char *t;
if(!(t = do_malloc_atomic(strlen(s) + 1)))
- fatal(errno, "error allocating memory");
+
disorder_
fatal(errno, "error allocating memory");
return strcpy(t, s);
}
return strcpy(t, s);
}
@@
-193,7
+197,7
@@
char *xstrndup(const char *s, size_t n) {
char *t;
if(!(t = do_malloc_atomic(n + 1)))
char *t;
if(!(t = do_malloc_atomic(n + 1)))
- fatal(errno, "error allocating memory");
+
disorder_
fatal(errno, "error allocating memory");
memcpy(t, s, n);
t[n] = 0;
return t;
memcpy(t, s, n);
t[n] = 0;
return t;