On Fri, 2016-10-21 at 15:06 +1100, Timothy Arceri wrote: > On Thu, 2016-10-20 at 12:39 +0200, Samuel Iglesias Gonsálvez wrote: > > > > This function allows to modify an existing symbol. > > > > Signed-off-by: Samuel Iglesias Gonsálvez <sigles...@igalia.com> > > --- > > src/mesa/program/symbol_table.c | 35 > > +++++++++++++++++++++++++++++++++++ > > src/mesa/program/symbol_table.h | 3 +++ > > 2 files changed, 38 insertions(+) > > > > diff --git a/src/mesa/program/symbol_table.c > > b/src/mesa/program/symbol_table.c > > index 3e58432..4f6ccf4 100644 > > --- a/src/mesa/program/symbol_table.c > > +++ b/src/mesa/program/symbol_table.c > > @@ -313,6 +313,41 @@ _mesa_symbol_table_add_symbol(struct > > _mesa_symbol_table *table, > > return 0; > > } > > > > +int > > +_mesa_symbol_table_replace_symbol(struct _mesa_symbol_table > > *table, > > + int name_space, const char > > *name, > > + void *declaration) > > +{ > > + struct symbol_header *hdr; > > + struct symbol *tmp; > > + struct symbol *sym = NULL; > > There is no longer a need to declare these at the top of the function > in core mesa as everyone is using C99ish compilers these days. > > > > > + > > + check_symbol_table(table); > > + > > + hdr = find_symbol(table, name); > > + > > + check_symbol_table(table); > > + > > + if (hdr == NULL) > > + return -1; > > + > > + /* If the symbol doesn't exist in this namespace at this > > scope, > > it cannot > > + * be replaced. > > + */ > > + for (tmp = hdr->symbols ; tmp != NULL ; tmp = tmp- > > > > > > next_with_same_name) {
I think we can just get rid of namespace support from the symbol table. I'm running Jenkins on a patch for this now. I'll Cc you it everything passes. > > Please remove the spaces before ; > > > > > + if (tmp->name_space == name_space) { > > + sym = tmp; > > + break; > > + } > > + } > > + > > + if (sym == NULL) > > + return -1; > > + > > + sym->data = declaration; > > + check_symbol_table(table); > > + return 0; > > +} > > > > int > > _mesa_symbol_table_add_global_symbol(struct _mesa_symbol_table > > *table, > > diff --git a/src/mesa/program/symbol_table.h > > b/src/mesa/program/symbol_table.h > > index 1027f47..33a5bab 100644 > > --- a/src/mesa/program/symbol_table.h > > +++ b/src/mesa/program/symbol_table.h > > @@ -32,6 +32,9 @@ extern void _mesa_symbol_table_pop_scope(struct > > _mesa_symbol_table *table); > > extern int _mesa_symbol_table_add_symbol(struct _mesa_symbol_table > > *symtab, > > int name_space, const char *name, void *declaration); > > > > +extern int _mesa_symbol_table_replace_symbol(struct > > _mesa_symbol_table *table, > > + int name_space, const char *name, void *declaration); > > + > > extern int _mesa_symbol_table_add_global_symbol( > > struct _mesa_symbol_table *symtab, int name_space, const char > > *name, > > void *declaration); > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev