-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Checking null pointer during pointer sync
- Loading branch information
Showing
1 changed file
with
4 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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) | ||
|
@@ -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))) | ||
|