]> git.sesse.net Git - wloh/commitdiff
Small optimization to copy_escape.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 25 Aug 2012 11:16:22 +0000 (13:16 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 25 Aug 2012 11:16:22 +0000 (13:16 +0200)
sync.pl

diff --git a/sync.pl b/sync.pl
index 9af864217b9712c67e7fc8536779e87e69c2aa15..c57325965d93c9e4acf381bc057aff128f7ecbe9 100755 (executable)
--- a/sync.pl
+++ b/sync.pl
@@ -14,10 +14,7 @@ sub copy_escape {
                return '\N';
        }
        $x = Encode::decode('iso8859-1', $x);
-       $x =~ s/\\/\\\\/g;
-       $x =~ s/\r/\\r/g;
-       $x =~ s/\n/\\n/g;
-       $x =~ s/\t/\\t/g;
+       $x =~ s/([\\\r\n\t])/\\$1/g;
        return $x;
 }