Commit 874c7fc5 authored by Zach Beane's avatar Zach Beane
Browse files

Change SOCKET:DOTTED-TO-IPADDR to parse IP string directly.

Avoids calling CCL:DOTTED-TO-IPADDR on Clozure, and works on SBCL.
parent fa49577e
......@@ -21,6 +21,5 @@
;; Only used for input in aserve
(stream-device stream :input))
(defun dotted-to-ipaddr (dotted)
(ccl:dotted-to-ipaddr dotted))
......@@ -164,9 +164,29 @@
(ldb (byte 8 0) ip-integer)))
(defun socket:dotted-to-ipaddr (dotted &key errorp)
(if errorp
(dotted-to-ipaddr dotted)
(ignore-errors (dotted-to-ipaddr dotted))))
(let ((result 0)
(length (length dotted))
(i 0)
(start 0))
(when (= i 4)
(return result))
(when (<= length start)
(if errorp
(error "Malformed IP string - overrun: ~A" dotted)
(return nil)))
(let* ((end (or (position #\. dotted :start start) length))
(integer (ignore-errors
(parse-integer dotted :start start :end end))))
(unless integer
(if errorp
(error "Cannot parse integer at ~A-~A of ~A"
start end dotted)
(return nil)))
(setf result (logior integer
(ash result 8)))
(incf i)
(setf start (1+ end))))))
(defmacro socket:with-pending-connect (&body body)
`(progn ,@body))
;;;; sbcl-specific.lisp
(in-package #:zacl)
(defun stream-unix-fd (stream)
(fd-stream-fd stream))
......@@ -24,6 +24,8 @@
:components ((:file "package")
(:file "clozure-specific")
(:file "sbcl-specific")
(:file "defpackage-hack")
(:file "reader")
(:file "fake-slots")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment