diff options
| author | Paul Eggert | 2012-09-04 10:34:54 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-09-04 10:34:54 -0700 |
| commit | 1088b9226e7dac7314dab52ef0696a5f540900cd (patch) | |
| tree | bfae7d26f4b411f5c6a0ef33cfcd0c526619ee56 /src/ralloc.c | |
| parent | 30934d334e8a67c8992d910428758d5b93e0f04f (diff) | |
| download | emacs-1088b9226e7dac7314dab52ef0696a5f540900cd.tar.gz emacs-1088b9226e7dac7314dab52ef0696a5f540900cd.zip | |
Simplify redefinition of 'abort' (Bug#12316).
Do not try to redefine the 'abort' function. Instead, redo
the code so that it calls 'emacs_abort' rather than 'abort'.
This removes the need for the NO_ABORT configure-time macro
and makes it easier to change the abort code to do a backtrace.
* configure.ac (NO_ABRT): Remove.
* admin/CPP-DEFINES (NO_ABORT): Remove.
* nt/inc/ms-w32.h (w32_abort) [HAVE_NTGUI]: Remove.
* src/.gdbinit: Just stop at emacs_abort, not at w32_abort or abort.
* src/emacs.c (abort) [!DOS_NT && !NO_ABORT]:
Remove; sysdep.c's emacs_abort now takes its place.
* src/lisp.h (emacs_abort): New decl. All calls from Emacs code to
'abort' changed to use 'emacs_abort'.
* src/msdos.c (dos_abort) [defined abort]: Remove; not used.
(abort) [!defined abort]: Rename to ...
(emacs_abort): ... new name.
* src/sysdep.c (emacs_abort) [!HAVE_NTGUI]: New function, taking
the place of the old 'abort' in emacs.c.
* src/w32.c, src/w32fns.c (abort): Do not #undef.
* src/w32.c (emacs_abort): Rename from w32_abort.
Diffstat (limited to 'src/ralloc.c')
| -rw-r--r-- | src/ralloc.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/ralloc.c b/src/ralloc.c index 3877e21d4f6..74834333aa3 100644 --- a/src/ralloc.c +++ b/src/ralloc.c | |||
| @@ -237,7 +237,7 @@ obtain (POINTER address, SIZE size) | |||
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | if (! heap) | 239 | if (! heap) |
| 240 | abort (); | 240 | emacs_abort (); |
| 241 | 241 | ||
| 242 | /* If we can't fit SIZE bytes in that heap, | 242 | /* If we can't fit SIZE bytes in that heap, |
| 243 | try successive later heaps. */ | 243 | try successive later heaps. */ |
| @@ -330,7 +330,7 @@ relinquish (void) | |||
| 330 | /* This heap should have no blocs in it. */ | 330 | /* This heap should have no blocs in it. */ |
| 331 | if (last_heap->first_bloc != NIL_BLOC | 331 | if (last_heap->first_bloc != NIL_BLOC |
| 332 | || last_heap->last_bloc != NIL_BLOC) | 332 | || last_heap->last_bloc != NIL_BLOC) |
| 333 | abort (); | 333 | emacs_abort (); |
| 334 | 334 | ||
| 335 | /* Return the last heap, with its header, to the system. */ | 335 | /* Return the last heap, with its header, to the system. */ |
| 336 | excess = (char *)last_heap->end - (char *)last_heap->start; | 336 | excess = (char *)last_heap->end - (char *)last_heap->start; |
| @@ -355,7 +355,7 @@ relinquish (void) | |||
| 355 | which returns the entire last heap to the system, seems | 355 | which returns the entire last heap to the system, seems |
| 356 | unlikely to trigger this mode of failure. */ | 356 | unlikely to trigger this mode of failure. */ |
| 357 | if (last_heap->end != (*real_morecore) (0)) | 357 | if (last_heap->end != (*real_morecore) (0)) |
| 358 | abort (); | 358 | emacs_abort (); |
| 359 | } | 359 | } |
| 360 | } | 360 | } |
| 361 | } | 361 | } |
| @@ -452,7 +452,7 @@ relocate_blocs (bloc_ptr bloc, heap_ptr heap, POINTER address) | |||
| 452 | 452 | ||
| 453 | /* No need to ever call this if arena is frozen, bug somewhere! */ | 453 | /* No need to ever call this if arena is frozen, bug somewhere! */ |
| 454 | if (r_alloc_freeze_level) | 454 | if (r_alloc_freeze_level) |
| 455 | abort (); | 455 | emacs_abort (); |
| 456 | 456 | ||
| 457 | while (b) | 457 | while (b) |
| 458 | { | 458 | { |
| @@ -576,7 +576,7 @@ resize_bloc (bloc_ptr bloc, SIZE size) | |||
| 576 | 576 | ||
| 577 | /* No need to ever call this if arena is frozen, bug somewhere! */ | 577 | /* No need to ever call this if arena is frozen, bug somewhere! */ |
| 578 | if (r_alloc_freeze_level) | 578 | if (r_alloc_freeze_level) |
| 579 | abort (); | 579 | emacs_abort (); |
| 580 | 580 | ||
| 581 | if (bloc == NIL_BLOC || size == bloc->size) | 581 | if (bloc == NIL_BLOC || size == bloc->size) |
| 582 | return 1; | 582 | return 1; |
| @@ -588,7 +588,7 @@ resize_bloc (bloc_ptr bloc, SIZE size) | |||
| 588 | } | 588 | } |
| 589 | 589 | ||
| 590 | if (heap == NIL_HEAP) | 590 | if (heap == NIL_HEAP) |
| 591 | abort (); | 591 | emacs_abort (); |
| 592 | 592 | ||
| 593 | old_size = bloc->size; | 593 | old_size = bloc->size; |
| 594 | bloc->size = size; | 594 | bloc->size = size; |
| @@ -937,7 +937,7 @@ r_alloc_free (register POINTER *ptr) | |||
| 937 | 937 | ||
| 938 | dead_bloc = find_bloc (ptr); | 938 | dead_bloc = find_bloc (ptr); |
| 939 | if (dead_bloc == NIL_BLOC) | 939 | if (dead_bloc == NIL_BLOC) |
| 940 | abort (); /* Double free? PTR not originally used to allocate? */ | 940 | emacs_abort (); /* Double free? PTR not originally used to allocate? */ |
| 941 | 941 | ||
| 942 | free_bloc (dead_bloc); | 942 | free_bloc (dead_bloc); |
| 943 | *ptr = 0; | 943 | *ptr = 0; |
| @@ -979,7 +979,7 @@ r_re_alloc (POINTER *ptr, SIZE size) | |||
| 979 | 979 | ||
| 980 | bloc = find_bloc (ptr); | 980 | bloc = find_bloc (ptr); |
| 981 | if (bloc == NIL_BLOC) | 981 | if (bloc == NIL_BLOC) |
| 982 | abort (); /* Already freed? PTR not originally used to allocate? */ | 982 | emacs_abort (); /* Already freed? PTR not originally used to allocate? */ |
| 983 | 983 | ||
| 984 | if (size < bloc->size) | 984 | if (size < bloc->size) |
| 985 | { | 985 | { |
| @@ -1152,7 +1152,7 @@ r_alloc_reset_variable (POINTER *old, POINTER *new) | |||
| 1152 | } | 1152 | } |
| 1153 | 1153 | ||
| 1154 | if (bloc == NIL_BLOC || bloc->variable != old) | 1154 | if (bloc == NIL_BLOC || bloc->variable != old) |
| 1155 | abort (); /* Already freed? OLD not originally used to allocate? */ | 1155 | emacs_abort (); /* Already freed? OLD not originally used to allocate? */ |
| 1156 | 1156 | ||
| 1157 | /* Update variable to point to the new location. */ | 1157 | /* Update variable to point to the new location. */ |
| 1158 | bloc->variable = new; | 1158 | bloc->variable = new; |
| @@ -1193,7 +1193,7 @@ r_alloc_init (void) | |||
| 1193 | first_heap->start = first_heap->bloc_start | 1193 | first_heap->start = first_heap->bloc_start |
| 1194 | = virtual_break_value = break_value = (*real_morecore) (0); | 1194 | = virtual_break_value = break_value = (*real_morecore) (0); |
| 1195 | if (break_value == NIL) | 1195 | if (break_value == NIL) |
| 1196 | abort (); | 1196 | emacs_abort (); |
| 1197 | 1197 | ||
| 1198 | extra_bytes = ROUNDUP (50000); | 1198 | extra_bytes = ROUNDUP (50000); |
| 1199 | #endif | 1199 | #endif |