emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master ece563e: Fix crash in charset detection after pdump


From: Daniel Colascione
Subject: [Emacs-diffs] master ece563e: Fix crash in charset detection after pdumper load
Date: Wed, 16 Jan 2019 14:38:54 -0500 (EST)

branch: master
commit ece563e8eda4aac77923df13c5e8e8032c69b9b3
Author: Daniel Colascione <address@hidden>
Commit: Daniel Colascione <address@hidden>

    Fix crash in charset detection after pdumper load
    
    * src/coding.c:
    (reset_coding_after_pdumper_load): new function re-init character
    classes after pdumper load.
    (syms_of_coding): Call it.
---
 src/coding.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/src/coding.c b/src/coding.c
index 665aefa..441c85f 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -10774,6 +10774,8 @@ init_coding_once (void)
   PDUMPER_REMEMBER_SCALAR (emacs_mule_bytes);
 }
 
+static void reset_coding_after_pdumper_load (void);
+
 void
 syms_of_coding (void)
 {
@@ -11316,4 +11318,27 @@ internal character representation.  */);
   system_eol_type = Qunix;
 #endif
   staticpro (&system_eol_type);
+
+  pdumper_do_now_and_after_load_impl (reset_coding_after_pdumper_load);
+}
+
+static void
+reset_coding_after_pdumper_load (void)
+{
+  if (!dumped_with_pdumper_p ())
+    return;
+  for (struct coding_system *this = &coding_categories[0];
+       this < &coding_categories[coding_category_max];
+       ++this)
+    {
+      int id = this->id;
+      if (id >= 0)
+        {
+          /* Need to rebuild the coding system object because we
+             persisted it as a scalar and it's full of gunk that's now
+             invalid.  */
+          memset (this, 0, sizeof (*this));
+          setup_coding_system (CODING_ID_NAME (id), this);
+        }
+    }
 }



reply via email to

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