comparison src/eval.c @ 108161:514ebf69b289

Fix wrong-docstring problem introduced with hash-consing. * eval.c (Fautoload): Set doc to a unique number rather than to 0. Remove unused var `args'. * lisp.h (XSETCARFASTINT, XSETCDRFASTINT): Remove. (LOADHIST_ATTACH): Wrap with do...while to avoid surprises for callers. * doc.c (store_function_docstring): Use XSETCAR.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 29 Apr 2010 08:42:01 -0400
parents 641672d44942
children 261591829d04
comparison
equal deleted inserted replaced
108160:7fc92f732328 108161:514ebf69b289
2132 If FUNCTION is already defined other than as an autoload, 2132 If FUNCTION is already defined other than as an autoload,
2133 this does nothing and returns nil. */) 2133 this does nothing and returns nil. */)
2134 (function, file, docstring, interactive, type) 2134 (function, file, docstring, interactive, type)
2135 Lisp_Object function, file, docstring, interactive, type; 2135 Lisp_Object function, file, docstring, interactive, type;
2136 { 2136 {
2137 Lisp_Object args[4];
2138
2139 CHECK_SYMBOL (function); 2137 CHECK_SYMBOL (function);
2140 CHECK_STRING (file); 2138 CHECK_STRING (file);
2141 2139
2142 /* If function is defined and not as an autoload, don't override */ 2140 /* If function is defined and not as an autoload, don't override */
2143 if (!EQ (XSYMBOL (function)->function, Qunbound) 2141 if (!EQ (XSYMBOL (function)->function, Qunbound)
2149 /* Only add entries after dumping, because the ones before are 2147 /* Only add entries after dumping, because the ones before are
2150 not useful and else we get loads of them from the loaddefs.el. */ 2148 not useful and else we get loads of them from the loaddefs.el. */
2151 LOADHIST_ATTACH (Fcons (Qautoload, function)); 2149 LOADHIST_ATTACH (Fcons (Qautoload, function));
2152 else 2150 else
2153 /* We don't want the docstring in purespace (instead, 2151 /* We don't want the docstring in purespace (instead,
2154 Snarf-documentation should (hopefully) overwrite it). */ 2152 Snarf-documentation should (hopefully) overwrite it).
2155 docstring = make_number (0); 2153 We used to use 0 here, but that leads to accidental sharing in
2154 purecopy's hash-consing, so we use a (hopefully) unique integer
2155 instead. */
2156 docstring = make_number (XHASH (function));
2156 return Ffset (function, 2157 return Ffset (function,
2157 Fpurecopy (list5 (Qautoload, file, docstring, 2158 Fpurecopy (list5 (Qautoload, file, docstring,
2158 interactive, type))); 2159 interactive, type)));
2159 } 2160 }
2160 2161