Hopefully fixed some linking bugs.

master
kts 2014-11-20 17:39:01 -08:00
parent a3e5747656
commit bab232d683
2 changed files with 6 additions and 3 deletions

View File

@ -238,7 +238,8 @@ struct ktkLive *ktk_buildStructure(struct ktkProgram *program, struct ktkLive *l
} }
int ktk_linkStructures(struct ktkProgram *program, struct ktkLive *live, struct ktkLive *new_live, struct ktkMap *orig_map) { int ktk_linkStructures(struct ktkProgram *program, struct ktkLive *live, struct ktkLive *new_live, struct ktkMap *orig_map) {
struct ktkLive *parent_live = NULL; //struct ktkLive *parent_live = NULL;
struct ktkLive *parent_live = new_live;
// *** step 1. get our structure and check for pathing // *** step 1. get our structure and check for pathing
struct ktkStructure *structure; struct ktkStructure *structure;
if ((structure = ktk_getStructure(program, live->name)) != NULL) { if ((structure = ktk_getStructure(program, live->name)) != NULL) {
@ -457,7 +458,7 @@ int ktk_linkStructures(struct ktkProgram *program, struct ktkLive *live, struct
} }
} }
} }
if (parent_live == NULL) { /*if (parent_live == NULL) {
parent_live = malloc(sizeof(struct ktkLive)); parent_live = malloc(sizeof(struct ktkLive));
*parent_live = ktk_LIVE_DEFAULT; *parent_live = ktk_LIVE_DEFAULT;
if (live->name == NULL) { if (live->name == NULL) {
@ -467,7 +468,7 @@ int ktk_linkStructures(struct ktkProgram *program, struct ktkLive *live, struct
memcpy(parent_live->name, live->name, strlen(live->name)+1); memcpy(parent_live->name, live->name, strlen(live->name)+1);
} }
ktk_addLiveChild(new_live, parent_live); ktk_addLiveChild(new_live, parent_live);
} }*/
// *** step // *** step
int i; int i;
for (i = 0; i < live->child_count; i++) { for (i = 0; i < live->child_count; i++) {

View File

@ -274,9 +274,11 @@ int ktk_deleteLive(struct ktkLive *live) {
} }
int ktk_addLiveChild(struct ktkLive *parent, struct ktkLive *child) { int ktk_addLiveChild(struct ktkLive *parent, struct ktkLive *child) {
printf("%d\n", parent->child_count);
parent->child_count++; parent->child_count++;
parent->children = realloc(parent->children, parent->child_count*sizeof(struct ktkLive*)); parent->children = realloc(parent->children, parent->child_count*sizeof(struct ktkLive*));
parent->children[parent->child_count-1] = child; parent->children[parent->child_count-1] = child;
child->parent = parent;
return 0; return 0;
} }