comparison src/alloc.c @ 1333:1b0339b048ce

[xemacs-hg @ 2003-03-02 09:38:37 by ben] To: xemacs-patches@xemacs.org PROBLEMS: Include nt/PROBLEMS and update. Add note about incremental linking badness. cmdloop.el, custom.el, dumped-lisp.el, files.el, keydefs.el, keymap.el, lisp-mode.el, make-docfile.el, replace.el, simple.el, subr.el, view-less.el, wid-edit.el: Lots of syncing with FSF 21.2. Use if-fboundp in wid-edit.el. New file newcomment.el from FSF. internals/internals.texi: Fix typo. (Build-Time Dependencies): New node. PROBLEMS: Delete. config.inc.samp, xemacs.mak: Eliminate HAVE_VC6, use SUPPORT_EDIT_AND_CONTINUE in its place. No incremental linking unless SUPPORT_EDIT_AND_CONTINUE, since it can cause nasty crashes in pdump. Put warnings about this in config.inc.samp. Report the full compile flags used for src and lib-src in the Installation output. alloc.c, lisp.h, ralloc.c, regex.c: Use ALLOCA() in regex.c to avoid excessive stack allocation. Also fix subtle problem with REL_ALLOC() -- any call to malloc() (direct or indirect) may relocate rel-alloced data, causing buffer text to shift. After any such call, regex must update all its pointers to such data. Add a system, when ERROR_CHECK_MALLOC, whereby regex.c indicates all the places it is prepared to handle malloc()/realloc()/free(), and any calls anywhere in XEmacs outside of this will trigger an abort. alloc.c, dialog-msw.c, eval.c, event-stream.c, general-slots.h, insdel.c, lisp.h, menubar-msw.c, menubar-x.c: Change *run_hook*_trapping_problems to take a warning class, not a string. Factor out code to issue warnings, add flag to call_trapping_problems() to postpone warning issue, and make *run_hook*_trapping_problems issue their own warnings tailored to the hook, postponed in the case of safe_run_hook_trapping_problems() so that the appropriate message can be issued about resetting to nil only when not `quit'. Make record_unwind_protect_restoring_int() non-static. dumper.c: Issue notes about incremental linking problems under Windows. fileio.c: Mule-ize encrypt/decrypt-string code. text.h: Spacing changes.
author ben
date Sun, 02 Mar 2003 09:38:54 +0000
parents b531bf8658e9
children 01c57eb70ae9
comparison
equal deleted inserted replaced
1332:6aa23bb3da6b 1333:1b0339b048ce
313 313
314 /* like malloc and realloc but check for no memory left. */ 314 /* like malloc and realloc but check for no memory left. */
315 315
316 #ifdef ERROR_CHECK_MALLOC 316 #ifdef ERROR_CHECK_MALLOC
317 static int in_malloc; 317 static int in_malloc;
318 extern int regex_malloc_disallowed;
318 #endif 319 #endif
319 320
320 #undef xmalloc 321 #undef xmalloc
321 void * 322 void *
322 xmalloc (Bytecount size) 323 xmalloc (Bytecount size)
323 { 324 {
324 void *val; 325 void *val;
325 #ifdef ERROR_CHECK_MALLOC 326 #ifdef ERROR_CHECK_MALLOC
326 assert (!in_malloc); 327 assert (!in_malloc);
328 assert (!regex_malloc_disallowed);
327 in_malloc = 1; 329 in_malloc = 1;
328 #endif 330 #endif
329 val = malloc (size); 331 val = malloc (size);
330 #ifdef ERROR_CHECK_MALLOC 332 #ifdef ERROR_CHECK_MALLOC
331 in_malloc = 0; 333 in_malloc = 0;
340 xcalloc (Elemcount nelem, Bytecount elsize) 342 xcalloc (Elemcount nelem, Bytecount elsize)
341 { 343 {
342 void *val; 344 void *val;
343 #ifdef ERROR_CHECK_MALLOC 345 #ifdef ERROR_CHECK_MALLOC
344 assert (!in_malloc); 346 assert (!in_malloc);
347 assert (!regex_malloc_disallowed);
345 in_malloc = 1; 348 in_malloc = 1;
346 #endif 349 #endif
347 val= calloc (nelem, elsize); 350 val= calloc (nelem, elsize);
348 #ifdef ERROR_CHECK_MALLOC 351 #ifdef ERROR_CHECK_MALLOC
349 in_malloc = 0; 352 in_malloc = 0;
364 void * 367 void *
365 xrealloc (void *block, Bytecount size) 368 xrealloc (void *block, Bytecount size)
366 { 369 {
367 #ifdef ERROR_CHECK_MALLOC 370 #ifdef ERROR_CHECK_MALLOC
368 assert (!in_malloc); 371 assert (!in_malloc);
372 assert (!regex_malloc_disallowed);
369 in_malloc = 1; 373 in_malloc = 1;
370 #endif 374 #endif
371 block = realloc (block, size); 375 block = realloc (block, size);
372 #ifdef ERROR_CHECK_MALLOC 376 #ifdef ERROR_CHECK_MALLOC
373 in_malloc = 0; 377 in_malloc = 0;
390 error until much later on for many system mallocs, such as 394 error until much later on for many system mallocs, such as
391 the one that comes with Solaris 2.3. FMH!! */ 395 the one that comes with Solaris 2.3. FMH!! */
392 assert (block != (void *) 0xDEADBEEF); 396 assert (block != (void *) 0xDEADBEEF);
393 assert (block); 397 assert (block);
394 assert (!in_malloc); 398 assert (!in_malloc);
399 assert (!regex_malloc_disallowed);
395 in_malloc = 1; 400 in_malloc = 1;
396 #endif /* ERROR_CHECK_MALLOC */ 401 #endif /* ERROR_CHECK_MALLOC */
397 free (block); 402 free (block);
398 #ifdef ERROR_CHECK_MALLOC 403 #ifdef ERROR_CHECK_MALLOC
399 in_malloc = 0; 404 in_malloc = 0;
4446 need_to_signal_post_gc = 0; 4451 need_to_signal_post_gc = 0;
4447 recompute_funcall_allocation_flag (); 4452 recompute_funcall_allocation_flag ();
4448 4453
4449 if (!gc_hooks_inhibited) 4454 if (!gc_hooks_inhibited)
4450 run_hook_trapping_problems 4455 run_hook_trapping_problems
4451 ("Error in pre-gc-hook", Qpre_gc_hook, 4456 (Qgarbage_collecting, Qpre_gc_hook,
4452 INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); 4457 INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION);
4453 4458
4454 /* Now show the GC cursor/message. */ 4459 /* Now show the GC cursor/message. */
4455 if (!noninteractive) 4460 if (!noninteractive)
4456 { 4461 {