/* Delete global variable. */ void Var_Deletei(const char *name, const char *ename) { Var *v; uint32_t k; unsigned int slot; int idx; idx = classify_var(name, &ename, &k); if (idx != GLOBAL_INDEX) { Parse_Error(PARSE_FATAL, "Trying to delete dynamic variable $%s", varnames[idx]); return; } slot = ohash_lookup_interval(&global_variables, name, ename, k); v = ohash_find(&global_variables, slot); if (v == NULL) return; if (checkEnvFirst && (v->flags & VAR_FROM_ENV)) return; if (v->flags & VAR_FROM_CMD) return; ohash_remove(&global_variables, slot); delete_var(v); }
unsigned int ohash_qlookupi(struct ohash *h, const char *s, const char **e) { u_int32_t hv; hv = ohash_interval(s, e); return ohash_lookup_interval(h, s, *e, hv); }
/* Create a new global var if necessary, and set it up correctly. * Do not take environment into account. */ static Var * find_global_var_without_env(const char *name, const char *ename, uint32_t k) { unsigned int slot; Var *v; slot = ohash_lookup_interval(&global_variables, name, ename, k); v = ohash_find(&global_variables, slot); if (v == NULL) { v = create_var(name, ename); v->flags = VAR_DUMMY; ohash_insert(&global_variables, slot, v); } return v; }
GNode * Targ_FindNodeih(const char *name, const char *ename, uint32_t hv, int flags) { GNode *gn; unsigned int slot; slot = ohash_lookup_interval(&targets, name, ename, hv); gn = ohash_find(&targets, slot); if (gn == NULL && (flags & TARG_CREATE)) { gn = Targ_NewGNi(name, ename); ohash_insert(&targets, slot, gn); } return gn; }