]> code.delx.au - gnu-emacs/blobdiff - lib-src/make-docfile.c
Merge latest Org fixes (commit 7524ef2).
[gnu-emacs] / lib-src / make-docfile.c
index 555a563d748753a97b0e7f431b81652c3cbc1d9e..54a53c0d441e8864d81cb6241109bd791fa9657d 100644 (file)
@@ -1,7 +1,7 @@
 /* Generate doc-string file for GNU Emacs from source files.
 
-Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2012
-  Free Software Foundation, Inc.
+Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2013 Free Software
+Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -58,9 +58,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #undef chdir
 #define READ_TEXT "rt"
 #define READ_BINARY "rb"
+#define IS_SLASH(c)  ((c) == '/' || (c) == '\\' || (c) == ':')
 #else  /* not DOS_NT */
 #define READ_TEXT "r"
 #define READ_BINARY "r"
+#define IS_SLASH(c)  ((c) == '/')
 #endif /* not DOS_NT */
 
 static int scan_file (char *filename);
@@ -1098,6 +1100,8 @@ search_lisp_doc_at_eol (FILE *infile)
   return 1;
 }
 
+#define DEF_ELISP_FILE(fn)  { #fn, sizeof(#fn) - 1 }
+
 static int
 scan_lisp_file (const char *filename, const char *mode)
 {
@@ -1111,21 +1115,27 @@ scan_lisp_file (const char *filename, const char *mode)
   static struct {
     const char *fn;
     size_t fl;
-  } uncompiled[] = {
-    { "loaddefs.el", sizeof("loaddefs.el") - 1 },
-    { "loadup.el", sizeof("loadup.el") - 1 },
-    { "charprop.el", sizeof("charprop.el") - 1 }
+  } const uncompiled[] = {
+    DEF_ELISP_FILE (loaddefs.el),
+    DEF_ELISP_FILE (loadup.el),
+    DEF_ELISP_FILE (charprop.el),
+    DEF_ELISP_FILE (cp51932.el),
+    DEF_ELISP_FILE (eucjp-ms.el)
   };
   int i, match;
   size_t flen = strlen (filename);
 
   if (generate_globals)
     fatal ("scanning lisp file when -g specified", 0);
-  if (!strcmp (filename + flen - 3, ".el"))
+  if (flen > 3 && !strcmp (filename + flen - 3, ".el"))
     {
-      for (i = 0, match = 0; i < sizeof(uncompiled)/sizeof(uncompiled[0]); i++)
+      for (i = 0, match = 0; i < sizeof (uncompiled) / sizeof (uncompiled[0]);
+          i++)
        {
-         if (!strcmp (filename + flen - uncompiled[i].fl, uncompiled[i].fn))
+         if (uncompiled[i].fl <= flen
+             && !strcmp (filename + flen - uncompiled[i].fl, uncompiled[i].fn)
+             && (flen == uncompiled[i].fl
+                 || IS_SLASH (filename[flen - uncompiled[i].fl - 1])))
            {
              match = 1;
              break;