Simplify scm_array_get_handle for tc7-arrays
authorAndy Wingo <wingo@pobox.com>
Sun, 9 Feb 2014 19:56:55 +0000 (20:56 +0100)
committerAndy Wingo <wingo@pobox.com>
Sun, 9 Feb 2014 19:58:16 +0000 (20:58 +0100)
* libguile/array-handle.c (scm_array_get_handle): Simplify for the array
  case, as suggested by Daniel Llorens.

libguile/array-handle.c

index 84e9f88..2252ecc 100644 (file)
@@ -231,21 +231,11 @@ scm_array_get_handle (SCM array, scm_t_array_handle *h)
       }
       break;
     case scm_tc7_array:
+      scm_array_get_handle (SCM_I_ARRAY_V (array), h);
+      h->array = array;
       h->base = SCM_I_ARRAY_BASE (array);
       h->ndims = SCM_I_ARRAY_NDIM (array);
       h->dims = SCM_I_ARRAY_DIMS (array);
-      {
-        scm_t_array_handle vh;
-
-        scm_array_get_handle (SCM_I_ARRAY_V (array), &vh);
-        h->element_type = vh.element_type;
-        h->elements = vh.elements;
-        h->writable_elements = vh.writable_elements;
-        h->vector = vh.vector;
-        h->vref = vh.vref;
-        h->vset = vh.vset;
-        scm_array_handle_release (&vh);
-      }
       break;
     default:
       scm_wrong_type_arg_msg (NULL, 0, array, "array");