1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-18 01:30:27 +02:00

fix bug in generalized-vector->list

* libguile/generalized-vectors.c (scm_generalized_vector_to_list): Fix
  bug iterating over indices of array. Thanks to Tristan Colgate for the
  report.

* test-suite/tests/srfi-4.test: Add tests that uniform-vector->list
  works for all kinds of uniform vectors.
This commit is contained in:
Andy Wingo 2010-01-03 12:36:37 +01:00
parent edb7bb4766
commit 09834e439b
2 changed files with 54 additions and 15 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1995,1996,1997,1998,2000,2001,2002,2003,2004, 2005, 2006, 2009 Free Software Foundation, Inc.
/* Copyright (C) 1995,1996,1997,1998,2000,2001,2002,2003,2004, 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@ -178,10 +178,9 @@ SCM_DEFINE (scm_generalized_vector_to_list, "generalized-vector->list", 1, 0, 0,
ssize_t pos, i = 0;
scm_t_array_handle h;
scm_generalized_vector_get_handle (v, &h);
/* FIXME CHECKME */
for (pos = h.dims[0].ubnd, i = (h.dims[0].ubnd - h.dims[0].lbnd + 1);
for (pos = h.dims[0].ubnd, i = (h.dims[0].ubnd - h.dims[0].lbnd);
i >= 0;
pos += h.dims[0].inc)
pos -= h.dims[0].inc, i--)
ret = scm_cons (h.impl->vref (&h, pos), ret);
scm_array_handle_release (&h);
return ret;