Changeset View
Changeset View
Standalone View
Standalone View
lib/libgeom/geom_xml2tree.c
| Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | StartElement(void *userData, const char *name, const char **attr) | ||||
| mt = userData; | mt = userData; | ||||
| mt->level++; | mt->level++; | ||||
| mt->sbuf[mt->level] = sbuf_new_auto(); | mt->sbuf[mt->level] = sbuf_new_auto(); | ||||
| id = NULL; | id = NULL; | ||||
| ref = NULL; | ref = NULL; | ||||
| for (i = 0; attr[i] != NULL; i += 2) { | for (i = 0; attr[i] != NULL; i += 2) { | ||||
| if (!strcmp(attr[i], "id")) { | if (!strcmp(attr[i], "id")) { | ||||
| id = (void *)strtoul(attr[i + 1], NULL, 0); | id = (void *)strtoumax(attr[i + 1], NULL, 0); | ||||
| mt->nident++; | mt->nident++; | ||||
| } else if (!strcmp(attr[i], "ref")) { | } else if (!strcmp(attr[i], "ref")) { | ||||
| ref = (void *)strtoul(attr[i + 1], NULL, 0); | ref = (void *)strtoumax(attr[i + 1], NULL, 0); | ||||
| } else | } else | ||||
| printf("%*.*s[%s = %s]\n", | printf("%*.*s[%s = %s]\n", | ||||
| mt->level + 1, mt->level + 1, "", | mt->level + 1, mt->level + 1, "", | ||||
| attr[i], attr[i + 1]); | attr[i], attr[i + 1]); | ||||
| } | } | ||||
| if (!strcmp(name, "class") && mt->class == NULL) { | if (!strcmp(name, "class") && mt->class == NULL) { | ||||
| mt->class = calloc(1, sizeof *mt->class); | mt->class = calloc(1, sizeof *mt->class); | ||||
| if (mt->class == NULL) { | if (mt->class == NULL) { | ||||
| ▲ Show 20 Lines • Show All 466 Lines • Show Last 20 Lines | |||||