diff options
| author | Paul Eggert | 2019-02-16 10:17:33 -0800 |
|---|---|---|
| committer | Paul Eggert | 2019-02-16 10:18:07 -0800 |
| commit | 5c158d1320c55ce7fcb01532ad9911f89930ba81 (patch) | |
| tree | c87e62e5a8b827844c99253df6b2a865e31901e1 /src | |
| parent | 2208c01264cb9fe95c857eb57dafa9ea8570b325 (diff) | |
| download | emacs-5c158d1320c55ce7fcb01532ad9911f89930ba81.tar.gz emacs-5c158d1320c55ce7fcb01532ad9911f89930ba81.zip | |
* src/lread.c (readevalloop): Simplify via suffix_p.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lread.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lread.c b/src/lread.c index ddef135687f..6389e3ed48e 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1070,14 +1070,15 @@ This uses the variables `load-suffixes' and `load-file-rep-suffixes'. */) | |||
| 1070 | return Fnreverse (lst); | 1070 | return Fnreverse (lst); |
| 1071 | } | 1071 | } |
| 1072 | 1072 | ||
| 1073 | /* Returns true if STRING ends with SUFFIX */ | 1073 | /* Return true if STRING ends with SUFFIX. */ |
| 1074 | static bool | 1074 | static bool |
| 1075 | suffix_p (Lisp_Object string, const char *suffix) | 1075 | suffix_p (Lisp_Object string, const char *suffix) |
| 1076 | { | 1076 | { |
| 1077 | ptrdiff_t suffix_len = strlen (suffix); | 1077 | ptrdiff_t suffix_len = strlen (suffix); |
| 1078 | ptrdiff_t string_len = SBYTES (string); | 1078 | ptrdiff_t string_len = SBYTES (string); |
| 1079 | 1079 | ||
| 1080 | return string_len >= suffix_len && !strcmp (SSDATA (string) + string_len - suffix_len, suffix); | 1080 | return (suffix_len <= string_len |
| 1081 | && strcmp (SSDATA (string) + string_len - suffix_len, suffix) == 0); | ||
| 1081 | } | 1082 | } |
| 1082 | 1083 | ||
| 1083 | static void | 1084 | static void |
| @@ -1932,9 +1933,7 @@ readevalloop (Lisp_Object readcharfun, | |||
| 1932 | Lisp_Object macroexpand = intern ("internal-macroexpand-for-load"); | 1933 | Lisp_Object macroexpand = intern ("internal-macroexpand-for-load"); |
| 1933 | 1934 | ||
| 1934 | if (NILP (Ffboundp (macroexpand)) | 1935 | if (NILP (Ffboundp (macroexpand)) |
| 1935 | || (STRINGP (sourcename) | 1936 | || (STRINGP (sourcename) && suffix_p (sourcename, ".elc"))) |
| 1936 | && SBYTES (sourcename) >= 4 | ||
| 1937 | && !strcmp (".elc", SSDATA (sourcename) + SBYTES (sourcename) - 4))) | ||
| 1938 | /* Don't macroexpand before the corresponding function is defined | 1937 | /* Don't macroexpand before the corresponding function is defined |
| 1939 | and don't bother macroexpanding in .elc files, since it should have | 1938 | and don't bother macroexpanding in .elc files, since it should have |
| 1940 | been done already. */ | 1939 | been done already. */ |