1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Deprecate the use of the vector interface on arrays

* libguile/vectors.c (scm_is_vector): Deprecate use on weak vectors and
  arrays.
  (scm_is_simple_vector): Deprecate use on weak vectors.
  (scm_vector_length, scm_c_vector_ref, scm_c_vector_set_x): Deprecate
  use on arrays.

* libguile/sort.c: Adapt to check explicitly for arrays.
This commit is contained in:
Andy Wingo 2014-02-08 16:13:54 +01:00
parent 5cfeff11cc
commit 24cac65540
2 changed files with 50 additions and 15 deletions

View file

@ -1,5 +1,5 @@
/* Copyright (C) 1999, 2000, 2001, 2002, 2004, 2006, 2007, 2008, 2009,
* 2010, 2011, 2012 Free Software Foundation, Inc.
* 2010, 2011, 2012, 2014 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
@ -377,12 +377,13 @@ SCM_DEFINE (scm_sort_x, "sort!", 2, 0, 0,
SCM_VALIDATE_LIST_COPYLEN (1, items, len);
return scm_merge_list_step (&items, less, len);
}
else if (scm_is_vector (items))
else if (scm_is_simple_vector (items)
|| (scm_is_array (items) && scm_c_array_rank (items) == 1))
{
scm_restricted_vector_sort_x (items,
less,
scm_from_int (0),
scm_vector_length (items));
scm_array_length (items));
return items;
}
else
@ -403,7 +404,8 @@ SCM_DEFINE (scm_sort, "sort", 2, 0, 0,
if (scm_is_pair (items))
return scm_sort_x (scm_list_copy (items), less);
else if (scm_is_vector (items))
else if (scm_is_simple_vector (items)
|| (scm_is_array (items) && scm_c_array_rank (items) == 1))
return scm_sort_x (scm_vector_copy (items), less);
else
SCM_WRONG_TYPE_ARG (1, items);
@ -489,7 +491,8 @@ SCM_DEFINE (scm_stable_sort_x, "stable-sort!", 2, 0, 0,
SCM_VALIDATE_LIST_COPYLEN (1, items, len);
return scm_merge_list_step (&items, less, len);
}
else if (scm_is_vector (items))
else if (scm_is_simple_vector (items)
|| (scm_is_array (items) && scm_c_array_rank (items) == 1))
{
scm_t_array_handle temp_handle, vec_handle;
SCM temp, *temp_elts, *vec_elts;
@ -532,7 +535,8 @@ SCM_DEFINE (scm_stable_sort, "stable-sort", 2, 0, 0,
if (scm_is_pair (items))
return scm_stable_sort_x (scm_list_copy (items), less);
else if (scm_is_vector (items))
else if (scm_is_simple_vector (items)
|| (scm_is_array (items) && scm_c_array_rank (items) == 1))
return scm_stable_sort_x (scm_vector_copy (items), less);
else
SCM_WRONG_TYPE_ARG (1, items);