diff options
| author | Paul Eggert | 2015-11-19 15:01:26 -0800 |
|---|---|---|
| committer | Paul Eggert | 2015-11-19 15:01:49 -0800 |
| commit | 92949781eb0963fd1b25f1eec4e2d72d2c8ae32e (patch) | |
| tree | 17f16cb6afb54afcbf6abc0ae2c54fe844454cb8 /src/lread.c | |
| parent | d9b300af5c7b07bd870046e73df53e19e860fdb9 (diff) | |
| download | emacs-92949781eb0963fd1b25f1eec4e2d72d2c8ae32e.tar.gz emacs-92949781eb0963fd1b25f1eec4e2d72d2c8ae32e.zip | |
Prefer signed integer types in module code
Generally speaking, at the C level the Emacs source code prefers
signed types like ‘ptrdiff_t’ to unsigned types like ‘size_t’,
partly to avoid the usual signedness confusion when comparing values.
Change the module API to follow this convention.
Use ‘int’ for small values that can’t exceed INT_MAX.
* modules/mod-test/mod-test.c (Fmod_test_globref_make)
(Fmod_test_string_a_to_b, Fmod_test_vector_fill)
(Fmod_test_vector_eq):
* src/emacs-module.c (struct emacs_value_frame)
(module_make_global_ref, module_free_global_ref)
(module_copy_string_contents, module_make_string)
(module_vec_set, module_vec_get, module_vec_size):
* src/emacs-module.h (struct emacs_runtime, struct emacs_env_25):
* src/lread.c (suffix_p):
Prefer signed to unsigned integer types.
Diffstat (limited to 'src/lread.c')
| -rw-r--r-- | src/lread.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lread.c b/src/lread.c index f7ce0daf1fa..43100d9f699 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -979,8 +979,8 @@ This uses the variables `load-suffixes' and `load-file-rep-suffixes'. */) | |||
| 979 | static bool | 979 | static bool |
| 980 | suffix_p (Lisp_Object string, const char *suffix) | 980 | suffix_p (Lisp_Object string, const char *suffix) |
| 981 | { | 981 | { |
| 982 | size_t suffix_len = strlen (suffix); | 982 | ptrdiff_t suffix_len = strlen (suffix); |
| 983 | size_t string_len = SBYTES (string); | 983 | ptrdiff_t string_len = SBYTES (string); |
| 984 | 984 | ||
| 985 | return string_len >= suffix_len && !strcmp (SSDATA (string) + string_len - suffix_len, suffix); | 985 | return string_len >= suffix_len && !strcmp (SSDATA (string) + string_len - suffix_len, suffix); |
| 986 | } | 986 | } |