changeset 4474:78738a40e31e

Don't leak the Unihan database handle when looking up non-Han characters. 2008-06-29 Aidan Kehoe <kehoea@parhasard.net> * descr-text.el (describe-char-unicode-data): Don't leak the Unihan database handle when looking up non-Han characters.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 29 Jun 2008 11:06:16 +0200
parents 0204391fc17c
children 86283c809984
files lisp/ChangeLog lisp/descr-text.el
diffstat 2 files changed, 17 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Jun 04 21:57:49 2008 +0200
+++ b/lisp/ChangeLog	Sun Jun 29 11:06:16 2008 +0200
@@ -1,3 +1,9 @@
+2008-06-29  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* descr-text.el (describe-char-unicode-data): 
+	Don't leak the Unihan database handle when looking up non-Han
+	characters. 
+
 2008-06-04  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* descr-text.el (describe-property-list): 
--- a/lisp/descr-text.el	Wed Jun 04 21:57:49 2008 +0200
+++ b/lisp/descr-text.el	Sun Jun 29 11:06:16 2008 +0200
@@ -729,16 +729,7 @@
 
       (goto-char (point-min))
       (let ((hex (format "%04X" char))
-            found first last unihan-match unihan-info
-            (unihan-database-handle
-	     (and describe-char-unihan-file
-		  (open-database (unidata-generate-database-file-name
-				  describe-char-unihan-file
-				  (eighth (file-attributes
-					   describe-char-unihan-file))
-				  unidata-database-format)
-				 unidata-database-format
-				 nil "r" #o644 'no-conversion-unix)))
+            found first last unihan-match unihan-info unihan-database-handle
             (coding-system-for-read 'no-conversion-unix))
         (if (re-search-forward (concat "^" hex) nil t)
             (setq found t)
@@ -920,7 +911,16 @@
                (if (and (> (length (nth 0 fields)) 13)
                         (equal "<CJK Ideograph"
                                (substring (nth 0 fields) 0 14)))
-                   (if (and unihan-database-handle
+                   (if (and describe-char-unihan-file
+                            (setq unihan-database-handle
+                                  (open-database
+                                   (unidata-generate-database-file-name
+                                    describe-char-unihan-file
+                                    (eighth (file-attributes
+                                             describe-char-unihan-file))
+                                    unidata-database-format)
+                                   unidata-database-format
+                                   nil "r" #o644 'no-conversion-unix))
                             (setq unihan-match
                                   (get-database (format "%04X" char)
                                                 unihan-database-handle)