guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/03: syscalls: C struct writer correctly handles pointer fields.


From: Ludovic Courtès
Subject: 01/03: syscalls: C struct writer correctly handles pointer fields.
Date: Wed, 16 Nov 2016 22:38:48 +0000 (UTC)

civodul pushed a commit to branch master
in repository guix.

commit f43714e62080f8bdf1ddb02672d26527ac3819ec
Author: Ludovic Courtès <address@hidden>
Date:   Wed Nov 16 23:12:14 2016 +0100

    syscalls: C struct writer correctly handles pointer fields.
    
    * guix/build/syscalls.scm (write-type): Add case for '*.
---
 guix/build/syscalls.scm |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 2cee654..bdc9940 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -202,7 +202,7 @@ result is the alignment of the \"most strictly aligned 
component\"."
                   types ...))))
 
 (define-syntax write-type
-  (syntax-rules (~ array)
+  (syntax-rules (~ array *)
     ((_ bv offset (type ~ order) value)
      (bytevector-uint-set! bv offset value
                            (endianness order) (sizeof* type)))
@@ -215,6 +215,9 @@ result is the alignment of the \"most strictly aligned 
component\"."
            ((head . tail)
             (write-type bv o type head)
             (loop (+ 1 i) tail (+ o (sizeof* type))))))))
+    ((_ bv offset '* value)
+     (bytevector-uint-set! bv offset (pointer-address value)
+                           (native-endianness) (sizeof* '*)))
     ((_ bv offset type value)
      (bytevector-uint-set! bv offset value
                            (native-endianness) (sizeof* type)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]