]> code.delx.au - gnu-emacs/blobdiff - src/emacs.c
(substitute-key-definition): Fix previous change.
[gnu-emacs] / src / emacs.c
index fca9faf100e0946c0dc87b05baeb34a1e00efe69..ed5f89160c3064884de9e08155d2832c3ed10bbf 100644 (file)
@@ -81,6 +81,16 @@ Lisp_Object Vkill_emacs_hook;
   on subsequent starts.  */
 int initialized;
 
+#ifdef DOUG_LEA_MALLOC
+/* Preserves a pointer to the memory allocated that copies that
+   static data inside glibc's malloc.  */
+void *malloc_state_ptr;
+/* From glibc, a routine that returns a copy of the malloc internal state.  */
+extern void *malloc_get_state ();
+/* From glibc, a routine that overwrites the malloc internal state.  */
+extern void malloc_set_state ();
+#endif
+
 /* Variable whose value is symbol giving operating system type.  */
 Lisp_Object Vsystem_type;
 
@@ -270,7 +280,18 @@ init_cmdargs (argc, argv, skip_args)
             not including lisp and info.  */
          tem = Fexpand_file_name (build_string ("lib-src"), dir);
          lib_src_exists = Ffile_exists_p (tem);
-         if (!NILP (lib_src_exists))
+
+#ifdef MSDOS
+         /* MSDOS installations frequently remove lib-src, but we still
+            must set installation-directory, or else info won't find
+            its files (it uses the value of installation-directory).  */
+         tem = Fexpand_file_name (build_string ("info"), dir);
+         info_exists = Ffile_exists_p (tem);
+#else
+         info_exists = Qnil;
+#endif
+
+         if (!NILP (lib_src_exists) || !NILP (info_exists))
            {
              tem = Fexpand_file_name (build_string ("etc"), dir);
              etc_exists = Ffile_exists_p (tem);
@@ -285,7 +306,17 @@ init_cmdargs (argc, argv, skip_args)
          /* See if dir's parent contains those subdirs.  */
          tem = Fexpand_file_name (build_string ("../lib-src"), dir);
          lib_src_exists = Ffile_exists_p (tem);
-         if (!NILP (lib_src_exists))
+
+
+#ifdef MSDOS
+         /* See the MSDOS commentary above.  */
+         tem = Fexpand_file_name (build_string ("../info"), dir);
+         info_exists = Ffile_exists_p (tem);
+#else
+         info_exists = Qnil;
+#endif
+
+         if (!NILP (lib_src_exists) || !NILP (info_exists))
            {
              tem = Fexpand_file_name (build_string ("../etc"), dir);
              etc_exists = Ffile_exists_p (tem);
@@ -465,6 +496,14 @@ main (argc, argv, envp)
   __sbrk (1);
 #endif
 
+#ifdef DOUG_LEA_MALLOC
+  if (initialized)
+    {
+      malloc_set_state (malloc_state_ptr);
+      free (malloc_state_ptr);
+    }
+#endif
+
   sort_args (argc, argv);
 
   if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args))
@@ -542,7 +581,14 @@ main (argc, argv, envp)
   /* Extend the stack space available.  */
   if (!getrlimit (RLIMIT_STACK, &rlim))
     {
-      rlim.rlim_cur = rlim.rlim_max;
+      long newlim;
+      /* Approximate the amount regex.c needs, plus some more.  */
+      newlim = 800000 * sizeof (char *);
+      if (newlim > rlim.rlim_max)
+       newlim = rlim.rlim_max;
+      if (rlim.rlim_cur < newlim)
+       rlim.rlim_cur = newlim;
+
       setrlimit (RLIMIT_STACK, &rlim);
     }
 #endif
@@ -817,7 +863,10 @@ the Bugs section of the Emacs manual or the file BUGS.", argv[0]);
       init_alloc_once ();
       init_obarray ();
       init_eval_once ();
+      init_charset_once ();
+      init_coding_once ();
       init_syntax_once ();     /* Create standard syntax table.  */
+      init_category_once ();   /* Create standard category table.  */
                      /* Must be done before init_buffer */
       init_casetab_once ();
       init_buffer_once ();     /* Create buffer table and some buffers */
@@ -924,6 +973,9 @@ the Bugs section of the Emacs manual or the file BUGS.", argv[0]);
       syms_of_casefiddle ();
       syms_of_casetab ();
       syms_of_callproc ();
+      syms_of_category ();
+      syms_of_ccl ();
+      syms_of_charset ();
       syms_of_cmds ();
 #ifndef NO_DIR_LIBRARY
       syms_of_dired ();
@@ -933,6 +985,7 @@ the Bugs section of the Emacs manual or the file BUGS.", argv[0]);
       syms_of_editfns ();
       syms_of_emacs ();
       syms_of_fileio ();
+      syms_of_coding ();       /* This should be after syms_of_fileio.  */
 #ifdef CLASH_DETECTION
       syms_of_filelock ();
 #endif /* CLASH_DETECTION */
@@ -965,6 +1018,7 @@ the Bugs section of the Emacs manual or the file BUGS.", argv[0]);
       syms_of_xterm ();
       syms_of_xfns ();
       syms_of_xfaces ();
+      syms_of_fontset ();
 #ifdef HAVE_X11
       syms_of_xselect ();
 #endif
@@ -1265,6 +1319,10 @@ sort_args (argc, argv)
     }
 
   bcopy (new, argv, sizeof (char *) * argc);
+
+  free (options);
+  free (new);
+  free (priority);
 }
 \f
 DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 1, "P",
@@ -1473,9 +1531,15 @@ and announce itself normally when it is run.")
      Meanwhile, my_edata is not valid on Windows.  */
   memory_warnings (my_edata, malloc_warning);
 #endif /* not WINDOWSNT */
+#endif
+#ifdef DOUG_LEA_MALLOC
+  malloc_state_ptr = malloc_get_state ();
 #endif
   unexec (XSTRING (filename)->data,
          !NILP (symfile) ? XSTRING (symfile)->data : 0, my_edata, 0, 0);
+#ifdef DOUG_LEA_MALLOC
+  free (malloc_state_ptr);
+#endif
 #endif /* not VMS */
 
   Vpurify_flag = tem;