Пример #1
0
void gpy_vec_push (gpy_vector_t * const v, void * const s)
{
  if (s)
    {
      if (v->length >= v->size)
	{
	  signed long size = gpy_threshold_alloc (v->size);
	  v->vector = (void**) gpy_realloc (v->vector, size * sizeof (void *));
	  v->size = size;
	}
      v->vector[v->length] = s;
      v->length++;
    }
}
Пример #2
0
static
gpy_object_t * gpy_obj_list_append (gpy_object_t * self,
				    gpy_object_t ** args)
{
  gpy_assert (self->T == TYPE_OBJECT_STATE);
  gpy_object_state_t * x = self->o.object_state;
  struct gpy_object_list * state = (struct gpy_object_list *)
    x->state;

  gpy_object_t * append = *args;
  gpy_assert (append);

  if (state->length >= state->size)
    {
      signed long size = gpy_threshold_alloc (state->size);
      state->vector = (gpy_object_t **)
	gpy_realloc (state->vector, size * sizeof (gpy_object_t *));
      state->size = size;
    }
  state->vector [state->length] = append;
  state->length++;

  return NULL;
}