diff options
| author | Helmut Eller | 2026-02-28 10:53:09 +0100 |
|---|---|---|
| committer | Helmut Eller | 2026-03-21 18:42:00 +0100 |
| commit | 497fd657cd9e8d545fcfee7916c9f281a89852d8 (patch) | |
| tree | 14ea15d6c222675f72d3c7f49cc81813a916e1da /src | |
| parent | 32f9e2109858565166e65da0dabaf48c4baca20c (diff) | |
| download | emacs-497fd657cd9e8d545fcfee7916c9f281a89852d8.tar.gz emacs-497fd657cd9e8d545fcfee7916c9f281a89852d8.zip | |
* src/charset.c (shrink_charset_table): Simplify.
Diffstat (limited to 'src')
| -rw-r--r-- | src/charset.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/charset.c b/src/charset.c index eae81d689b7..2cca2222ec5 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -2117,21 +2117,22 @@ shrink_charset_table (void) | |||
| 2117 | eassert (ASIZE (charset_table.attributes_table) | 2117 | eassert (ASIZE (charset_table.attributes_table) |
| 2118 | == charset_table.size); | 2118 | == charset_table.size); |
| 2119 | 2119 | ||
| 2120 | struct charset *old = charset_table.start; | 2120 | if (charset_table.size > charset_table.used) |
| 2121 | size_t nbytes = charset_table.used * sizeof *old; | 2121 | { |
| 2122 | struct charset *new = xmalloc (nbytes); | 2122 | eassert (!pdumper_object_p (charset_table.start)); |
| 2123 | memcpy (new, old, nbytes); | 2123 | charset_table.start |
| 2124 | charset_table.start = new; | 2124 | = xnrealloc (charset_table.start, charset_table.used, |
| 2125 | xfree (old); | 2125 | sizeof *charset_table.start); |
| 2126 | 2126 | ||
| 2127 | Lisp_Object new_attr_table = make_vector (charset_table.used, Qnil); | 2127 | charset_table.attributes_table |
| 2128 | for (size_t i = 0; i < charset_table.used; i++) | 2128 | = Fvector (charset_table.used, |
| 2129 | ASET (new_attr_table, i, | 2129 | xvector_contents (charset_table.attributes_table)); |
| 2130 | AREF (charset_table.attributes_table, i)); | 2130 | |
| 2131 | charset_table.attributes_table = new_attr_table; | 2131 | charset_table.size = charset_table.used; |
| 2132 | 2132 | } | |
| 2133 | charset_table.size = charset_table.used; | 2133 | eassert (charset_table.size == charset_table.used); |
| 2134 | eassert (ASIZE (charset_table.attributes_table) == charset_table.size); | 2134 | eassert (ASIZE (charset_table.attributes_table) |
| 2135 | == charset_table.size); | ||
| 2135 | } | 2136 | } |
| 2136 | 2137 | ||
| 2137 | DEFUN ("clear-charset-maps", Fclear_charset_maps, Sclear_charset_maps, | 2138 | DEFUN ("clear-charset-maps", Fclear_charset_maps, Sclear_charset_maps, |