diff --git a/src/program.c b/src/program.c index e318773340afbca87312d95aa831280784d6898b..72c749192f62fa183d19d5ba987fa88496961796 100644 --- a/src/program.c +++ b/src/program.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: program.c,v 1.198 2000/01/13 23:21:22 grubba Exp $"); +RCSID("$Id: program.c,v 1.199 2000/01/16 00:32:50 hubbe Exp $"); #include "program.h" #include "object.h" #include "dynamic_buffer.h" @@ -2378,7 +2378,42 @@ INT32 define_function(struct pike_string *name, ref.inherit_offset = 0; ref.id_flags = flags; +#if 0 new_program->identifier_references[i]=ref; +#else + { + int z; + /* This loop could possibly be optimized by looping over + * each inherit and looking up 'name' in each inherit + * and then see if should be overwritten + * /Hubbe + */ + + for(z=0;z<new_program->num_identifier_references;z++) + { + /* Do zapp hidden identifiers */ + if(new_program->identifier_references[z].id_flags & ID_HIDDEN) + continue; + + /* Do not zapp inline ('local') identifiers */ + if(new_program->identifier_references[z].inherit_offset && + (new_program->identifier_references[z].id_flags & ID_INLINE)) + continue; + + /* Do not zapp functions with the wrong name... */ + if(ID_FROM_INT(new_program, z)->name != name) + continue; + + new_program->identifier_references[z]=ref; + } + +#ifdef PIKE_DEBUG + if(MEMCMP(new_program->identifier_references+i, &ref,sizeof(ref))) + fatal("New function overloading algorithm failed!\n"); +#endif + + } +#endif return i; } make_a_new_def: