emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 03a9a75: Fix 'define-charset' after dumping with pd


From: Eli Zaretskii
Subject: [Emacs-diffs] master 03a9a75: Fix 'define-charset' after dumping with pdumper
Date: Sun, 17 Mar 2019 11:50:52 -0400 (EDT)

branch: master
commit 03a9a75c5b8bfb5187bffdcca2d52419ef5f950a
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix 'define-charset' after dumping with pdumper
    
    * src/charset.h:
    * src/charset.c (charset_table_used): Now static.
    (charset_table_size): Now extern.
    * src/pdumper.c (dump_charset_table): Dump the entire
    charset_table, not just its used slots.  (Bug#34826)
---
 src/charset.c | 4 ++--
 src/charset.h | 2 +-
 src/pdumper.c | 6 +++++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/charset.c b/src/charset.c
index 56ab8d7..c0700f9 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -62,8 +62,8 @@ Lisp_Object Vcharset_hash_table;
 
 /* Table of struct charset.  */
 struct charset *charset_table;
-static int charset_table_size;
-int charset_table_used;
+int charset_table_size;
+static int charset_table_used;
 
 /* Special charsets corresponding to symbols.  */
 int charset_ascii;
diff --git a/src/charset.h b/src/charset.h
index ee697b8..7042a71 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -248,7 +248,7 @@ extern Lisp_Object Vcharset_hash_table;
 
 /* Table of struct charset.  */
 extern struct charset *charset_table;
-extern int charset_table_used;
+extern int charset_table_size;
 
 #define CHARSET_FROM_ID(id) (charset_table + (id))
 
diff --git a/src/pdumper.c b/src/pdumper.c
index 56ac531..92e1949 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -3212,7 +3212,11 @@ dump_charset_table (struct dump_context *ctx)
   ctx->flags.pack_objects = true;
   dump_align_output (ctx, DUMP_ALIGNMENT);
   dump_off offset = ctx->offset;
-  for (int i = 0; i < charset_table_used; ++i)
+  /* We are dumping the entire table, not just the used slots, because
+     otherwise when we restore from the pdump file, the actual size of
+     the table will be smaller than charset_table_size, and we will
+     crash if/when a new charset is defined.  */
+  for (int i = 0; i < charset_table_size; ++i)
     dump_charset (ctx, i);
   dump_emacs_reloc_to_dump_ptr_raw (ctx, &charset_table, offset);
   ctx->flags = old_flags;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]