diff src/doc.c @ 104619:90578b9cc2d2

* Makefile.in (buildobj.h): New target. (doc.o): Depend on it. (temacs${EXEEXT}): Don't generate buildobj.lst. (mostlyclean): Delete buildobj.h, not buildobj.lst. * makefile.w32-in ($(SRC)/buildobj.h): New target. ($(BLD)/doc.$(O)): Depend on it. (make-buildobj-CMD, make-buildobj-SH): New targets. (Syntax help provided by Eli Zaretskii.) ($(TEMACS)): Don't generate buildobj.lst. * doc.c: Include buildobj.h. (buildobj): New static variable. (Fsnarf_documentation): Use it, instead of opening and reading buildobj.lst.
author Ken Raeburn <raeburn@raeburn.org>
date Wed, 26 Aug 2009 08:28:23 +0000
parents e038c1a8307c
children cd8d62c35d57
line wrap: on
line diff
--- a/src/doc.c	Wed Aug 26 07:42:11 2009 +0000
+++ b/src/doc.c	Wed Aug 26 08:28:23 2009 +0000
@@ -42,6 +42,7 @@
 #include "keyboard.h"
 #include "character.h"
 #include "keymap.h"
+#include "buildobj.h"
 
 #ifdef HAVE_INDEX
 extern char *index P_ ((const char *, int));
@@ -552,6 +553,7 @@
     }
 }
 
+static const char buildobj[] = BUILDOBJ;
 
 DEFUN ("Snarf-documentation", Fsnarf_documentation, Ssnarf_documentation,
        1, 1, 0,
@@ -598,32 +600,9 @@
   /* Vbuild_files is nil when temacs is run, and non-nil after that.  */
   if (NILP (Vbuild_files))
   {
-    size_t cp_size = 0;
-    size_t to_read;
-    int nr_read;
-    char *cp = NULL;
-    char *beg, *end;
-
-    fd = emacs_open ("buildobj.lst", O_RDONLY, 0);
-    if (fd < 0)
-      report_file_error ("Opening file buildobj.lst", Qnil);
+    const char *beg, *end;
 
-    filled = 0;
-    for (;;)
-      {
-        cp_size += 1024;
-        to_read = cp_size - 1 - filled;
-        cp = xrealloc (cp, cp_size);
-        nr_read = emacs_read (fd, &cp[filled], to_read);
-        filled += nr_read;
-        if (nr_read < to_read)
-          break;
-      }
-
-    emacs_close (fd);
-    cp[filled] = 0;
-
-    for (beg = cp; *beg; beg = end)
+    for (beg = buildobj; *beg; beg = end)
       {
         int len;
 
@@ -639,8 +618,6 @@
         if (len > 0)
           Vbuild_files = Fcons (make_string (beg, len), Vbuild_files);
       }
-
-    xfree (cp);
   }
 
   fd = emacs_open (name, O_RDONLY, 0);