diff options
| author | Eli Zaretskii | 2012-10-20 18:17:25 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2012-10-20 18:17:25 +0200 |
| commit | 6d03e7beda333663080a64af902231342fd941cf (patch) | |
| tree | bd4521483ad70701e3dbf2c32e2910947bad5b53 /lib-src | |
| parent | 87c6b4e6bd7e023bd57c709bb6af59bca27bf4f6 (diff) | |
| parent | 83c85d8e2e6c1e1cb309f554555e1aebc1dcb44f (diff) | |
| download | emacs-6d03e7beda333663080a64af902231342fd941cf.tar.gz emacs-6d03e7beda333663080a64af902231342fd941cf.zip | |
Merge from trunk.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ChangeLog | 12 | ||||
| -rw-r--r-- | lib-src/make-docfile.c | 22 |
2 files changed, 26 insertions, 8 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 2b88017fc5b..8120ab7f18d 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,6 +1,16 @@ | |||
| 1 | 2012-10-20 Eli Zaretskii <eliz@gnu.org> | 1 | 2012-10-20 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | Prevent silent omission of doc strings from uncompile Lisp files. | 3 | * make-docfile.c (IS_SLASH, DEF_ELISP_FILE): New macros. |
| 4 | (scan_lisp_file): Only pass a .el file if its basename matches a | ||
| 5 | known file in its entirety. Use IS_SLASH and DEF_ELISP_FILE. | ||
| 6 | |||
| 7 | 2012-10-20 Andreas Schwab <schwab@linux-m68k.org> | ||
| 8 | |||
| 9 | * make-docfile.c (scan_lisp_file): Add bounds checking. | ||
| 10 | |||
| 11 | 2012-10-20 Eli Zaretskii <eliz@gnu.org> | ||
| 12 | |||
| 13 | Prevent silent omission of doc strings from uncompiled Lisp files. | ||
| 4 | * make-docfile.c (scan_lisp_file): Barf if called with a .el file | 14 | * make-docfile.c (scan_lisp_file): Barf if called with a .el file |
| 5 | other than one of a small list of supported un-compiled files. | 15 | other than one of a small list of supported un-compiled files. |
| 6 | 16 | ||
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 555a563d748..b6cd1530a4c 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c | |||
| @@ -58,9 +58,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 58 | #undef chdir | 58 | #undef chdir |
| 59 | #define READ_TEXT "rt" | 59 | #define READ_TEXT "rt" |
| 60 | #define READ_BINARY "rb" | 60 | #define READ_BINARY "rb" |
| 61 | #define IS_SLASH(c) ((c) == '/' || (c) == '\\' || (c) == ':') | ||
| 61 | #else /* not DOS_NT */ | 62 | #else /* not DOS_NT */ |
| 62 | #define READ_TEXT "r" | 63 | #define READ_TEXT "r" |
| 63 | #define READ_BINARY "r" | 64 | #define READ_BINARY "r" |
| 65 | #define IS_SLASH(c) ((c) == '/') | ||
| 64 | #endif /* not DOS_NT */ | 66 | #endif /* not DOS_NT */ |
| 65 | 67 | ||
| 66 | static int scan_file (char *filename); | 68 | static int scan_file (char *filename); |
| @@ -1098,6 +1100,8 @@ search_lisp_doc_at_eol (FILE *infile) | |||
| 1098 | return 1; | 1100 | return 1; |
| 1099 | } | 1101 | } |
| 1100 | 1102 | ||
| 1103 | #define DEF_ELISP_FILE(fn) { #fn, sizeof(#fn) - 1 } | ||
| 1104 | |||
| 1101 | static int | 1105 | static int |
| 1102 | scan_lisp_file (const char *filename, const char *mode) | 1106 | scan_lisp_file (const char *filename, const char *mode) |
| 1103 | { | 1107 | { |
| @@ -1111,21 +1115,25 @@ scan_lisp_file (const char *filename, const char *mode) | |||
| 1111 | static struct { | 1115 | static struct { |
| 1112 | const char *fn; | 1116 | const char *fn; |
| 1113 | size_t fl; | 1117 | size_t fl; |
| 1114 | } uncompiled[] = { | 1118 | } const uncompiled[] = { |
| 1115 | { "loaddefs.el", sizeof("loaddefs.el") - 1 }, | 1119 | DEF_ELISP_FILE (loaddefs.el), |
| 1116 | { "loadup.el", sizeof("loadup.el") - 1 }, | 1120 | DEF_ELISP_FILE (loadup.el), |
| 1117 | { "charprop.el", sizeof("charprop.el") - 1 } | 1121 | DEF_ELISP_FILE (charprop.el) |
| 1118 | }; | 1122 | }; |
| 1119 | int i, match; | 1123 | int i, match; |
| 1120 | size_t flen = strlen (filename); | 1124 | size_t flen = strlen (filename); |
| 1121 | 1125 | ||
| 1122 | if (generate_globals) | 1126 | if (generate_globals) |
| 1123 | fatal ("scanning lisp file when -g specified", 0); | 1127 | fatal ("scanning lisp file when -g specified", 0); |
| 1124 | if (!strcmp (filename + flen - 3, ".el")) | 1128 | if (flen > 3 && !strcmp (filename + flen - 3, ".el")) |
| 1125 | { | 1129 | { |
| 1126 | for (i = 0, match = 0; i < sizeof(uncompiled)/sizeof(uncompiled[0]); i++) | 1130 | for (i = 0, match = 0; i < sizeof (uncompiled) / sizeof (uncompiled[0]); |
| 1131 | i++) | ||
| 1127 | { | 1132 | { |
| 1128 | if (!strcmp (filename + flen - uncompiled[i].fl, uncompiled[i].fn)) | 1133 | if (uncompiled[i].fl <= flen |
| 1134 | && !strcmp (filename + flen - uncompiled[i].fl, uncompiled[i].fn) | ||
| 1135 | && (flen == uncompiled[i].fl | ||
| 1136 | || IS_SLASH (filename[flen - uncompiled[i].fl - 1]))) | ||
| 1129 | { | 1137 | { |
| 1130 | match = 1; | 1138 | match = 1; |
| 1131 | break; | 1139 | break; |