Commit 23950945a6c878a43e2b912a633f400f14bc1c58

Thomas de Grivel 2018-06-04T09:58:55

fix loop for clisp

diff --git a/cffi-socket.lisp b/cffi-socket.lisp
index bae1c62..d2c23f1 100644
--- a/cffi-socket.lisp
+++ b/cffi-socket.lisp
@@ -76,22 +76,27 @@
 ;;  IP
 
 (defun inet-addr-from-string (x &key (start 0) (end (length x)))
-  (ignore-errors
+  (block nil
     (let ((addr 0))
       (flet ((eat-byte ()
                (let ((b 0))
-                 (loop while (< start end)
-                    for c = (char x start)
-                    while (char<= #\0 c #\9)
-                    do (setf b (+ (* 10 b) (- (char-code c) (char-code #\0))))
-                    do (incf start))
+                 (loop
+                    (unless (< start end)
+                      (return))
+                    (let ((c (char x start)))
+                      (unless (char<= #\0 c #\9)
+                        (return))
+                      (setf b (+ (* 10 b) (- (char-code c) (char-code #\0))))
+                      (incf start)))
                  (setf addr (logior (ash addr 8) b)))))
         (dotimes (_ 3)
           (eat-byte)
-          (assert (char= #\. (char x start)))
+          (unless (char= #\. (char x start))
+            (return nil))
           (incf start))
         (eat-byte)
-        (assert (= end start)))
+        (unless (= end start)
+          (return nil)))
       addr)))
 
 (defun inet-addr (x)