aboutsummaryrefslogtreecommitdiffstats
path: root/lib/allocator.h
diff options
context:
space:
mode:
authorPaul Eggert2011-05-30 09:47:35 -0700
committerPaul Eggert2011-05-30 09:47:35 -0700
commit531b01656f89e093b9fa35959fa41e534b025320 (patch)
tree190b5a279e0e8e0130b6ba070fa217ce1282e2f3 /lib/allocator.h
parentde677ace77fa48962be80b668662a7009498e5d6 (diff)
downloademacs-531b01656f89e093b9fa35959fa41e534b025320.tar.gz
emacs-531b01656f89e093b9fa35959fa41e534b025320.zip
[ChangeLog]
Malloc failure behavior now depends on size of allocation. * lib/allocator.h (struct allocator.die): New size arg. * lib/careadlinkat.c (careadlinkat): Pass size to 'die' function. If the actual problem is an ssize_t limitation, not a size_t or malloc failure, fail with errno == ENAMETOOLONG instead of calling 'die'. [src/ChangeLog] Malloc failure behavior now depends on size of allocation. * alloc.c (buffer_memory_full, memory_full): New arg NBYTES. * lisp.h: Change signatures accordingly. * alloc.c, buffer.c, editfns.c, menu.c, minibuf.c, xterm.c: All callers changed.
Diffstat (limited to 'lib/allocator.h')
-rw-r--r--lib/allocator.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/allocator.h b/lib/allocator.h
index 953117da83f..b8de95c0f50 100644
--- a/lib/allocator.h
+++ b/lib/allocator.h
@@ -45,10 +45,11 @@ struct allocator
45 /* Call FREE to free memory, like 'free'. */ 45 /* Call FREE to free memory, like 'free'. */
46 void (*free) (void *); 46 void (*free) (void *);
47 47
48 /* If nonnull, call DIE if MALLOC or REALLOC fails. DIE should not 48 /* If nonnull, call DIE (SIZE) if MALLOC (SIZE) or REALLOC (...,
49 return. DIE can be used by code that detects memory overflow 49 SIZE) fails. DIE should not return. SIZE should equal SIZE_MAX
50 while calculating sizes to be passed to MALLOC or REALLOC. */ 50 if size_t overflow was detected while calculating sizes to be
51 void (*die) (void); 51 passed to MALLOC or REALLOC. */
52 void (*die) (size_t);
52}; 53};
53 54
54/* An allocator using the stdlib functions and a null DIE function. */ 55/* An allocator using the stdlib functions and a null DIE function. */