aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/emacs.c55
1 files changed, 35 insertions, 20 deletions
diff --git a/src/emacs.c b/src/emacs.c
index 859e1dd9fd3..5721c2c9826 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -545,27 +545,17 @@ argmatch (argv, argc, sstr, lstr, minlen, valptr, skipptr)
545 } 545 }
546} 546}
547 547
548/* ARGSUSED */ 548#ifdef DOUG_LEA_MALLOC
549int
550main (argc, argv, envp)
551 int argc;
552 char **argv;
553 char **envp;
554{
555 char stack_bottom_variable;
556 int skip_args = 0;
557 extern int errno;
558 extern int sys_nerr;
559#ifdef HAVE_SETRLIMIT
560 struct rlimit rlim;
561#endif
562 int no_loadup = 0;
563 549
564#ifdef LINUX_SBRK_BUG 550/* malloc can be invoked even before main (e.g. by the dynamic
565 __sbrk (1); 551 linker), so the dumped malloc state must be restored as early as
566#endif 552 possible using this special hook. */
553
554static void
555malloc_initialize_hook ()
556{
557 extern char **environ;
567 558
568#ifdef DOUG_LEA_MALLOC
569 if (initialized) 559 if (initialized)
570 { 560 {
571 if (!malloc_using_checking) 561 if (!malloc_using_checking)
@@ -575,7 +565,7 @@ main (argc, argv, envp)
575 { 565 {
576 char **p; 566 char **p;
577 567
578 for (p = envp; *p; p++) 568 for (p = environ; *p; p++)
579 if (strncmp (*p, "MALLOC_CHECK_=", 14) == 0) 569 if (strncmp (*p, "MALLOC_CHECK_=", 14) == 0)
580 { 570 {
581 do 571 do
@@ -584,11 +574,36 @@ main (argc, argv, envp)
584 break; 574 break;
585 } 575 }
586 } 576 }
577
587 malloc_set_state (malloc_state_ptr); 578 malloc_set_state (malloc_state_ptr);
588 free (malloc_state_ptr); 579 free (malloc_state_ptr);
589 } 580 }
590 else 581 else
591 malloc_using_checking = getenv ("MALLOC_CHECK_") != NULL; 582 malloc_using_checking = getenv ("MALLOC_CHECK_") != NULL;
583}
584
585void (*__malloc_initialize_hook) () = malloc_initialize_hook;
586
587#endif /* DOUG_LEA_MALLOC */
588
589/* ARGSUSED */
590int
591main (argc, argv, envp)
592 int argc;
593 char **argv;
594 char **envp;
595{
596 char stack_bottom_variable;
597 int skip_args = 0;
598 extern int errno;
599 extern int sys_nerr;
600#ifdef HAVE_SETRLIMIT
601 struct rlimit rlim;
602#endif
603 int no_loadup = 0;
604
605#ifdef LINUX_SBRK_BUG
606 __sbrk (1);
592#endif 607#endif
593 608
594#ifdef RUN_TIME_REMAP 609#ifdef RUN_TIME_REMAP