From 56f677a22ba8e5c4f8072df1f18cf4984a0b36df Mon Sep 17 00:00:00 2001 From: Saturneic Date: Mon, 30 Jul 2018 18:18:58 +0800 Subject: [PATCH] Fixed --- list/list.c | 12 ++++++------ list/list_expand.c | 8 ++++---- tree/tree_expand.c | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/list/list.c b/list/list.c index 7d2a6d4..2734d38 100644 --- a/list/list.c +++ b/list/list.c @@ -33,7 +33,7 @@ int releaseSingleListForsafeModeForNode(List *p_list) { List *plv_node = NULL; while (p_node != NULL) { plv_node = (List *)p_node->value; - plv_node->id = 0; + freeS_id(plv_node->s_id); plv_node->head = NULL; plv_node->length = 0; plv_node->tail = NULL; @@ -43,7 +43,7 @@ int releaseSingleListForsafeModeForNode(List *p_list) { p_list->head = NULL; p_list->length = 0; p_list->tail = NULL; - p_list->id = 0; + freeS_id(p_list->s_id); free(p_list); return 0; } @@ -53,7 +53,7 @@ int releaseSingleNodeForsafeModeForNode(List *p_list) { Node *pnv_node = NULL; while (p_node != NULL) { pnv_node = (Node *)p_node->value; - pnv_node->id = 0; + freeS_id(pnv_node->s_id); pnv_node->if_malloc = 0; pnv_node->last = NULL; pnv_node->next = NULL; @@ -62,7 +62,7 @@ int releaseSingleNodeForsafeModeForNode(List *p_list) { free(pnv_node); p_node = p_node->next; } - p_list->id = 0; + free(p_list->s_id); p_list->head = NULL; p_list->length = 0; p_list->tail = NULL; @@ -194,7 +194,7 @@ int releaseList(List *p_list) { p_list->head = NULL; p_list->tail = NULL; p_list->length = 0; - freeS_id(p_list->s_id) + freeS_id(p_list->s_id); free(p_list); return 0; } @@ -437,7 +437,7 @@ List *copyList(List *p_list) { List *t_list = initList(); t_list->head = p_list->head; t_list->tail = p_list->tail; - t_list->id = p_list->id; + t_list->s_id = p_list->s_id; p_node = p_list->head; while (p_node != NULL) { t_node = copyNode(p_node); diff --git a/list/list_expand.c b/list/list_expand.c index d4b647a..84b8157 100644 --- a/list/list_expand.c +++ b/list/list_expand.c @@ -93,7 +93,7 @@ void printListInfo(List *p_list, int priority) { int i = 0; Node *p_node; for (i = 0; i < priority; i++) printf(" "); - printf("###LIST(location:%p, id:%llu){\n", p_list, p_list->id); + printf("###LIST(location:%p, id:%s){\n", p_list, s_idToASCIIString(p_list->s_id)); for (i = 0; i < priority + 1; i++) printf(" "); printf("HEAD->%p / Tail->%p / Length:%llu\n", p_list->head, p_list->tail, p_list->length); p_node = p_list->head; @@ -141,7 +141,7 @@ void printList(List *p_list) { void printNodeInfo(Node *p_node, int priority) { int i; for (i = 0; i < priority; i++) printf(" "); - printf("#NODE(location:%p, id:%llu){\n", p_node, p_node->id); + printf("#NODE(location:%p, id:%s){\n", p_node, s_idToASCIIString(p_node->s_id)); for (i = 0; i < priority + 1; i++) printf(" "); printf("NEXT->%p / LAST->%p / MALLOC:%d\n", p_node->next, p_node->last, p_node->if_malloc); if (p_node->type == INT) { @@ -171,7 +171,7 @@ void printNodeInfo(Node *p_node, int priority) { void printNode(Node *p_node) { int i; - printf("#NODE(location:%p, id:%llu){\n", p_node, p_node->id); + printf("#NODE(location:%p, id:%s){\n", p_node, s_idToASCIIString(p_node->s_id)); printf(" "); printf("NEXT->%p / LAST->%p\n", p_node->next, p_node->last); for (i = 0; i < 1; i++) printf(" "); @@ -321,7 +321,7 @@ unsigned long long getIndexByNode(List *p_list, Node *p_node) { Node *t_node = p_list->head; unsigned long long index = 0; while (t_node != NULL) { - if (p_node->id == t_node->id) return index; + if (p_node->s_id == t_node->s_id) return index; index++; t_node = t_node->next; } diff --git a/tree/tree_expand.c b/tree/tree_expand.c index 1f30a1f..48e891a 100644 --- a/tree/tree_expand.c +++ b/tree/tree_expand.c @@ -64,7 +64,7 @@ int printTNode(TNode *p_tnode, int priority) { if (priority == 0) printf("###"); else printf("#"); - printf("TNode(id: %llu)\n", p_tnode->id); + printf("TNode(id: %s)\n", s_idToASCIIString(p_tnode->s_id)); for (i = 0; i < priority + 1; i++) printf(" "); printf("ifMalloc: "); if (p_tnode->if_malloc) { @@ -102,7 +102,7 @@ int printTNodeWithHome(TNode *p_tnode,int priority) { if (p_tnode != NULL) { if (priority == 0) printf("###"); else printf("#"); - printf("TNode(id: %llu)\n", p_tnode->id); + printf("TNode(id: %s)\n", s_idToASCIIString(p_tnode->s_id)); for (i = 0; i < priority + 1; i++) printf(" "); printf("ifMalloc: "); if (p_tnode->if_malloc) { @@ -126,7 +126,7 @@ int printTNodeWithHome(TNode *p_tnode,int priority) { if (p_tnode->father != NULL) { for (i = 0; i < priority + 1; i++) printf(" "); - printf("Father id: %llu\n", p_tnode->father->id); + printf("Father id: %s\n", s_idToASCIIString(p_tnode->father->s_id)); } else { @@ -158,7 +158,7 @@ int printTNodeWithFamily(TNode *p_tnode, int priority) { for (i = 0; i < priority; i++) printf(" "); if (priority == 0) printf("###"); else printf("#"); - printf("TNode(id: %llu)\n", p_tnode->id); + printf("TNode(id: %s)\n", s_idToASCIIString(p_tnode->s_id)); for (i = 0; i < priority + 1; i++) printf(" "); printf("ifMalloc: "); if (p_tnode->if_malloc) { @@ -182,7 +182,7 @@ int printTNodeWithFamily(TNode *p_tnode, int priority) { if (p_tnode->father != NULL) { for (i = 0; i < priority + 1; i++) printf(" "); - printf("Father id: %llu\n", p_tnode->father->id); + printf("Father id: %s\n", s_idToASCIIString(p_tnode->father->s_id)); } else { @@ -208,7 +208,7 @@ int printTNodeWithFamily(TNode *p_tnode, int priority) { int printTree(Tree *p_tree) { printf("###"); - printf("Tree(id: %llu)",p_tree->id); + printf("Tree(id: %s)",s_idToASCIIString(p_tree->s_id)); printTNodeWithFamily(p_tree->root,0); return 0; }