changeset 90289:72d8a45f6c9f

(Fdefine_coding_system_internal): Avoid a duplicated element in Vcoding_system_alist. (Fdefine_coding_system_alias): Likewise.
author Kenichi Handa <handa@m17n.org>
date Fri, 03 Feb 2006 07:37:09 +0000
parents 7432ca837c8d
children 6a1672fcf6ae
files src/coding.c
diffstat 1 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/coding.c	Wed Feb 01 10:07:17 2006 +0000
+++ b/src/coding.c	Fri Feb 03 07:37:09 2006 +0000
@@ -8933,8 +8933,11 @@
 	  ASET (this_spec, 2, this_eol_type);
 	  Fputhash (this_name, this_spec, Vcoding_system_hash_table);
 	  Vcoding_system_list = Fcons (this_name, Vcoding_system_list);
-	  Vcoding_system_alist = Fcons (Fcons (Fsymbol_name (this_name), Qnil),
-					Vcoding_system_alist);
+	  val = Fassoc (Fsymbol_name (this_name), Vcoding_system_alist);
+	  if (NILP (val))
+	    Vcoding_system_alist
+	      = Fcons (Fcons (Fsymbol_name (this_name), Qnil),
+		       Vcoding_system_alist);
 	}
     }
 
@@ -8944,8 +8947,10 @@
 
   Fputhash (name, spec_vec, Vcoding_system_hash_table);
   Vcoding_system_list = Fcons (name, Vcoding_system_list);
-  Vcoding_system_alist = Fcons (Fcons (Fsymbol_name (name), Qnil),
-				Vcoding_system_alist);
+  val = Fassoc (Fsymbol_name (name), Vcoding_system_alist);
+  if (NILP (val))
+    Vcoding_system_alist = Fcons (Fcons (Fsymbol_name (name), Qnil),
+				  Vcoding_system_alist);
 
   {
     int id = coding_categories[category].id;
@@ -9026,7 +9031,7 @@
      (alias, coding_system)
      Lisp_Object alias, coding_system;
 {
-  Lisp_Object spec, aliases, eol_type;
+  Lisp_Object spec, aliases, eol_type, val;
 
   CHECK_SYMBOL (alias);
   CHECK_CODING_SYSTEM_GET_SPEC (coding_system, spec);
@@ -9052,8 +9057,10 @@
 
   Fputhash (alias, spec, Vcoding_system_hash_table);
   Vcoding_system_list = Fcons (alias, Vcoding_system_list);
-  Vcoding_system_alist = Fcons (Fcons (Fsymbol_name (alias), Qnil),
-				Vcoding_system_alist);
+  val = Fassoc (Fsymbol_name (alias), Vcoding_system_alist);
+  if (NILP (val))
+    Vcoding_system_alist = Fcons (Fcons (Fsymbol_name (alias), Qnil),
+				  Vcoding_system_alist);
 
   return Qnil;
 }