[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.6-30-g226a56
From: |
Mark H Weaver |
Subject: |
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.6-30-g226a56a |
Date: |
Sat, 06 Oct 2012 10:19:45 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=226a56a3d454b18b2b57c4489fdb8efbf4cd8332
The branch, stable-2.0 has been updated
via 226a56a3d454b18b2b57c4489fdb8efbf4cd8332 (commit)
from 88644a10d82045f429f66f20a47973e48715de1d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 226a56a3d454b18b2b57c4489fdb8efbf4cd8332
Author: Mark H Weaver <address@hidden>
Date: Sat Oct 6 06:04:29 2012 -0400
Improve error reporting in 'append!'
* libguile/list.c (scm_append_x): Report correct argument number when
validating arguments. Validate that the last cdr of each argument is
null or nil. Rename formal rest argument from 'lists' to 'args'.
* test-suite/tests/list.test (append!): Update tests to expect correct
handling of improper lists.
-----------------------------------------------------------------------
Summary of changes:
libguile/list.c | 17 ++++++++++-------
test-suite/tests/list.test | 6 +++---
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/libguile/list.c b/libguile/list.c
index 221ee79..6c8f8be 100644
--- a/libguile/list.c
+++ b/libguile/list.c
@@ -267,7 +267,7 @@ SCM_DEFINE (scm_append, "append", 0, 0, 1,
SCM_DEFINE (scm_append_x, "append!", 0, 0, 1,
- (SCM lists),
+ (SCM args),
"A destructive version of @code{append} (@pxref{Pairs and\n"
"Lists,,,r5rs, The Revised^5 Report on Scheme}). The cdr field\n"
"of each list's final pair is changed to point to the head of\n"
@@ -276,26 +276,29 @@ SCM_DEFINE (scm_append_x, "append!", 0, 0, 1,
#define FUNC_NAME s_scm_append_x
{
SCM ret, *loc;
- SCM_VALIDATE_REST_ARGUMENT (lists);
+ int argnum = 1;
+ SCM_VALIDATE_REST_ARGUMENT (args);
- if (scm_is_null (lists))
+ if (scm_is_null (args))
return SCM_EOL;
loc = &ret;
for (;;)
{
- SCM arg = SCM_CAR (lists);
+ SCM arg = SCM_CAR (args);
*loc = arg;
- lists = SCM_CDR (lists);
- if (scm_is_null (lists))
+ args = SCM_CDR (args);
+ if (scm_is_null (args))
return ret;
if (!SCM_NULL_OR_NIL_P (arg))
{
- SCM_VALIDATE_CONS (SCM_ARG1, arg);
+ SCM_VALIDATE_CONS (argnum, arg);
loc = SCM_CDRLOC (scm_last_pair (arg));
+ SCM_VALIDATE_NULL_OR_NIL (argnum, *loc);
}
+ argnum++;
}
}
#undef FUNC_NAME
diff --git a/test-suite/tests/list.test b/test-suite/tests/list.test
index dc06f07..ff31c86 100644
--- a/test-suite/tests/list.test
+++ b/test-suite/tests/list.test
@@ -439,15 +439,15 @@
(with-test-prefix "wrong argument"
- (expect-fail-exception "improper list and empty list"
+ (pass-if-exception "improper list and empty list"
exception:wrong-type-arg
(append! (cons 1 2) '()))
- (expect-fail-exception "improper list and list"
+ (pass-if-exception "improper list and list"
exception:wrong-type-arg
(append! (cons 1 2) (list 3 4)))
- (expect-fail-exception "list, improper list and list"
+ (pass-if-exception "list, improper list and list"
exception:wrong-type-arg
(append! (list 1 2) (cons 3 4) (list 5 6)))
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.6-30-g226a56a,
Mark H Weaver <=