summaryrefslogtreecommitdiff
path: root/src/emacs.c
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2022-10-05 14:22:03 -0700
committerYuan Fu <casouri@gmail.com>2022-10-05 14:22:03 -0700
commit7ebbd4efc3d45403cf845d35c36c21756baeeba8 (patch)
treef53223ce7dbd64c079aced6e1a77964d1a8eaa3f /src/emacs.c
parentcb183f6467401fb5ed2b7fc98ca75be9d943cbe3 (diff)
parent95efafb72664049f8ac825047df3645656cf76f4 (diff)
downloademacs-7ebbd4efc3d45403cf845d35c36c21756baeeba8.tar.gz
Merge branch 'master' into feature/tree-sitter
Diffstat (limited to 'src/emacs.c')
-rw-r--r--src/emacs.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/emacs.c b/src/emacs.c
index 8f19c486553..ba8b9c651a7 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -303,7 +303,7 @@ Initialization options:\n\
-x to be used in #!/usr/bin/emacs -x\n\
and has approximately the same meaning\n\
as -Q --script\n\
---terminal, -t DEVICE use DEVICE for terminal I/O\n \
+--terminal, -t DEVICE use DEVICE for terminal I/O\n\
--user, -u USER load ~USER/.emacs instead of your own\n\
\n\
",
@@ -895,19 +895,17 @@ load_pdump (int argc, char **argv)
}
/* Where's our executable? */
- ptrdiff_t bufsize;
-#ifndef NS_SELF_CONTAINED
- ptrdiff_t exec_bufsize;
-#endif
- emacs_executable = find_emacs_executable (argv[0], &bufsize);
-#ifndef NS_SELF_CONTAINED
- exec_bufsize = bufsize;
-#endif
+ ptrdiff_t exec_bufsize, bufsize, needed;
+ emacs_executable = find_emacs_executable (argv[0], &exec_bufsize);
/* If we couldn't find our executable, go straight to looking for
the dump in the hardcoded location. */
if (!(emacs_executable && *emacs_executable))
- goto hardcoded;
+ {
+ bufsize = 0;
+ dump_file = NULL;
+ goto hardcoded;
+ }
if (dump_file)
{
@@ -935,8 +933,8 @@ load_pdump (int argc, char **argv)
strip_suffix_length))
exenamelen = prefix_length;
}
- ptrdiff_t needed = exenamelen + strlen (suffix) + 1;
- dump_file = xpalloc (NULL, &bufsize, needed - bufsize, -1, 1);
+ bufsize = exenamelen + strlen (suffix) + 1;
+ dump_file = xpalloc (NULL, &bufsize, 1, -1, 1);
memcpy (dump_file, emacs_executable, exenamelen);
strcpy (dump_file + exenamelen, suffix);
result = pdumper_load (dump_file, emacs_executable);