(decode_options): Fix typo.
[bpt/emacs.git] / lib-src / make-docfile.c
index 72f6ddf..1cf63e3 100644 (file)
@@ -533,7 +533,7 @@ write_c_args (out, func, buf, minargs, maxargs)
 }
 \f
 /* Read through a c file.  If a .o file is named,
-   the corresponding .c file is read instead.
+   the corresponding .c or .m file is read instead.
    Looks for DEFUN constructs such as are defined in ../src/lisp.h.
    Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED.  */
 
@@ -555,6 +555,15 @@ scan_c_file (filename, mode)
 
   infile = fopen (filename, mode);
 
+  if (infile == NULL && extension == 'o')
+    {
+      /* try .m */
+      filename[strlen (filename) - 1] = 'm';
+      infile = fopen (filename, mode);
+      if (infile == NULL)
+        filename[strlen (filename) - 1] = 'c'; /* don't confuse people */
+    }
+
   /* No error if non-ex input file */
   if (infile == NULL)
     {
@@ -900,7 +909,7 @@ scan_lisp_file (filename, mode)
              /* Read in the contents.  */
              if (saved_string != 0)
                free (saved_string);
-             saved_string = (char *) malloc (length);
+             saved_string = (char *) xmalloc (length);
              for (i = 0; i < length; i++)
                saved_string[i] = getc (infile);
              /* The last character is a ^_.
@@ -1182,7 +1191,7 @@ scan_lisp_file (filename, mode)
       else
        {
 #ifdef DEBUG
-         fprintf (stderr, "## unrecognised top-level form, %s (%s)\n",
+         fprintf (stderr, "## unrecognized top-level form, %s (%s)\n",
                   buffer, filename);
 #endif
          continue;