#include #include #include #include "util/util.h" #include "geometry.h" void kai_parse_float_array(struct ka_float_array_t *dest, ezxml_t src) { /* get id, if present */ const char *id = ezxml_attr(src, "id"); if (id != NULL) { size_t id_len = strlen(id) + 1; dest->id = malloc(sizeof(char) * id_len); strncpy(dest->id, id, id_len); } else { dest->id = NULL; } /* get count */ const char *count = ezxml_attr(src, "count"); dest->count = strtol(count, NULL, 10); /* parse floats */ dest->data = malloc(sizeof(ka_real_t) * dest->count); kai_text_to_reals(dest->data, ezxml_txt(src), dest->count); }