summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac5
-rw-r--r--doc/contributing.texi2
-rw-r--r--guix/serialization.scm15
3 files changed, 6 insertions, 16 deletions
diff --git a/configure.ac b/configure.ac
index 80d8e025b83..f72ca2f54c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
2# Process this file with autoconf to produce a configure script. 2# Process this file with autoconf to produce a configure script.
3# 3#
4# GNU Guix --- Functional package management for GNU 4# GNU Guix --- Functional package management for GNU
5# Copyright © 2012-2021, 2022-2023 Ludovic Courtès <ludo@gnu.org> 5# Copyright © 2012-2021, 2022-2023, 2025 Ludovic Courtès <ludo@gnu.org>
6# Copyright © 2013, 2016 Mark H Weaver <mhw@netris.org> 6# Copyright © 2013, 2016 Mark H Weaver <mhw@netris.org>
7# Copyright © 2014-2016 Alex Kost <alezost@gmail.com> 7# Copyright © 2014-2016 Alex Kost <alezost@gmail.com>
8# Copyright © 2014-2016 David Thompson <davet@gnu.org> 8# Copyright © 2014-2016 David Thompson <davet@gnu.org>
@@ -130,7 +130,8 @@ if test "x$GUILD" = "x"; then
130fi 130fi
131 131
132dnl (guix ui), notably, requires 'default-optimization-level' added in 3.0.3. 132dnl (guix ui), notably, requires 'default-optimization-level' added in 3.0.3.
133PKG_CHECK_MODULES([GUILE], [guile-3.0 >= 3.0.3]) 133dnl (guix serialization) requires 'bytevector-slice' added in 3.0.9.
134PKG_CHECK_MODULES([GUILE], [guile-3.0 >= 3.0.9])
134 135
135dnl Get CFLAGS and LDFLAGS for libguile. 136dnl Get CFLAGS and LDFLAGS for libguile.
136GUILE_FLAGS 137GUILE_FLAGS
diff --git a/doc/contributing.texi b/doc/contributing.texi
index c0a426db8af..06b4883baa2 100644
--- a/doc/contributing.texi
+++ b/doc/contributing.texi
@@ -66,7 +66,7 @@ GNU Guix depends on the following packages:
66 66
67@itemize 67@itemize
68@item @url{https://gnu.org/software/guile/, GNU Guile}, version 3.0.x, 68@item @url{https://gnu.org/software/guile/, GNU Guile}, version 3.0.x,
69version 3.0.3 or later; 69version 3.0.9 or later;
70@item @url{https://notabug.org/cwebber/guile-gcrypt, Guile-Gcrypt}, version 70@item @url{https://notabug.org/cwebber/guile-gcrypt, Guile-Gcrypt}, version
710.1.0 or later; 710.1.0 or later;
72@item 72@item
diff --git a/guix/serialization.scm b/guix/serialization.scm
index dfeb7a9bf1e..0be97e4ff2c 100644
--- a/guix/serialization.scm
+++ b/guix/serialization.scm
@@ -20,6 +20,7 @@
20 #:autoload (guix base16) (base16-string->bytevector 20 #:autoload (guix base16) (base16-string->bytevector
21 bytevector->base16-string) 21 bytevector->base16-string)
22 #:use-module (rnrs bytevectors) 22 #:use-module (rnrs bytevectors)
23 #:autoload (rnrs bytevectors gnu) (bytevector-slice)
23 #:use-module (srfi srfi-1) 24 #:use-module (srfi srfi-1)
24 #:use-module (srfi srfi-9) 25 #:use-module (srfi srfi-9)
25 #:use-module (srfi srfi-26) 26 #:use-module (srfi srfi-26)
@@ -29,7 +30,6 @@
29 #:use-module ((ice-9 rdelim) #:prefix rdelim:) 30 #:use-module ((ice-9 rdelim) #:prefix rdelim:)
30 #:use-module (ice-9 match) 31 #:use-module (ice-9 match)
31 #:use-module (ice-9 ftw) 32 #:use-module (ice-9 ftw)
32 #:use-module (system foreign)
33 #:export (write-value 33 #:export (write-value
34 read-value 34 read-value
35 write-bytevector 35 write-bytevector
@@ -106,17 +106,6 @@
106 (port port))))) 106 (port port)))))
107 bv)) 107 bv))
108 108
109(define (sub-bytevector bv len)
110 "Return a bytevector that aliases the first LEN bytes of BV."
111 (define max (bytevector-length bv))
112 (cond ((= len max) bv)
113 ((< len max)
114 ;; Yes, this is safe because the result of each conversion procedure
115 ;; has its life cycle synchronized with that of its argument.
116 (pointer->bytevector (bytevector->pointer bv) len))
117 (else
118 (error "sub-bytevector called to get a super bytevector"))))
119
120(define (write-int n p) 109(define (write-int n p)
121 (let ((b (make-bytevector 8 0))) 110 (let ((b (make-bytevector 8 0)))
122 (bytevector-u32-set! b 0 n (endianness little)) 111 (bytevector-u32-set! b 0 n (endianness little))
@@ -164,7 +153,7 @@
164 (m (modulo len 8)) 153 (m (modulo len 8))
165 (pad (if (zero? m) 0 (- 8 m))) 154 (pad (if (zero? m) 0 (- 8 m)))
166 (bv (get-bytevector-n* p (+ len pad)))) 155 (bv (get-bytevector-n* p (+ len pad))))
167 (sub-bytevector bv len))) 156 (bytevector-slice bv 0 len)))
168 157
169(define (read-string p) 158(define (read-string p)
170 (utf8->string (read-byte-string p))) 159 (utf8->string (read-byte-string p)))