From a56eaaef7c9e641ecf6cc1cfb4cd3341e5118690 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Fri, 6 Nov 2009 05:24:28 +0000 Subject: [PATCH] * alloc.c (make_pure_c_string): New function. * eval.c (Fautoload): Purecopy all arguments. --- src/ChangeLog | 6 ++++++ src/alloc.c | 18 ++++++++++++++++++ src/eval.c | 15 ++++++--------- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index d103f180c52..f79489fe4fa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2009-11-06 Stefan Monnier + + * alloc.c (make_pure_c_string): New function. + + * eval.c (Fautoload): Purecopy all arguments. + 2009-11-05 Kenichi Handa * fileio.c (Finsert_file_contents): Be sure set coding-system of diff --git a/src/alloc.c b/src/alloc.c index 557621af797..a074bfe2d72 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4821,6 +4821,24 @@ make_pure_string (data, nchars, nbytes, multibyte) return string; } +/* Return a string a string allocated in pure space. Do not allocate + the string data, just point to DATA. */ + +Lisp_Object +make_pure_c_string (const char *data) +{ + Lisp_Object string; + struct Lisp_String *s; + int nchars = strlen (data); + + s = (struct Lisp_String *) pure_alloc (sizeof *s, Lisp_String); + s->size = nchars; + s->size_byte = -1; + s->data = data; + s->intervals = NULL_INTERVAL; + XSETSTRING (string, s); + return string; +} /* Return a cons allocated from pure space. Give it pure copies of CAR as car and CDR as cdr. */ diff --git a/src/eval.c b/src/eval.c index 136b75f756b..3945a1b7a55 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2127,16 +2127,13 @@ this does nothing and returns nil. */) /* Only add entries after dumping, because the ones before are not useful and else we get loads of them from the loaddefs.el. */ LOADHIST_ATTACH (Fcons (Qautoload, function)); - - if (NILP (Vpurify_flag)) - args[0] = file; else - args[0] = Fpurecopy (file); - args[1] = docstring; - args[2] = interactive; - args[3] = type; - - return Ffset (function, Fcons (Qautoload, Flist (4, &args[0]))); + /* We don't want the docstring in purespace (instead, + Snarf-documentation should (hopefully) overwrite it). */ + docstring = make_number (0); + return Ffset (function, + Fpurecopy (list5 (Qautoload, file, docstring, + interactive, type))); } Lisp_Object -- 2.39.2