diff options
| author | Paul Eggert | 2024-07-20 09:03:24 -0700 |
|---|---|---|
| committer | Paul Eggert | 2024-07-20 16:16:22 -0700 |
| commit | 76497a01425e19a6c3a02c1e3031061fa0e7885b (patch) | |
| tree | d9cf4afc0759ce82ccdcc622d7eeac097e107cc6 /src | |
| parent | 55fefe06ef00cbe3e27a111a229a2622ae487c74 (diff) | |
| download | emacs-76497a01425e19a6c3a02c1e3031061fa0e7885b.tar.gz emacs-76497a01425e19a6c3a02c1e3031061fa0e7885b.zip | |
Change list-length intptr_t to ptrdiff_t
* src/fns.c (list_length, Fsafe_length, Fproper_list_p):
Use ptrdiff_t not intptr_t for accumulator, since result is ptrdiff_t.
This fixes a minor glitch in 2019-01-11T05:35:31!eggert@cs.ucla.edu
where I removed unnecessary overflow checks but forgot to change types.
This change should alter generated code only on oddball platforms where
ptrdiff_t is narrower than intptr_t, e.g., CheriBSD.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -117,7 +117,7 @@ See Info node `(elisp)Random Numbers' for more details. */) | |||
| 117 | ptrdiff_t | 117 | ptrdiff_t |
| 118 | list_length (Lisp_Object list) | 118 | list_length (Lisp_Object list) |
| 119 | { | 119 | { |
| 120 | intptr_t i = 0; | 120 | ptrdiff_t i = 0; |
| 121 | FOR_EACH_TAIL (list) | 121 | FOR_EACH_TAIL (list) |
| 122 | i++; | 122 | i++; |
| 123 | CHECK_LIST_END (list, list); | 123 | CHECK_LIST_END (list, list); |
| @@ -167,7 +167,7 @@ it returns 0. If LIST is circular, it returns an integer that is at | |||
| 167 | least the number of distinct elements. */) | 167 | least the number of distinct elements. */) |
| 168 | (Lisp_Object list) | 168 | (Lisp_Object list) |
| 169 | { | 169 | { |
| 170 | intptr_t len = 0; | 170 | ptrdiff_t len = 0; |
| 171 | FOR_EACH_TAIL_SAFE (list) | 171 | FOR_EACH_TAIL_SAFE (list) |
| 172 | len++; | 172 | len++; |
| 173 | return make_fixnum (len); | 173 | return make_fixnum (len); |
| @@ -248,7 +248,7 @@ A proper list is neither circular nor dotted (i.e., its last cdr is nil). */ | |||
| 248 | attributes: const) | 248 | attributes: const) |
| 249 | (Lisp_Object object) | 249 | (Lisp_Object object) |
| 250 | { | 250 | { |
| 251 | intptr_t len = 0; | 251 | ptrdiff_t len = 0; |
| 252 | Lisp_Object last_tail = object; | 252 | Lisp_Object last_tail = object; |
| 253 | Lisp_Object tail = object; | 253 | Lisp_Object tail = object; |
| 254 | FOR_EACH_TAIL_SAFE (tail) | 254 | FOR_EACH_TAIL_SAFE (tail) |