diff options
| author | Mattias EngdegÄrd | 2025-07-11 16:26:54 +0200 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2025-07-11 16:36:27 +0200 |
| commit | 52b96d3a7e27e0cdc3f53041f2f18cbe2c095a86 (patch) | |
| tree | eba36c6c0f2b5acb1e34ef996372a7cf9482f020 | |
| parent | 8ff6e7fe58466e413b5eed22ea93869e60da8d3d (diff) | |
| download | emacs-52b96d3a7e27e0cdc3f53041f2f18cbe2c095a86.tar.gz emacs-52b96d3a7e27e0cdc3f53041f2f18cbe2c095a86.zip | |
* src/fns.c (Flength): Fix char table length off-by-one bug.
| -rw-r--r-- | src/fns.c | 2 | ||||
| -rw-r--r-- | test/src/fns-tests.el | 3 |
2 files changed, 3 insertions, 2 deletions
| @@ -147,7 +147,7 @@ efficient. */) | |||
| 147 | else if (VECTORP (sequence)) | 147 | else if (VECTORP (sequence)) |
| 148 | val = ASIZE (sequence); | 148 | val = ASIZE (sequence); |
| 149 | else if (CHAR_TABLE_P (sequence)) | 149 | else if (CHAR_TABLE_P (sequence)) |
| 150 | val = MAX_CHAR; | 150 | val = MAX_CHAR + 1; |
| 151 | else if (BOOL_VECTOR_P (sequence)) | 151 | else if (BOOL_VECTOR_P (sequence)) |
| 152 | val = bool_vector_size (sequence); | 152 | val = bool_vector_size (sequence); |
| 153 | else if (CLOSUREP (sequence) || RECORDP (sequence)) | 153 | else if (CLOSUREP (sequence) || RECORDP (sequence)) |
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index e6abcdc34e7..6a50d89c778 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el | |||
| @@ -52,7 +52,8 @@ | |||
| 52 | (should (= (length '(1 2 3)) 3)) | 52 | (should (= (length '(1 2 3)) 3)) |
| 53 | (should (= (length '[1 2 3]) 3)) | 53 | (should (= (length '[1 2 3]) 3)) |
| 54 | (should (= (length "foo") 3)) | 54 | (should (= (length "foo") 3)) |
| 55 | (should-error (length t))) | 55 | (should-error (length t)) |
| 56 | (should (= (length (make-char-table 'fns-tests)) (1+ (max-char))))) | ||
| 56 | 57 | ||
| 57 | (ert-deftest fns-tests-safe-length () | 58 | (ert-deftest fns-tests-safe-length () |
| 58 | (should (= (safe-length '(1 2 3)) 3))) | 59 | (should (= (safe-length '(1 2 3)) 3))) |