/* Record indices of function doc strings stored in a file.
- Copyright (C) 1985-1986, 1993-1995, 1997-2011
+ Copyright (C) 1985-1986, 1993-1995, 1997-2012
Free Software Foundation, Inc.
This file is part of GNU Emacs.
If it is relative, combine it with Vdoc_directory. */
tem = Ffile_name_absolute_p (file);
+ file = ENCODE_FILE (file);
if (NILP (tem))
{
- minsize = SCHARS (Vdoc_directory);
+ Lisp_Object docdir = ENCODE_FILE (Vdoc_directory);
+ minsize = SCHARS (docdir);
/* sizeof ("../etc/") == 8 */
if (minsize < 8)
minsize = 8;
name = (char *) alloca (minsize + SCHARS (file) + 8);
- strcpy (name, SSDATA (Vdoc_directory));
+ strcpy (name, SSDATA (docdir));
strcat (name, SSDATA (file));
}
else
if (!NILP (Vpurify_flag))
{
/* Preparing to dump; DOC file is probably not installed.
- So check in ../etc. */
+ So check in ../etc. */
strcpy (name, "../etc/");
strcat (name, SSDATA (file));
p = get_doc_string_buffer;
while (1)
{
- ptrdiff_t space_left = (get_doc_string_buffer_size
+ ptrdiff_t space_left = (get_doc_string_buffer_size - 1
- (p - get_doc_string_buffer));
int nread;
/* Allocate or grow the buffer if we need to. */
- if (space_left == 0)
+ if (space_left <= 0)
{
ptrdiff_t in_buffer = p - get_doc_string_buffer;
get_doc_string_buffer =
xpalloc (get_doc_string_buffer, &get_doc_string_buffer_size,
16 * 1024, -1, 1);
p = get_doc_string_buffer + in_buffer;
- space_left = (get_doc_string_buffer_size
+ space_left = (get_doc_string_buffer_size - 1
- (p - get_doc_string_buffer));
}
/* Scanning the DOC files and placing docstring offsets into functions. */
static void
-store_function_docstring (Lisp_Object fun, EMACS_INT offset)
+store_function_docstring (Lisp_Object obj, EMACS_INT offset)
/* Use EMACS_INT because we get offset from pointer subtraction. */
{
- fun = indirect_function (fun);
+ /* Don't use indirect_function here, or defaliases will apply their
+ docstrings to the base functions (Bug#2603). */
+ Lisp_Object fun = SYMBOLP (obj) ? XSYMBOL (obj)->function : obj;
/* The type determines where the docstring is stored. */