static int xlsx_workbook_get_sheetnames (xlsx_info *xinfo, const char *fname) { xmlDocPtr doc = NULL; xmlNodePtr c1, cur = NULL; char *ID, *sheetname; int ns = 0, found = 0; int err; err = gretl_xml_open_doc_root(fname, "workbook", &doc, &cur); if (!err) { cur = cur->xmlChildrenNode; while (cur != NULL && !found) { if (!xmlStrcmp(cur->name, (XUC) "sheets")) { c1 = cur->xmlChildrenNode; while (c1 != NULL) { if (!xmlStrcmp(c1->name, (XUC) "sheet")) { ID = (char *) xmlGetProp(c1, (XUC) "id"); sheetname = (char *) xmlGetProp(c1, (XUC) "name"); if (ID != NULL && sheetname != NULL) { strings_array_add(&xinfo->sheetnames, &xinfo->n_sheets, sheetname); strings_array_add(&xinfo->filenames, &ns, ID); } free(ID); free(sheetname); } c1 = c1->next; } found = 1; } cur = cur->next; } xmlFreeDoc(doc); } return err; }
int series_table_add_string (series_table *st, const char *s) { int n, err; err = strings_array_add(&st->strs, &st->n_strs, s); if (err) { n = -1; } else { n = st->n_strs; g_hash_table_insert(st->ht, (gpointer) st->strs[n-1], GINT_TO_POINTER(n)); } return n; }
static void push_history_line (const char *line) { strings_array_add(&cmd_history, &hlines, line); hpos = hlines; }