pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:673:    if(v->size-index>1)    {    memmove(ITEM(v)+index, ITEM(v)+index+1,    (v->size-index-1)*sizeof(struct svalue));    }    v->size--;    return v;    }   }    - static ptrdiff_t fast_array_search( struct array *v, struct svalue *s, ptrdiff_t start ) + static ptrdiff_t fast_array_search( struct array *v, const struct svalue *s, +  ptrdiff_t start )   {    ptrdiff_t e;    struct svalue *ip = ITEM(v);    for(e=start;e<v->size;e++)    if(is_eq(ip+e,s))    return e;    return -1;   }      /**    * Search for in svalue in an array.    * @param v the array to search    * @param s the value to search for    * @param start the index to start search at    * @return the index if found, -1 otherwise    */ - PMOD_EXPORT ptrdiff_t array_search(struct array *v, struct svalue *s, + PMOD_EXPORT ptrdiff_t array_search(struct array *v, const struct svalue *s,    ptrdiff_t start)   {   #ifdef PIKE_DEBUG    if(start<0)    Pike_fatal("Start of find_index is less than zero.\n");   #endif   #ifdef PIKE_DEBUG    if(d_flag > 1) array_check_type_field(v);   #endif -  check_destructed(s); +  safe_check_destructed(s);       /* Why search for something that is not there?    * however, we must explicitly check for searches    * for destructed objects/functions    */    if((v->type_field & (1 << TYPEOF(*s))) ||    (UNSAFE_IS_ZERO(s) && (v->type_field & (BIT_FUNCTION|BIT_OBJECT))) ||    ( (v->type_field | (1<<TYPEOF(*s))) & BIT_OBJECT )) /* for overloading */    return fast_array_search( v, s, start );    return -1;