From: Mark Wooding Date: Sun, 10 Dec 2006 15:03:55 +0000 (+0000) Subject: Throughout: Use shiny new macros. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/zone/commitdiff_plain/b85ef4e407e433ec2b2b40c2a38957f955f827fc?ds=sidebyside Throughout: Use shiny new macros. In particular, with-parsed-body and setf-default are useful. --- diff --git a/net.lisp b/net.lisp index 64c796d..40882de 100644 --- a/net.lisp +++ b/net.lisp @@ -75,8 +75,7 @@ (defun string-ipaddr (str &key (start 0) (end nil)) `stringify'. The START and END arguments may be used to parse out a substring." (setf str (stringify str)) - (unless end - (setf end (length str))) + (setf-default end (length str)) (let ((addr 0) (noct 0)) (loop (let* ((pos (position #\. str :start start :end end)) @@ -151,7 +150,7 @@ (defun make-ipnet (net mask) (defun string-ipnet (str &key (start 0) (end nil)) "Parse an IP-network from the string STR." (setf str (stringify str)) - (unless end (setf end (length str))) + (setf-default end (length str)) (let ((sl (position #\/ str :start start :end end))) (if sl (make-ipnet (parse-ipaddr (subseq str start sl)) diff --git a/zone b/zone index de68201..8befb1d 100755 --- a/zone +++ b/zone @@ -1,6 +1,5 @@ #! /usr/local/bin/runlisp ;;; -*-lisp-*- -(clc:clc-require "mdw") (clc:clc-require "zone") (zone.frontend:main) diff --git a/zone.lisp b/zone.lisp index 37e7499..adcfb7e 100644 --- a/zone.lisp +++ b/zone.lisp @@ -513,7 +513,7 @@ (defsubp (gensym "DEFSUBP"))) (setf types (listify types)) (let* ((type (car types)) (func (intern (format nil "ZONE-PARSE/~:@(~A~)" type)))) - (multiple-value-bind (doc decls body) (parse-body body) + (with-parsed-body (doc decls body body) (with-gensyms (col tname ttype tttl tdata tdefsubp i) `(progn (dolist (,i ',types)