diff options
| author | Stefan Monnier | 2024-01-26 23:15:57 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2024-01-26 23:15:57 -0500 |
| commit | 08007a030e03762b888dcfcd64e84f03e5a2d54f (patch) | |
| tree | de3fe9f76b2982ef12dbb2f9aed3abe642bd56ae | |
| parent | 89734c4f1d2fb9aa18e44481174eb595134f497b (diff) | |
| download | emacs-08007a030e03762b888dcfcd64e84f03e5a2d54f.tar.gz emacs-08007a030e03762b888dcfcd64e84f03e5a2d54f.zip | |
pdumper.c: Minor improvements found while debugging
* src/pdumper.c (dump_hash_table_list): Remove unused return value;
and simplify with `vconcat`.
(dump_charset): Don't copy uninitialized fields.
| -rw-r--r-- | src/pdumper.c | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/src/pdumper.c b/src/pdumper.c index 6b0178227bd..6d0abc5d835 100644 --- a/src/pdumper.c +++ b/src/pdumper.c | |||
| @@ -2659,13 +2659,11 @@ hash_table_contents (struct Lisp_Hash_Table *h) | |||
| 2659 | return key_and_value; | 2659 | return key_and_value; |
| 2660 | } | 2660 | } |
| 2661 | 2661 | ||
| 2662 | static dump_off | 2662 | static void |
| 2663 | dump_hash_table_list (struct dump_context *ctx) | 2663 | dump_hash_table_list (struct dump_context *ctx) |
| 2664 | { | 2664 | { |
| 2665 | if (!NILP (ctx->hash_tables)) | 2665 | if (!NILP (ctx->hash_tables)) |
| 2666 | return dump_object (ctx, CALLN (Fapply, Qvector, ctx->hash_tables)); | 2666 | dump_object (ctx, CALLN (Fvconcat, ctx->hash_tables)); |
| 2667 | else | ||
| 2668 | return 0; | ||
| 2669 | } | 2667 | } |
| 2670 | 2668 | ||
| 2671 | static hash_table_std_test_t | 2669 | static hash_table_std_test_t |
| @@ -3222,30 +3220,33 @@ dump_charset (struct dump_context *ctx, int cs_i) | |||
| 3222 | const struct charset *cs = charset_table + cs_i; | 3220 | const struct charset *cs = charset_table + cs_i; |
| 3223 | struct charset out; | 3221 | struct charset out; |
| 3224 | dump_object_start (ctx, &out, sizeof (out)); | 3222 | dump_object_start (ctx, &out, sizeof (out)); |
| 3225 | DUMP_FIELD_COPY (&out, cs, id); | 3223 | if (cs_i < charset_table_used) /* Don't look at uninitialized data. */ |
| 3226 | dump_field_lv (ctx, &out, cs, &cs->attributes, WEIGHT_NORMAL); | 3224 | { |
| 3227 | DUMP_FIELD_COPY (&out, cs, dimension); | 3225 | DUMP_FIELD_COPY (&out, cs, id); |
| 3228 | memcpy (out.code_space, &cs->code_space, sizeof (cs->code_space)); | 3226 | dump_field_lv (ctx, &out, cs, &cs->attributes, WEIGHT_NORMAL); |
| 3229 | if (cs_i < charset_table_used && cs->code_space_mask) | 3227 | DUMP_FIELD_COPY (&out, cs, dimension); |
| 3230 | dump_field_fixup_later (ctx, &out, cs, &cs->code_space_mask); | 3228 | memcpy (out.code_space, &cs->code_space, sizeof (cs->code_space)); |
| 3231 | DUMP_FIELD_COPY (&out, cs, code_linear_p); | 3229 | if (cs->code_space_mask) |
| 3232 | DUMP_FIELD_COPY (&out, cs, iso_chars_96); | 3230 | dump_field_fixup_later (ctx, &out, cs, &cs->code_space_mask); |
| 3233 | DUMP_FIELD_COPY (&out, cs, ascii_compatible_p); | 3231 | DUMP_FIELD_COPY (&out, cs, code_linear_p); |
| 3234 | DUMP_FIELD_COPY (&out, cs, supplementary_p); | 3232 | DUMP_FIELD_COPY (&out, cs, iso_chars_96); |
| 3235 | DUMP_FIELD_COPY (&out, cs, compact_codes_p); | 3233 | DUMP_FIELD_COPY (&out, cs, ascii_compatible_p); |
| 3236 | DUMP_FIELD_COPY (&out, cs, unified_p); | 3234 | DUMP_FIELD_COPY (&out, cs, supplementary_p); |
| 3237 | DUMP_FIELD_COPY (&out, cs, iso_final); | 3235 | DUMP_FIELD_COPY (&out, cs, compact_codes_p); |
| 3238 | DUMP_FIELD_COPY (&out, cs, iso_revision); | 3236 | DUMP_FIELD_COPY (&out, cs, unified_p); |
| 3239 | DUMP_FIELD_COPY (&out, cs, emacs_mule_id); | 3237 | DUMP_FIELD_COPY (&out, cs, iso_final); |
| 3240 | DUMP_FIELD_COPY (&out, cs, method); | 3238 | DUMP_FIELD_COPY (&out, cs, iso_revision); |
| 3241 | DUMP_FIELD_COPY (&out, cs, min_code); | 3239 | DUMP_FIELD_COPY (&out, cs, emacs_mule_id); |
| 3242 | DUMP_FIELD_COPY (&out, cs, max_code); | 3240 | DUMP_FIELD_COPY (&out, cs, method); |
| 3243 | DUMP_FIELD_COPY (&out, cs, char_index_offset); | 3241 | DUMP_FIELD_COPY (&out, cs, min_code); |
| 3244 | DUMP_FIELD_COPY (&out, cs, min_char); | 3242 | DUMP_FIELD_COPY (&out, cs, max_code); |
| 3245 | DUMP_FIELD_COPY (&out, cs, max_char); | 3243 | DUMP_FIELD_COPY (&out, cs, char_index_offset); |
| 3246 | DUMP_FIELD_COPY (&out, cs, invalid_code); | 3244 | DUMP_FIELD_COPY (&out, cs, min_char); |
| 3247 | memcpy (out.fast_map, &cs->fast_map, sizeof (cs->fast_map)); | 3245 | DUMP_FIELD_COPY (&out, cs, max_char); |
| 3248 | DUMP_FIELD_COPY (&out, cs, code_offset); | 3246 | DUMP_FIELD_COPY (&out, cs, invalid_code); |
| 3247 | memcpy (out.fast_map, &cs->fast_map, sizeof (cs->fast_map)); | ||
| 3248 | DUMP_FIELD_COPY (&out, cs, code_offset); | ||
| 3249 | } | ||
| 3249 | dump_off offset = dump_object_finish (ctx, &out, sizeof (out)); | 3250 | dump_off offset = dump_object_finish (ctx, &out, sizeof (out)); |
| 3250 | if (cs_i < charset_table_used && cs->code_space_mask) | 3251 | if (cs_i < charset_table_used && cs->code_space_mask) |
| 3251 | dump_remember_cold_op (ctx, COLD_OP_CHARSET, | 3252 | dump_remember_cold_op (ctx, COLD_OP_CHARSET, |