chiark
/
gitweb
/
~mdw
/
clg
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0a6a9cf
)
Broken make-glist and glist copy function fixed
author
espen
<espen>
Tue, 1 Apr 2008 21:17:59 +0000
(21:17 +0000)
committer
espen
<espen>
Tue, 1 Apr 2008 21:17:59 +0000
(21:17 +0000)
glib/glib.lisp
patch
|
blob
|
blame
|
history
diff --git
a/glib/glib.lisp
b/glib/glib.lisp
index 870f1be1bca6e5bf7c31885017540cef248858c6..c89eab14aee2d99528b2aaf92e5fc1d43e964db7 100644
(file)
--- a/
glib/glib.lisp
+++ b/
glib/glib.lisp
@@
-20,7
+20,7
@@
;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-;; $Id: glib.lisp,v 1.4
2 2007/10/17 14:30:41
espen Exp $
+;; $Id: glib.lisp,v 1.4
3 2008/04/01 21:17:59
espen Exp $
(in-package "GLIB")
(in-package "GLIB")
@@
-152,19
+152,22
@@
(defbinding quark-to-string () (static string)
(deftype glist (type)
`(or null (cons ,type list)))
(deftype glist (type)
`(or null (cons ,type list)))
-(defbinding (%glist-
append "g_list_ap
pend") () pointer
+(defbinding (%glist-
prepend "g_list_pre
pend") () pointer
(glist (or null pointer))
(nil null))
(glist (or null pointer))
(nil null))
+(defbinding (%glist-reverse "g_list_reverse") () pointer
+ (glist (or null pointer)))
+
(defun make-glist (element-type list &optional temp-p)
(let ((writer (if (functionp element-type)
element-type
(writer-function element-type :temp temp-p))))
(loop
for element in list
(defun make-glist (element-type list &optional temp-p)
(let ((writer (if (functionp element-type)
element-type
(writer-function element-type :temp temp-p))))
(loop
for element in list
- as glist = (%glist-
append nil) then (%glist-ap
pend glist)
+ as glist = (%glist-
prepend nil) then (%glist-pre
pend glist)
do (funcall writer element glist)
do (funcall writer element glist)
- finally (return
glist
))))
+ finally (return
(%glist-reverse glist)
))))
(defun glist-next (glist)
(unless (null-pointer-p glist)
(defun glist-next (glist)
(unless (null-pointer-p glist)
@@
-324,12
+327,11
@@
(define-type-method copy-function ((type glist) &key inlined)
#'(lambda (from to &optional (offset 0))
(unless (null-pointer-p (ref-pointer from offset))
(loop
#'(lambda (from to &optional (offset 0))
(unless (null-pointer-p (ref-pointer from offset))
(loop
- as from-list = (ref-pointer from offset)
- then (glist-next from-list)
- as to-list = (setf (ref-pointer to offset) (%glist-append nil))
- then (%glist-append to-list)
+ as from-list = (ref-pointer from offset) then (glist-next from-list)
+ as to-list = (%glist-prepend nil) then (%glist-prepend to-list)
do (funcall copy-element from-list to-list)
do (funcall copy-element from-list to-list)
- while (glist-next from-lisT)))))))
+ while (glist-next from-list)
+ finally (setf (ref-pointer to offset) (%glist-reverse to-list))))))))
;;;; Single linked list (GSList)
;;;; Single linked list (GSList)