guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.5-58-g7ea70f


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.5-58-g7ea70f3
Date: Wed, 22 Feb 2012 19:41:04 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=7ea70f355e986c79f2c999753642141a0e8985f7

The branch, stable-2.0 has been updated
       via  7ea70f355e986c79f2c999753642141a0e8985f7 (commit)
      from  71cc8d96ee0917474c052fd484cad199be1311b2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7ea70f355e986c79f2c999753642141a0e8985f7
Author: Andy Wingo <address@hidden>
Date:   Wed Feb 22 20:40:55 2012 +0100

    microoptimizations in (web uri)
    
    * module/web/uri.scm (valid-host?): Micro-optimizations.

-----------------------------------------------------------------------

Summary of changes:
 module/web/uri.scm |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/module/web/uri.scm b/module/web/uri.scm
index 1eb2813..a2a930a 100644
--- a/module/web/uri.scm
+++ b/module/web/uri.scm
@@ -1,6 +1,6 @@
 ;;;; (web uri) --- URI manipulation tools
 ;;;;
-;;;; Copyright (C) 1997,2001,2002,2010,2011 Free Software Foundation, Inc.
+;;;; Copyright (C) 1997,2001,2002,2010,2011,2012 Free Software Foundation, Inc.
 ;;;;
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
@@ -100,18 +100,17 @@ consistency checks to make sure that the constructed URI 
is valid."
 (define (valid-host? host)
   (cond
    ((regexp-exec ipv4-regexp host)
-    => (lambda (m)
-         (false-if-exception (inet-pton AF_INET (match:substring m 1)))))
+    (false-if-exception (inet-pton AF_INET host)))
    ((regexp-exec ipv6-regexp host)
-    => (lambda (m)
-         (false-if-exception (inet-pton AF_INET6 (match:substring m 1)))))
+    (false-if-exception (inet-pton AF_INET6 host)))
    (else
-    (let ((labels (reverse (string-split host #\.))))
-      (and (pair? labels)
-           (regexp-exec top-label-regexp (car labels))
-           (and-map (lambda (label)
-                      (regexp-exec domain-label-regexp label))
-                    (cdr labels)))))))
+    (let lp ((start 0))
+      (let ((end (string-index host #\. start)))
+        (if end
+            (and (regexp-exec domain-label-regexp
+                              (substring host start end))
+                 (lp (1+ end)))
+            (regexp-exec top-label-regexp host start)))))))
 
 (define userinfo-pat
   "[a-zA-Z0-9_.!~*'();:&=+$,-]+")


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]