Skip to content

Commit

Permalink
Checking null pointer during pointer sync
Browse files Browse the repository at this point in the history
  • Loading branch information
ktakashi committed Dec 13, 2018
1 parent 6f29404 commit ee15a74
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pffi/compat.larceny.sls
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
;;;
;;; src/pffi/compat.larceny.sls - Compatible layer for Larceny
;;;
;;; Copyright (c) 2015 Takashi Kato <[email protected]>
;;; Copyright (c) 2015-2018 Takashi Kato <[email protected]>
;;;
;;; Redistribution and use in source and binary forms, with or without
;;; modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -165,6 +165,8 @@
dummy
;; element pointer of above
(immutable ptr pointer-ptr)))
(define (null-pointer? pointer) (zero? (pointer->integer pointer)))

(define (void*->pointer v*)
(let ((bv (make-bytevector size-of-pointer)))
(if (= size-of-pointer 4)
Expand Down Expand Up @@ -201,7 +203,7 @@
o))

(define (sync-pointer arg)
(if (pointer? arg)
(if (and (pointer? arg) (not (null-pointer? arg)))
(let* ((dst (pointer-src arg))
(len (bytevector-length dst)))
(do ((i 0 (+ i 1)))
Expand Down

0 comments on commit ee15a74

Please sign in to comment.