]> Sergey Matveev's repositories - public-inbox.git/commitdiff
smsg: reduce utf8::decode call sites
authorEric Wong <e@yhbt.net>
Thu, 20 Aug 2020 20:24:48 +0000 (20:24 +0000)
committerEric Wong <e@yhbt.net>
Thu, 20 Aug 2020 21:11:17 +0000 (21:11 +0000)
Both callers of load_from_data call utf8::decode, so just
do utf8::decode in load_from_data.

lib/PublicInbox/Over.pm
lib/PublicInbox/Smsg.pm

index 2b314882bc4d9546ab567d523c8c9878d89b6d7b..81b9fca7a75d7354a75f92f9e6b655c0b4eb806d 100644 (file)
@@ -68,7 +68,6 @@ sub load_from_row ($;$) {
        bless $smsg, 'PublicInbox::Smsg';
        if (defined(my $data = delete $smsg->{ddd})) {
                $data = uncompress($data);
-               utf8::decode($data);
                PublicInbox::Smsg::load_from_data($smsg, $data);
 
                # saves over 600K for 1000+ message threads
index 62cb951eb9603e92376e6bd3318a922b9f830d4e..f22cd43e7d4b69ce97eaf248546dd1598715ebd4 100644 (file)
@@ -40,6 +40,7 @@ sub to_doc_data {
 
 sub load_from_data ($$) {
        my ($self) = $_[0]; # data = $_[1]
+       utf8::decode($_[1]);
        (
                $self->{subject},
                $self->{from},
@@ -67,7 +68,6 @@ sub load_expand {
        my $dt = get_val($doc, PublicInbox::Search::DT());
        my ($yyyy, $mon, $dd, $hh, $mm, $ss) = unpack('A4A2A2A2A2A2', $dt);
        $self->{ds} = timegm($ss, $mm, $hh, $dd, $mon - 1, $yyyy);
-       utf8::decode($data);
        load_from_data($self, $data);
        $self;
 }