The following commit has been merged in the master branch:
commit d3de9d66d6c4e735e7f9d2821549b9fc8e235d7d
Author: Guillem Jover <[email protected]>
Date:   Tue Nov 2 08:06:52 2010 +0100

    libdpkg: Slightly optimize order() checks
    
    Reorganize code to first do checks on most commonly expected character.
    First digits, then alphabetical, then the tilde, followed by any non NUL
    character and finally the NUL character.

diff --git a/lib/dpkg/vercmp.c b/lib/dpkg/vercmp.c
index e111e11..779aaaa 100644
--- a/lib/dpkg/vercmp.c
+++ b/lib/dpkg/vercmp.c
@@ -43,16 +43,16 @@ epochsdiffer(const struct versionrevision *a,
 static int
 order(int c)
 {
-  if (c == '~')
-    return -1;
-  else if (cisdigit(c))
-    return 0;
-  else if (!c)
+  if (cisdigit(c))
     return 0;
   else if (cisalpha(c))
     return c;
-  else
+  else if (c == '~')
+    return -1;
+  else if (c)
     return c + 256;
+  else
+    return 0;
 }
 
 static int verrevcmp(const char *val, const char *ref) {

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to