parse/stab.c
/*
 * Sets the namespace of a symbol table, and
 * changes the namespace of all contained symbols
 * to match it.
 */
Sets the namespace of a symbol table, and
changes the namespace of all contained symbols
to match it.
Sets the namespace of a symbol table and changes the namespace of all contained symbols to match it .
void updatens(Stab *st, char *name)
{
    void **k;
    size_t i, nk;
    Tydefn *td;
    if (st->name)
        die("Stab %s already has namespace; Can't set to %s", st->name, name);
    st->name = strdup(name);
    htput(file->file.ns, st->name, st);
    k = htkeys(st->dcl, &nk);
    for (i = 0; i < nk; i++)
        setns(k[i], name);
    free(k);
    k = htkeys(st->ty, &nk);
    for (i = 0; i < nk; i++)
        setns(k[i], name);
    for (i = 0; i < nk; i++) {
        td = htget(st->ty, k[i]);
        if (td->type && (td->type->type == Tyname || td->type->type == Tygeneric))
            setns(td->type->name, name);
    }
    free(k);
}
void updatens ( Stab * st , char * name ) { void * * k ; size_t i , nk ; Tydefn * td ; if ( st -> name ) die ( " " , st -> name , name ) ; st -> name = strdup ( name ) ; htput ( file -> file . ns , st -> name , st ) ; k = htkeys ( st -> dcl , & nk ) ; for ( i = 0 ; i < nk ; i ++ ) setns ( k [ i ] , name ) ; free ( k ) ; k = htkeys ( st -> ty , & nk ) ; for ( i = 0 ; i < nk ; i ++ ) setns ( k [ i ] , name ) ; for ( i = 0 ; i < nk ; i ++ ) { td = htget ( st -> ty , k [ i ] ) ; if ( td -> type && ( td -> type -> type == Tyname || td -> type -> type == Tygeneric ) ) setns ( td -> type -> name , name ) ; } free ( k ) ; }
Sets the namespace of a symbol table, and
 changes the namespace of all contained symbols
 to match it.
Sets the namespace of a symbol table and changes the namespace of all contained symbols to match it .