mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
mesa/program: Add _mesa_symbol_table_replace_symbol()
This function allows to modify an existing symbol. v2: - Remove namespace usage now that it was deleted. Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
This commit is contained in:
parent
2e423ca147
commit
dfbdb2c0b3
2 changed files with 18 additions and 0 deletions
|
|
@ -211,6 +211,20 @@ _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *table,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_mesa_symbol_table_replace_symbol(struct _mesa_symbol_table *table,
|
||||
const char *name,
|
||||
void *declaration)
|
||||
{
|
||||
struct symbol *sym = find_symbol(table, name);
|
||||
|
||||
/* If the symbol doesn't exist, it cannot be replaced. */
|
||||
if (sym == NULL)
|
||||
return -1;
|
||||
|
||||
sym->data = declaration;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_mesa_symbol_table_add_global_symbol(struct _mesa_symbol_table *table,
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@ extern void _mesa_symbol_table_pop_scope(struct _mesa_symbol_table *table);
|
|||
extern int _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *symtab,
|
||||
const char *name, void *declaration);
|
||||
|
||||
extern int _mesa_symbol_table_replace_symbol(struct _mesa_symbol_table *table,
|
||||
const char *name,
|
||||
void *declaration);
|
||||
|
||||
extern int
|
||||
_mesa_symbol_table_add_global_symbol(struct _mesa_symbol_table *symtab,
|
||||
const char *name,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue