pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:169:   /**    * Decrement the references (and free if unused) an array if it is not null.    */   PMOD_EXPORT void do_free_array(struct array *a)   {    if (a)    free_array(a);   }      /** +  * Free all elements in an array and set them to zero. +  */ + PMOD_EXPORT void clear_array(struct array *a) + { +  if (!a->size) return; +  free_svalues(ITEM(a), a->size, a->type_field); +  /* NB: We know that INT_T == 0. */ +  MEMSET(ITEM(a), 0, a->size * sizeof(struct svalue)); +  a->type_field = BIT_INT; + } +  + /**    * Set the flags on an array. If the array is empty then only the    * weak flag is significant.    */   PMOD_EXPORT struct array *array_set_flags(struct array *a, int flags)   {    if (a->size)    a->flags = flags;    else {    free_array(a);    if (flags & ARRAY_WEAK_FLAG)