char * EiC_stab_SaveString(stab_t *stab, char *s) { char *EiC_strsave(char*); int i; if((i=EiC_stab_FindString(stab,s)) < 0) { if(stab->n == 0) stab->strs = xmalloc(sizeof(*stab->strs)); else stab->strs = xrealloc(stab->strs, sizeof(*stab->strs) * (stab->n+1)); i = stab->n; stab->strs[i] = EiC_strsave(s); stab->n++; } return stab->strs[i]; }
/*CUT lutInsert*/ symentry_t * EiC_insertLUT(char nspace,char *id,int type) { symentry_t *sym; auto int hashval; sym = (symentry_t *) xcalloc(1,sizeof(symentry_t)); if(sym == NULL) return(NULL); if( (sym->id = EiC_strsave(id)) == NULL) { xfree(sym); return(NULL); } sym->entry = _EnTrY_No++; hashval = hashsmc(sym->id,HSIZE); sym->next = EiC_HTAB[hashval]; EiC_HTAB[hashval] = sym; sym->nspace = nspace; sym->val.ival = -1; /* indicates unused */ sym->type = EiC_addtype(type,NULL); sym->fname = CurrentFileName(); return(sym); }