static void pf_the_page (PFunArgs) { char *varname = mhtml_evaluate_string (get_positional_arg (vars, 0)); PAGE *the_page = parser_top_page (); if (empty_string_p (varname)) { PAGE *contents = page_copy_page (the_page); bprintf_insert (page, start, "%s", contents->buffer); *newstart += contents->bindex; page_free_page (contents); } else { Symbol *sym = symbol_remove (varname); Datablock *block; symbol_free (sym); sym = symbol_intern (varname); block = datablock_create (the_page->buffer, the_page->bindex); sym->type = symtype_BINARY; sym->values = (char **)block; } xfree (varname); }
void prog_free(struct prog **pp) { if (!pp || !(*pp)) { return; } struct prog *p = *pp; decl_free(&p->ast); hash_table_delete(p->strings); symbol_free(&p->symbols); free(p); *pp = 0; }
static void profile_node_free (ProfileNode *node) { int i; for (i = 0; i < node->children->len; ++i) profile_node_free (node->children->pdata[i]); if (node->symbol) symbol_free (node->symbol); g_ptr_array_free (node->children, TRUE); g_free (node); }
void class_free(class_t *cls) { uint32_t i; if (cls == NULL) { return; } vm_debug(DBG_MEM, "=== deleting class %p \"%s\"\n", cls, cls->name); if (gc_type_g != GC_NONE) { assert(!gc_cheney_ptr_in_to_space(cls, sizeof(class_t))); assert(!gc_cheney_ptr_in_from_space(cls, sizeof(class_t))); } free(cls->name); free(cls->parent_name); method_free(cls->constructor); free(cls->constructor); method_free(cls->static_init); free(cls->static_init); for (i = 0; i < cls->methods_cnt; i++) { method_free(&cls->methods[i]); } free(cls->methods); for (i = 0; i < cls->syms_static_cnt; i++) { symbol_free(&cls->syms_static[i]); } free(cls->syms_static); for (i = 0; i < cls->syms_instance_cnt; i++) { symbol_free(&cls->syms_instance[i]); } free(cls->syms_instance); }
void input_free(Input *inp) { int i; for(i = 0; i < 256; i++) { if (inp->xlt[i].sym != NULL) { symbol_free(inp->xlt[i].sym); } } free(inp); }
/* check to make sure I don't delete something I'm not supposed to */ void slqline_free(SLQline *slql) { int i; for (i = 0; i < slql->width; i++) { if (slql->line[i] != NULL) { symbol_free(slql->line[i]); slql->line[i] = NULL; } } free(slql->line); slql->line = NULL; slql->next = NULL; free(slql); }
void eecontext_parse() { if (eecontext.EEimminent) { type *t; unsigned marksi; symbol *s; //printf("imminent\n"); marksi = globsym.top; eecontext.EEin++; s = symbol_genauto(tspvoid); eecontext.EEelem = func_expr_dtor(TRUE); t = eecontext.EEelem->ET; if (tybasic(t->Tty) != TYvoid) { unsigned op; elem *e; e = el_unat(OPind,t,el_var(s)); op = tyaggregate(t->Tty) ? OPstreq : OPeq; eecontext.EEelem = el_bint(op,t,e,eecontext.EEelem); } eecontext.EEin--; eecontext.EEimminent = 0; eecontext.EEfunc = funcsym_p; eecontext_convs(marksi); // Generate the typedef if (eecontext.EEtypedef && config.fulltypes) { symbol *s; s = symbol_name(eecontext.EEtypedef,SCtypedef,t); cv_outsym(s); symbol_free(s); } } }
void forms_set_tag_value_in_package (Package *package, char *tag, char *value) { register int i, j; char *name = tag; int value_index = 0; int arrayify = 0; Symbol *symbol; /* Does this variable ref contain an array indicator? */ for (i = 0; tag[i] != '\0'; i++) if (tag[i] == '[') { /* Find out if this is a real array reference. */ #if MUST_BE_DIGITS for (j = i + 1; isdigit (tag[j]); j++); if (tag[j] == ']') { if (j == i + 1) arrayify = 1; else value_index = atoi (tag + i + 1); name = strdup (tag); name[i] = '\0'; } #else /* !MUST_BE_DIGITS */ int all_digits = 1; for (j = i + 1; tag[j] != '\0' && tag[j] != ']'; j++) if (!isdigit (tag[j])) all_digits = 0; if (tag[j] == ']') { if (j == i + 1) arrayify = 1; else { if (all_digits) value_index = atoi (tag + i + 1); else { char *tv, *nv; j--; tv = (char *)xmalloc (1 + (j - i)); strncpy (tv, tag + i + 1, j - i); tv[j - i] = '\0'; nv = forms_get_tag_value (tv); if (nv) value_index = atoi (nv); free (tv); } } name = strdup (tag); name[i] = '\0'; } #endif /* !MUST_BE_DIGITS */ break; } /* Get the symbol for this name. */ if (package == (Package *)NULL) symbol = symbol_intern (name); else symbol = symbol_intern_in_package (package, name); /* If this symbol is readonly, then we cannot manipulate it. */ if (!symbol_get_flag (symbol, sym_READONLY)) { /* If this symbol is not of type STRING, then delete it. */ if (symbol->type != symtype_STRING) { Symbol *r = symbol_remove_in_package (symbol->package, symbol->name); symbol_free (r); if (package == (Package *)NULL) symbol = symbol_intern (name); else symbol = symbol_intern_in_package (package, name); } /* If the value is empty, then add it as the empty string. */ if (value == (char *)NULL) value = ""; if (symbol->notifier) *(symbol->notifier) = 1; /* If the index to store at is larger than the number of items in the list, then make a bunch of blank items to fill in the space. */ if (value_index >= symbol->values_index) { symbol->values = (char **)xrealloc (symbol->values, (symbol->values_slots = 2 + value_index) * sizeof (char *)); while (symbol->values_index <= value_index) symbol->values[symbol->values_index++] = strdup (""); symbol->values[symbol->values_index] = (char *)NULL; } /* Store the value. If we are supposed to arrayify this variable, do it now. */ if (arrayify) { char **values = (char **)NULL; int values_index = 0; int values_slots = 0; int start = 0; while (value[start]) { /* Skip all whitespace between items. */ for (i = start; whitespace (value[i]); i++); start = i; if (value[i] == '\0') break; for (; value[i] != '\0' && value[i] != '\n'; i++); if (values_index + 2 > values_slots) values = (char **)xrealloc (values, (values_slots += 10) * sizeof (char *)); values[values_index] = (char *)xmalloc (1 + (i - start)); strncpy (values[values_index], value + start, i - start); values[values_index][i - start] = '\0'; values_index++; values[values_index] = (char *)NULL; start = i; } free_array (symbol->values); symbol->values = values; symbol->values_index = values_index; symbol->values_slots = values_slots; } else { if (value_index > -1) { free (symbol->values[value_index]); symbol->values[value_index] = strdup (value); } } symbol_set_modified (symbol); } if (name != tag) free (name); }