diff --git a/src/array.c b/src/array.c index 756357d5f050870d4cdf5712fb205d49d6568813..9fa73e40785ff722d26def055483ac5b89a727d1 100644 --- a/src/array.c +++ b/src/array.c @@ -381,21 +381,24 @@ INT32 array_search(struct array *v, struct svalue *s,INT32 start) /* Why search for something that is not there? */ #ifdef DEBUG - if(d_flag > 1) array_check_type_field(v); + if(d_flag > 1) array_check_type_field(v); #endif - if(v->type_field & (1 << s->type)) { - TYPE_FIELD t=0; - for(e=start;e<v->size;e++) + if(start) { - if(is_eq(ITEM(v)+e,s)) return e; - t |= 1<<ITEM(v)[e].type; + for(e=start;e<v->size;e++) + if(is_eq(ITEM(v)+e,s)) return e; + }else{ + TYPE_FIELD t=0; + for(e=0;e<v->size;e++) + { + if(is_eq(ITEM(v)+e,s)) return e; + t |= 1<<ITEM(v)[e].type; + } + v->type_field=t; } - v->type_field=t; - return -1; } - return -1; } diff --git a/src/language.yacc b/src/language.yacc index 74aab449beaa5d4e1518cc944a85f869d023fed3..a9e7a33ba292f45acf18421f47210fb1d60f1b65 100644 --- a/src/language.yacc +++ b/src/language.yacc @@ -156,7 +156,7 @@ /* This is the grammar definition of Pike. */ #include "global.h" -RCSID("$Id: language.yacc,v 1.42 1997/05/07 06:25:35 per Exp $"); +RCSID("$Id: language.yacc,v 1.43 1997/06/07 01:16:26 hubbe Exp $"); #ifdef HAVE_MEMORY_H #include <memory.h> #endif @@ -1297,7 +1297,12 @@ typeof: F_TYPEOF '(' expr0 ')' { node *tmp; tmp=mknode(F_ARG_LIST,$3,0); - $$=mkstrnode(describe_type($3->type)); + if($3 && $3->type) + { + $$=mkstrnode(describe_type($3->type)); + }else{ + $$=mkstrnode(describe_type(mixed_type_string)); + } free_node(tmp); } ;