From a5b67490dec3829a2f7bf6deee47d9a2b8a9020c Mon Sep 17 00:00:00 2001 From: imiyazaki Date: Mon, 20 Oct 2003 15:40:59 +0000 Subject: [PATCH] refine code. --- Chise_utils/Chise_utils.pm | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Chise_utils/Chise_utils.pm b/Chise_utils/Chise_utils.pm index 8414736..1c2aca0 100644 --- a/Chise_utils/Chise_utils.pm +++ b/Chise_utils/Chise_utils.pm @@ -193,8 +193,9 @@ sub get_chars_matching{ } } else{ -# # fall back if DB inconsistency exists. +# never fall back. # unless(@res){ +# # fall back if DB inconsistency exists. if(&get_db($atr)){ foreach $char (keys %{$chardb{$atr}}){ if($chardb{$atr}->{$char} eq $value){ @@ -227,18 +228,14 @@ sub get_chars_for{ } } } - foreach (keys %res){ - if($res{$_}==$i){ - push @res,$_; - } - } - return @res; + return grep {defined($res{$_}) and $res{$_}==$i} (keys %res); } sub de_er{ my($er)=@_; my($output_char,$atr,$value); if($er=~/^\d+$/){ + # only for debug. $output_char=pack("U",$er); }elsif($er=~/^U[\+\-]([a-fA-F\d]+)/){ $output_char=pack("U",hex($1)); -- 1.7.10.4