comparison src/ralloc.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 a703d313962d
children 6fcd90c626a7
comparison
equal deleted inserted replaced
1332:6aa23bb3da6b 1333:1b0339b048ce
62 62
63 #include <string.h> 63 #include <string.h>
64 void refill_memory_reserve (void); 64 void refill_memory_reserve (void);
65 65
66 #else /* Not emacs. */ 66 #else /* Not emacs. */
67
68 #define REGEX_MALLOC_CHECK()
67 69
68 #include <stddef.h> 70 #include <stddef.h>
69 71
70 typedef void *POINTER; 72 typedef void *POINTER;
71 73
941 POINTER 943 POINTER
942 r_alloc (POINTER *ptr, size_t size) 944 r_alloc (POINTER *ptr, size_t size)
943 { 945 {
944 bloc_ptr new_bloc; 946 bloc_ptr new_bloc;
945 947
948 REGEX_MALLOC_CHECK ();
949
946 if (! r_alloc_initialized) 950 if (! r_alloc_initialized)
947 init_ralloc (); 951 init_ralloc ();
948 952
949 new_bloc = get_bloc (size); 953 new_bloc = get_bloc (size);
950 if (new_bloc) 954 if (new_bloc)
964 void r_alloc_free (POINTER *ptr); 968 void r_alloc_free (POINTER *ptr);
965 void 969 void
966 r_alloc_free (POINTER *ptr) 970 r_alloc_free (POINTER *ptr)
967 { 971 {
968 register bloc_ptr dead_bloc; 972 register bloc_ptr dead_bloc;
973
974 REGEX_MALLOC_CHECK ();
969 975
970 if (! r_alloc_initialized) 976 if (! r_alloc_initialized)
971 init_ralloc (); 977 init_ralloc ();
972 978
973 dead_bloc = find_bloc (ptr); 979 dead_bloc = find_bloc (ptr);
999 POINTER r_re_alloc (POINTER *ptr, size_t size); 1005 POINTER r_re_alloc (POINTER *ptr, size_t size);
1000 POINTER 1006 POINTER
1001 r_re_alloc (POINTER *ptr, size_t size) 1007 r_re_alloc (POINTER *ptr, size_t size)
1002 { 1008 {
1003 register bloc_ptr bloc; 1009 register bloc_ptr bloc;
1010
1011 REGEX_MALLOC_CHECK ();
1004 1012
1005 if (! r_alloc_initialized) 1013 if (! r_alloc_initialized)
1006 init_ralloc (); 1014 init_ralloc ();
1007 1015
1008 if (!*ptr) 1016 if (!*ptr)
1851 POINTER r_alloc (POINTER *ptr, size_t size); 1859 POINTER r_alloc (POINTER *ptr, size_t size);
1852 POINTER 1860 POINTER
1853 r_alloc (POINTER *ptr, size_t size) 1861 r_alloc (POINTER *ptr, size_t size)
1854 { 1862 {
1855 MMAP_HANDLE mh; 1863 MMAP_HANDLE mh;
1864
1865 REGEX_MALLOC_CHECK ();
1856 1866
1857 switch(r_alloc_initialized) 1867 switch(r_alloc_initialized)
1858 { 1868 {
1859 case 0: 1869 case 0:
1860 abort(); 1870 abort();
1894 1904
1895 void r_alloc_free (POINTER *ptr); 1905 void r_alloc_free (POINTER *ptr);
1896 void 1906 void
1897 r_alloc_free (POINTER *ptr) 1907 r_alloc_free (POINTER *ptr)
1898 { 1908 {
1909 REGEX_MALLOC_CHECK ();
1910
1899 switch( r_alloc_initialized) { 1911 switch( r_alloc_initialized) {
1900 case 0: 1912 case 0:
1901 abort(); 1913 abort();
1902 1914
1903 case 1: 1915 case 1:
1936 1948
1937 POINTER r_re_alloc (POINTER *ptr, size_t sz); 1949 POINTER r_re_alloc (POINTER *ptr, size_t sz);
1938 POINTER 1950 POINTER
1939 r_re_alloc (POINTER *ptr, size_t sz) 1951 r_re_alloc (POINTER *ptr, size_t sz)
1940 { 1952 {
1953 REGEX_MALLOC_CHECK ();
1954
1941 if (r_alloc_initialized == 0) 1955 if (r_alloc_initialized == 0)
1942 { 1956 {
1943 abort (); 1957 abort ();
1944 return 0; /* suppress compiler warning */ 1958 return 0; /* suppress compiler warning */
1945 } 1959 }