[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet-scheme] 120/324: netstruct syntactic: Fix error when field is co
From: |
gnunet |
Subject: |
[gnunet-scheme] 120/324: netstruct syntactic: Fix error when field is constant. |
Date: |
Tue, 21 Sep 2021 13:22:40 +0200 |
This is an automated email from the git hooks/post-receive script.
maxime-devos pushed a commit to branch master
in repository gnunet-scheme.
commit f7b4ce0889d4c7cbacd6649717d8c6568f4d3cd9
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Sat May 29 19:31:24 2021 +0200
netstruct syntactic: Fix error when field is constant.
Previously, the code tried to look up fields named
(static . the-field). Let's fix resulting errors during
expansion.
* gnu/gnunet/netstruct/syntactic.scm
(offset+sizeof/partial-tree): Remove 'static from the leading
static (constant) fields.
* tests/netstruct.scm
("total size (syntactic, constant, one field)")
("field size (syntactic, constant, one field)"): Add two tests
that detect the bug.
---
gnu/gnunet/netstruct/syntactic.scm | 9 ++++++---
tests/netstruct.scm | 14 +++++++++++++-
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/gnu/gnunet/netstruct/syntactic.scm
b/gnu/gnunet/netstruct/syntactic.scm
index 85120a5..57366ac 100644
--- a/gnu/gnunet/netstruct/syntactic.scm
+++ b/gnu/gnunet/netstruct/syntactic.scm
@@ -198,11 +198,14 @@ syntax"
(eq? (car field) 'static))
(receive (static partially-dynamic)
(span static? fields)
- (let ((off (p@offsetof ns static))
- (p (p@part ns static)))
+ ;; Remove the @code{static} symbol from the car,
+ ;; leaving only the field names in @var{static}.
+ (let* ((static* (map cdr fields))
+ (off (p@offsetof ns static*))
+ (p (p@part ns static*)))
(if (null? partially-dynamic)
(values (datum->syntax s off)
- (datum->syntax s (p@sizeof ns static))
+ (datum->syntax s (p@sizeof ns static*))
#'#t
#f
ns)
diff --git a/tests/netstruct.scm b/tests/netstruct.scm
index 5a2bca8..d4edeaf 100644
--- a/tests/netstruct.scm
+++ b/tests/netstruct.scm
@@ -16,7 +16,8 @@
;;
;; SPDX-License-Identifier: AGPL3.0-or-later
(import (srfi srfi-26)
- (gnu gnunet netstruct procedural))
+ (gnu gnunet netstruct procedural)
+ (prefix (gnu gnunet netstruct syntactic) s:))
(test-begin "netstruct procedural")
@@ -29,3 +30,14 @@
(offsetof struct/a '(field)))
(test-end "netstruct procedural")
+(test-begin "nestruct syntactic")
+
+(test-eqv "total size (syntactic, constant, one field)"
+ 1 (eval '(s:sizeof struct/a '())
+ (current-module)))
+
+(test-eqv "field size (syntactic, constant, one field)"
+ 1 (eval '(s:sizeof struct/a '(field))
+ (current-module)))
+
+(test-end "nestruct syntactic")
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet-scheme] 88/324: mq: Move message queue modules to (gnu gnunet mq SOMETHING)., (continued)
- [gnunet-scheme] 88/324: mq: Move message queue modules to (gnu gnunet mq SOMETHING)., gnunet, 2021/09/21
- [gnunet-scheme] 101/324: utils: hat-let: Add <--, a variant on <-., gnunet, 2021/09/21
- [gnunet-scheme] 89/324: doc: Document current list of defined GNUnet network structures., gnunet, 2021/09/21
- [gnunet-scheme] 94/324: bv-slice: Correct offset calculation in slice-slice., gnunet, 2021/09/21
- [gnunet-scheme] 98/324: utils: Define module for defining platform-specifing enumerations., gnunet, 2021/09/21
- [gnunet-scheme] 95/324: util: Allow splitting and constructing ancillary messages., gnunet, 2021/09/21
- [gnunet-scheme] 103/324: config: parser: parse ${variable} expansions., gnunet, 2021/09/21
- [gnunet-scheme] 105/324: config: value-parser: Parse values in configuration files., gnunet, 2021/09/21
- [gnunet-scheme] 107/324: tests: message-io: Unbreak., gnunet, 2021/09/21
- [gnunet-scheme] 106/324: doc: Classify modules., gnunet, 2021/09/21
- [gnunet-scheme] 120/324: netstruct syntactic: Fix error when field is constant.,
gnunet <=
- [gnunet-scheme] 121/324: netstruct: Correct argument order to slice-uN-set!., gnunet, 2021/09/21
- [gnunet-scheme] 113/324: hat-let: Avoid having to import '_' from (rnrs base)., gnunet, 2021/09/21
- [gnunet-scheme] 112/324: config: parser: Fix typo in documentation., gnunet, 2021/09/21
- [gnunet-scheme] 93/324: doc: Some tips on testing., gnunet, 2021/09/21
- [gnunet-scheme] 104/324: config: Implement variable expansion., gnunet, 2021/09/21
- [gnunet-scheme] 129/324: netstruct: New promised tests., gnunet, 2021/09/21
- [gnunet-scheme] 99/324: config: Parse configuration lines into one of several types., gnunet, 2021/09/21
- [gnunet-scheme] 115/324: hat-let: Drop incorrect copyright notices., gnunet, 2021/09/21
- [gnunet-scheme] 125/324: netstruct: Only select the relevant part for writing., gnunet, 2021/09/21
- [gnunet-scheme] 127/324: netstruct: Recurse in ‘part’; allow fields within fields., gnunet, 2021/09/21