- if(strcasecmp(line, "material") == 0) {
- if((mat = (struct matdb_material*)malloc(sizeof(struct matdb_material))) == NULL) {
- *err &= 32;
- }
- if((mat->name = g_string_new(i)) == NULL) {
- *err &= 32;
- free(mat);
- continue;
- }
- if((mat->properties = g_hash_table_new_full(g_str_hash, g_str_equal, &destroy_string, &destroy_double)) == NULL) {
- *err &= 32;
- g_string_free(mat->name, TRUE);
- free(bow);
- continue;
- }
-#ifdef DEBUG
- fprintf(stderr, "new material (%s):\n", i);
-#endif
- }else if(strcasecmp(line, "bow") == 0) {
- if((bow = (struct matdb_bowing*)malloc(sizeof(struct matdb_bowing))) == NULL) {
- *err &= 128;
- }
- if((to = index(i, ':')) == NULL) {
- *err &= 1024;
- free(bow);
- continue;
- }
- *to++ = '\0';
- /*Same trick as before, but i now stores the from material,
- and to the to material
- */
- if((bow->from = g_string_new(i)) == NULL) {
- *err &= 128;
- free(bow);
- continue;
- }
- if((bow->to = g_string_new(to)) == NULL) {
- *err &= 128;
- g_string_free(bow->from, TRUE);
- free(bow);
- continue;
- }
- if((bow->properties = g_hash_table_new_full(g_str_hash, g_str_equal, &destroy_string, &destroy_double)) == NULL) {
- *err &= 128;
- g_string_free(bow->to, TRUE);
- g_string_free(bow->from, TRUE);
- free(bow);
- continue;
- }
-#ifdef DEBUG
- fprintf(stderr, "new bowing (%s:%s):\n", i, to);
+ if((mat->properties = g_hash_table_new_full(&g_str_hash, &g_str_equal, &destroy_string, &destroy_double)) == NULL) {
+ *err &= 32;
+ g_string_free(mat->name, TRUE);
+ free(bow);
+ section=0;
+ continue;
+ }
+#ifdef DEBUG_2
+ fprintf(stderr, "new material (%s):\n", i);