diff options
| author | Dmitry Antipov | 2012-06-28 11:50:27 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-06-28 11:50:27 +0400 |
| commit | a54e2c050b9cf161cbccc3dd4628f8ef6b64f519 (patch) | |
| tree | 447eb906b698dee37a17779ea15f448079b8f54b /src/alloc.c | |
| parent | 1c9bd87017e4b5f7f56e734277ff6e0a0ebb51d6 (diff) | |
| download | emacs-a54e2c050b9cf161cbccc3dd4628f8ef6b64f519.tar.gz emacs-a54e2c050b9cf161cbccc3dd4628f8ef6b64f519.zip | |
Generalize run-time debugging checks.
* configure.in (ENABLE_CHECKING): Update comment.
* src/dispextern.h (XASSERTS): Remove.
* src/fontset.c (xassert): Remove.
Convert from xassert to eassert.
* src/alloc.c: Convert from xassert to eassert.
* src/bidi.c: Likewise.
* src/dispnew.c: Likewise.
* src/fns.c: Likewise.
* src/fringe.c: Likewise.
* src/ftfont.c: Likewise.
* src/gtkutil.c: Likewise.
* src/image.c: Likewise.
* src/keyboard.c: Likewise.
* src/menu.c: Likewise.
* src/process.c: Likewise.
* src/scroll.c: Likewise.
* src/sound.c: Likewise.
* src/term.c: Likewise.
* src/w32console.c: Likewise.
* src/w32fns.c: Likewise.
* src/w32term.c: Likewise.
* src/window.c: Likewise.
* src/xdisp.c: Likewise.
* src/xfaces.c: Likewise.
* src/xfns.c: Likewise.
* src/xselect.c: Likewise.
* src/xterm.c: Likewise.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/alloc.c b/src/alloc.c index 17212f8d37d..2570364e6c1 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -787,7 +787,7 @@ verify (INT_MAX <= PTRDIFF_MAX); | |||
| 787 | void * | 787 | void * |
| 788 | xnmalloc (ptrdiff_t nitems, ptrdiff_t item_size) | 788 | xnmalloc (ptrdiff_t nitems, ptrdiff_t item_size) |
| 789 | { | 789 | { |
| 790 | xassert (0 <= nitems && 0 < item_size); | 790 | eassert (0 <= nitems && 0 < item_size); |
| 791 | if (min (PTRDIFF_MAX, SIZE_MAX) / item_size < nitems) | 791 | if (min (PTRDIFF_MAX, SIZE_MAX) / item_size < nitems) |
| 792 | memory_full (SIZE_MAX); | 792 | memory_full (SIZE_MAX); |
| 793 | return xmalloc (nitems * item_size); | 793 | return xmalloc (nitems * item_size); |
| @@ -800,7 +800,7 @@ xnmalloc (ptrdiff_t nitems, ptrdiff_t item_size) | |||
| 800 | void * | 800 | void * |
| 801 | xnrealloc (void *pa, ptrdiff_t nitems, ptrdiff_t item_size) | 801 | xnrealloc (void *pa, ptrdiff_t nitems, ptrdiff_t item_size) |
| 802 | { | 802 | { |
| 803 | xassert (0 <= nitems && 0 < item_size); | 803 | eassert (0 <= nitems && 0 < item_size); |
| 804 | if (min (PTRDIFF_MAX, SIZE_MAX) / item_size < nitems) | 804 | if (min (PTRDIFF_MAX, SIZE_MAX) / item_size < nitems) |
| 805 | memory_full (SIZE_MAX); | 805 | memory_full (SIZE_MAX); |
| 806 | return xrealloc (pa, nitems * item_size); | 806 | return xrealloc (pa, nitems * item_size); |
| @@ -850,7 +850,7 @@ xpalloc (void *pa, ptrdiff_t *nitems, ptrdiff_t nitems_incr_min, | |||
| 850 | ptrdiff_t nitems_incr_max = n_max - n; | 850 | ptrdiff_t nitems_incr_max = n_max - n; |
| 851 | ptrdiff_t incr = max (nitems_incr_min, min (incr_estimate, nitems_incr_max)); | 851 | ptrdiff_t incr = max (nitems_incr_min, min (incr_estimate, nitems_incr_max)); |
| 852 | 852 | ||
| 853 | xassert (0 < item_size && 0 < nitems_incr_min && 0 <= n && -1 <= nitems_max); | 853 | eassert (0 < item_size && 0 < nitems_incr_min && 0 <= n && -1 <= nitems_max); |
| 854 | if (! pa) | 854 | if (! pa) |
| 855 | *nitems = 0; | 855 | *nitems = 0; |
| 856 | if (nitems_incr_max < incr) | 856 | if (nitems_incr_max < incr) |
| @@ -2220,7 +2220,7 @@ compact_small_strings (void) | |||
| 2220 | for (b = oldest_sblock; b; b = b->next) | 2220 | for (b = oldest_sblock; b; b = b->next) |
| 2221 | { | 2221 | { |
| 2222 | end = b->next_free; | 2222 | end = b->next_free; |
| 2223 | xassert ((char *) end <= (char *) b + SBLOCK_SIZE); | 2223 | eassert ((char *) end <= (char *) b + SBLOCK_SIZE); |
| 2224 | 2224 | ||
| 2225 | for (from = &b->first_data; from < end; from = from_end) | 2225 | for (from = &b->first_data; from < end; from = from_end) |
| 2226 | { | 2226 | { |
| @@ -2271,7 +2271,7 @@ compact_small_strings (void) | |||
| 2271 | /* Copy, and update the string's `data' pointer. */ | 2271 | /* Copy, and update the string's `data' pointer. */ |
| 2272 | if (from != to) | 2272 | if (from != to) |
| 2273 | { | 2273 | { |
| 2274 | xassert (tb != b || to < from); | 2274 | eassert (tb != b || to < from); |
| 2275 | memmove (to, from, nbytes + GC_STRING_EXTRA); | 2275 | memmove (to, from, nbytes + GC_STRING_EXTRA); |
| 2276 | to->string->data = SDATA_DATA (to); | 2276 | to->string->data = SDATA_DATA (to); |
| 2277 | } | 2277 | } |