pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/print/scribus Cut down the number of loops in the roma...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0642bc30b916
branches:  trunk
changeset: 358835:0642bc30b916
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Tue Feb 21 16:01:36 2017 +0000

description:
Cut down the number of loops in the roman number parser. The existing
logic triggers a super-linear memory use path in Clang and is generally
overcomplicated. Bump revision because it is still a code change.

diffstat:

 print/scribus/Makefile                       |    4 +-
 print/scribus/distinfo                       |    3 +-
 print/scribus/patches/patch-scribus_util.cpp |  120 +++++++++++++++++++++++++++
 3 files changed, 124 insertions(+), 3 deletions(-)

diffs (151 lines):

diff -r af63bf89789c -r 0642bc30b916 print/scribus/Makefile
--- a/print/scribus/Makefile    Tue Feb 21 15:59:34 2017 +0000
+++ b/print/scribus/Makefile    Tue Feb 21 16:01:36 2017 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.107 2017/01/01 14:43:54 wiz Exp $
+# $NetBSD: Makefile,v 1.108 2017/02/21 16:01:36 joerg Exp $
 
 DISTNAME=              scribus-1.3.3.14
-PKGREVISION=           26
+PKGREVISION=           27
 CATEGORIES=            print
 MASTER_SITES=          ${MASTER_SITE_SOURCEFORGE:=scribus/}
 EXTRACT_SUFX=          .tar.bz2
diff -r af63bf89789c -r 0642bc30b916 print/scribus/distinfo
--- a/print/scribus/distinfo    Tue Feb 21 15:59:34 2017 +0000
+++ b/print/scribus/distinfo    Tue Feb 21 16:01:36 2017 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.27 2016/04/01 16:59:38 jperkin Exp $
+$NetBSD: distinfo,v 1.28 2017/02/21 16:01:36 joerg Exp $
 
 SHA1 (scribus-1.3.3.14.tar.bz2) = 3ad5341fb815e2782aa4d817025d74af4a7c78e1
 RMD160 (scribus-1.3.3.14.tar.bz2) = b0f35060eb61f033cb86ee644d5c88222b534596
@@ -15,3 +15,4 @@
 SHA1 (patch-scribus_plugins_scriptplugin_runscriptdialog.cpp) = 75e9dfbc1b0c6fce3f9c5dc1f1eba62e4a1525a0
 SHA1 (patch-scribus_plugins_scriptplugin_runscriptdialog.h) = f4399a4b9352b61ca5a0c8e3f3be908f3d925b55
 SHA1 (patch-scribus_printerutil.cpp) = 5a6d7b3d7dc327473b14dc5dcbe74f4fdb8a724b
+SHA1 (patch-scribus_util.cpp) = bea28ff335251984dce41bd1023573b9f2ac21ce
diff -r af63bf89789c -r 0642bc30b916 print/scribus/patches/patch-scribus_util.cpp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/print/scribus/patches/patch-scribus_util.cpp      Tue Feb 21 16:01:36 2017 +0000
@@ -0,0 +1,120 @@
+$NetBSD: patch-scribus_util.cpp,v 1.1 2017/02/21 16:01:36 joerg Exp $
+
+Simplify logic to avoid expensive nested loop handling in Clang.
+
+--- scribus/util.cpp.orig      2017-02-21 14:56:16.278339690 +0000
++++ scribus/util.cpp
+@@ -1412,15 +1412,15 @@ const QString arabicToRoman(uint i)
+       roman += "m";
+       arabic -= 1000000;
+       }
+-      while (arabic - 900000 >= 0){
++      if (arabic - 900000 >= 0){
+       roman += "cm";
+       arabic -= 900000;
+       }
+-      while (arabic - 500000 >= 0){
++      if (arabic - 500000 >= 0){
+       roman += "d";
+       arabic -= 500000;
+       }
+-      while (arabic - 400000 >= 0){
++      if (arabic - 400000 >= 0){
+       roman += "cd";
+       arabic -= 400000;
+       }
+@@ -1428,15 +1428,15 @@ const QString arabicToRoman(uint i)
+       roman += "c";
+       arabic -= 100000;
+       }
+-      while (arabic - 90000 >= 0){
++      if (arabic - 90000 >= 0){
+       roman += "xc";
+       arabic -= 90000;
+       }
+-      while (arabic - 50000 >= 0){
++      if (arabic - 50000 >= 0){
+       roman += "l";
+       arabic -= 50000;
+       }
+-      while (arabic - 40000 >= 0){
++      if (arabic - 40000 >= 0){
+       roman += "xl";
+       arabic -= 40000;
+       }
+@@ -1444,15 +1444,15 @@ const QString arabicToRoman(uint i)
+       roman += "x";
+       arabic -= 10000;
+       }
+-      while (arabic - 9000 >= 0){
++      if (arabic - 9000 >= 0){
+       roman += "Mx";
+       arabic -= 9000;
+       }
+-      while (arabic - 5000 >= 0){
++      if (arabic - 5000 >= 0){
+       roman += "v";
+       arabic -= 5000;
+       }
+-      while (arabic - 4000 >= 0){
++      if (arabic - 4000 >= 0){
+       roman += "Mv";
+       arabic -= 4000;
+       }
+@@ -1460,15 +1460,15 @@ const QString arabicToRoman(uint i)
+       roman += "M";
+       arabic -= 1000;
+       }
+-      while (arabic - 900 >= 0){
++      if (arabic - 900 >= 0){
+       roman += "CM";
+       arabic -= 900;
+       }
+-      while (arabic - 500 >= 0){
++      if (arabic - 500 >= 0){
+       roman += "D";
+       arabic -= 500;
+       }
+-      while (arabic - 400 >= 0){
++      if (arabic - 400 >= 0){
+       roman += "CD";
+       arabic -= 400;
+       }
+@@ -1476,15 +1476,15 @@ const QString arabicToRoman(uint i)
+       roman += "C";
+       arabic -= 100;
+       }
+-      while (arabic - 90 >= 0){
++      if (arabic - 90 >= 0){
+       roman += "XC";
+       arabic -= 90;
+       }
+-      while (arabic - 50 >= 0){
++      if (arabic - 50 >= 0){
+       roman += "L";
+       arabic -= 50;
+       }
+-      while (arabic - 40 >= 0){
++      if (arabic - 40 >= 0){
+       roman += "XL";
+       arabic -= 40;
+       }
+@@ -1492,15 +1492,15 @@ const QString arabicToRoman(uint i)
+       roman += "X";
+       arabic -= 10;
+       }
+-      while (arabic - 9 >= 0){
++      if (arabic - 9 >= 0){
+       roman += "IX";
+       arabic -= 9;
+       }
+-      while (arabic - 5 >= 0){
++      if (arabic - 5 >= 0){
+       roman += "V";
+       arabic -= 5;
+       }
+-      while (arabic - 4 >= 0){
++      if (arabic - 4 >= 0){
+       roman += "IV";
+       arabic -= 4;
+       }



Home | Main Index | Thread Index | Old Index