Mercurial > hg > xemacs-beta
comparison src/emodules.c @ 851:e7ee5f8bde58
[xemacs-hg @ 2002-05-23 11:46:08 by ben]
fix for raymond toy's crash, alloca crashes, some recover-session improvements
files.el: Recover-session improvements: Only show session files where some
files can actually be recovered, and show in chronological order.
subr.el, menubar-items.el: As promised to rms, the functionality in
truncate-string-with-continuation-dots has been merged into
truncate-string-to-width. Change callers in menubar-items.el.
select.el: Document some of these funs better. Fix problem where we were
doing own-clipboard twice.
Makefile.in.in: Add alloca.o. Ensure that alloca.s doesn't compile into alloca.o,
but allocax.o (not that it's currently used or anything.)
EmacsFrame.c, abbrev.c, alloc.c, alloca.c, callint.c, callproc.c, config.h.in, device-msw.c, device-x.c, dired.c, doc.c, editfns.c, emacs.c, emodules.c, eval.c, event-Xt.c, event-msw.c, event-stream.c, file-coding.c, fileio.c, filelock.c, fns.c, glyphs-gtk.c, glyphs-msw.c, glyphs-x.c, gui-x.c, input-method-xlib.c, intl-win32.c, lisp.h, lread.c, menubar-gtk.c, menubar-msw.c, menubar.c, mule-wnnfns.c, nt.c, objects-msw.c, process-nt.c, realpath.c, redisplay-gtk.c, redisplay-output.c, redisplay-x.c, redisplay.c, search.c, select-msw.c, sysdep.c, syswindows.h, text.c, text.h, ui-byhand.c: Fix Raymond Toy's crash. Repeat to self: 2^21 - 1 is NOT the
same as (2 << 21) - 1.
Fix crashes due to excessive alloca(). replace alloca() with
ALLOCA(), which calls the C alloca() [which uses xmalloc()]
when the size is too big. Insert in various places calls to
try to flush the C alloca() stored info if there is any.
Add MALLOC_OR_ALLOCA(), for places that expect to be alloca()ing
large blocks. This xmalloc()s when too large and records an
unwind-protect to free -- relying on the caller to unbind_to()
elsewhere in the function. Use it in concat().
Use MALLOC instead of ALLOCA in select-msw.c.
xemacs.mak: Add alloca.o.
author | ben |
---|---|
date | Thu, 23 May 2002 11:46:46 +0000 |
parents | 14089a93af0a |
children | 2b6fa2618f76 |
comparison
equal
deleted
inserted
replaced
850:f915ad7befaf | 851:e7ee5f8bde58 |
---|---|
331 if ((module == (const char *)0) || (module[0] == '\0')) | 331 if ((module == (const char *)0) || (module[0] == '\0')) |
332 invalid_argument ("Empty module name", Qunbound); | 332 invalid_argument ("Empty module name", Qunbound); |
333 | 333 |
334 /* This is to get around the fact that build_string() is not declared | 334 /* This is to get around the fact that build_string() is not declared |
335 as taking a const char * as an argument. I HATE compiler warnings. */ | 335 as taking a const char * as an argument. I HATE compiler warnings. */ |
336 tmod = (char *)alloca (strlen (module) + 1); | 336 tmod = (char *)ALLOCA (strlen (module) + 1); |
337 strcpy (tmod, module); | 337 strcpy (tmod, module); |
338 | 338 |
339 GCPRO2(filename, foundname); | 339 GCPRO2(filename, foundname); |
340 filename = build_string (tmod); | 340 filename = build_string (tmod); |
341 fd = locate_file (Vmodule_load_path, filename, Vmodule_extensions, | 341 fd = locate_file (Vmodule_load_path, filename, Vmodule_extensions, |
343 UNGCPRO; | 343 UNGCPRO; |
344 | 344 |
345 if (fd < 0) | 345 if (fd < 0) |
346 signal_error (Qdll_error, "Cannot open dynamic module", filename); | 346 signal_error (Qdll_error, "Cannot open dynamic module", filename); |
347 | 347 |
348 soname = (char *)alloca (XSTRING_LENGTH (foundname) + 1); | 348 soname = (char *)ALLOCA (XSTRING_LENGTH (foundname) + 1); |
349 strcpy (soname, (char *)XSTRING_DATA (foundname)); | 349 strcpy (soname, (char *)XSTRING_DATA (foundname)); |
350 | 350 |
351 dlhandle = dll_open (soname); | 351 dlhandle = dll_open (soname); |
352 if (dlhandle == (dll_handle)0) | 352 if (dlhandle == (dll_handle)0) |
353 { | 353 { |
366 | 366 |
367 f = (const char **)dll_variable (dlhandle, "emodule_name"); | 367 f = (const char **)dll_variable (dlhandle, "emodule_name"); |
368 if ((f == (const char **)0) || (*f == (const char *)0)) | 368 if ((f == (const char **)0) || (*f == (const char *)0)) |
369 signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_name'", Qunbound); | 369 signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_name'", Qunbound); |
370 | 370 |
371 mname = (char *)alloca (strlen (*f) + 1); | 371 mname = (char *)ALLOCA (strlen (*f) + 1); |
372 strcpy (mname, *f); | 372 strcpy (mname, *f); |
373 if (mname[0] == '\0') | 373 if (mname[0] == '\0') |
374 signal_error (Qdll_error, "Invalid dynamic module: Empty value for `emodule_name'", Qunbound); | 374 signal_error (Qdll_error, "Invalid dynamic module: Empty value for `emodule_name'", Qunbound); |
375 | 375 |
376 f = (const char **)dll_variable (dlhandle, "emodule_version"); | 376 f = (const char **)dll_variable (dlhandle, "emodule_version"); |
377 if ((f == (const char **)0) || (*f == (const char *)0)) | 377 if ((f == (const char **)0) || (*f == (const char *)0)) |
378 signal_error (Qdll_error, "Missing symbol `emodule_version': Invalid dynamic module", Qunbound); | 378 signal_error (Qdll_error, "Missing symbol `emodule_version': Invalid dynamic module", Qunbound); |
379 | 379 |
380 mver = (char *)alloca (strlen (*f) + 1); | 380 mver = (char *)ALLOCA (strlen (*f) + 1); |
381 strcpy (mver, *f); | 381 strcpy (mver, *f); |
382 | 382 |
383 f = (const char **)dll_variable (dlhandle, "emodule_title"); | 383 f = (const char **)dll_variable (dlhandle, "emodule_title"); |
384 if ((f == (const char **)0) || (*f == (const char *)0)) | 384 if ((f == (const char **)0) || (*f == (const char *)0)) |
385 signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_title'", Qunbound); | 385 signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_title'", Qunbound); |
386 | 386 |
387 mtitle = (char *)alloca (strlen (*f) + 1); | 387 mtitle = (char *)ALLOCA (strlen (*f) + 1); |
388 strcpy (mtitle, *f); | 388 strcpy (mtitle, *f); |
389 | 389 |
390 symname = (char *)alloca (strlen (mname) + 15); | 390 symname = (char *)ALLOCA (strlen (mname) + 15); |
391 | 391 |
392 strcpy (symname, "modules_of_"); | 392 strcpy (symname, "modules_of_"); |
393 strcat (symname, mname); | 393 strcat (symname, mname); |
394 modload = (void (*)(void))dll_function (dlhandle, symname); | 394 modload = (void (*)(void))dll_function (dlhandle, symname); |
395 /* | 395 /* |