Fixed
This commit is contained in:
parent
235e53d9b6
commit
56f677a22b
12
list/list.c
12
list/list.c
@ -33,7 +33,7 @@ int releaseSingleListForsafeModeForNode(List *p_list) {
|
|||||||
List *plv_node = NULL;
|
List *plv_node = NULL;
|
||||||
while (p_node != NULL) {
|
while (p_node != NULL) {
|
||||||
plv_node = (List *)p_node->value;
|
plv_node = (List *)p_node->value;
|
||||||
plv_node->id = 0;
|
freeS_id(plv_node->s_id);
|
||||||
plv_node->head = NULL;
|
plv_node->head = NULL;
|
||||||
plv_node->length = 0;
|
plv_node->length = 0;
|
||||||
plv_node->tail = NULL;
|
plv_node->tail = NULL;
|
||||||
@ -43,7 +43,7 @@ int releaseSingleListForsafeModeForNode(List *p_list) {
|
|||||||
p_list->head = NULL;
|
p_list->head = NULL;
|
||||||
p_list->length = 0;
|
p_list->length = 0;
|
||||||
p_list->tail = NULL;
|
p_list->tail = NULL;
|
||||||
p_list->id = 0;
|
freeS_id(p_list->s_id);
|
||||||
free(p_list);
|
free(p_list);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ int releaseSingleNodeForsafeModeForNode(List *p_list) {
|
|||||||
Node *pnv_node = NULL;
|
Node *pnv_node = NULL;
|
||||||
while (p_node != NULL) {
|
while (p_node != NULL) {
|
||||||
pnv_node = (Node *)p_node->value;
|
pnv_node = (Node *)p_node->value;
|
||||||
pnv_node->id = 0;
|
freeS_id(pnv_node->s_id);
|
||||||
pnv_node->if_malloc = 0;
|
pnv_node->if_malloc = 0;
|
||||||
pnv_node->last = NULL;
|
pnv_node->last = NULL;
|
||||||
pnv_node->next = NULL;
|
pnv_node->next = NULL;
|
||||||
@ -62,7 +62,7 @@ int releaseSingleNodeForsafeModeForNode(List *p_list) {
|
|||||||
free(pnv_node);
|
free(pnv_node);
|
||||||
p_node = p_node->next;
|
p_node = p_node->next;
|
||||||
}
|
}
|
||||||
p_list->id = 0;
|
free(p_list->s_id);
|
||||||
p_list->head = NULL;
|
p_list->head = NULL;
|
||||||
p_list->length = 0;
|
p_list->length = 0;
|
||||||
p_list->tail = NULL;
|
p_list->tail = NULL;
|
||||||
@ -194,7 +194,7 @@ int releaseList(List *p_list) {
|
|||||||
p_list->head = NULL;
|
p_list->head = NULL;
|
||||||
p_list->tail = NULL;
|
p_list->tail = NULL;
|
||||||
p_list->length = 0;
|
p_list->length = 0;
|
||||||
freeS_id(p_list->s_id)
|
freeS_id(p_list->s_id);
|
||||||
free(p_list);
|
free(p_list);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -437,7 +437,7 @@ List *copyList(List *p_list) {
|
|||||||
List *t_list = initList();
|
List *t_list = initList();
|
||||||
t_list->head = p_list->head;
|
t_list->head = p_list->head;
|
||||||
t_list->tail = p_list->tail;
|
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;
|
p_node = p_list->head;
|
||||||
while (p_node != NULL) {
|
while (p_node != NULL) {
|
||||||
t_node = copyNode(p_node);
|
t_node = copyNode(p_node);
|
||||||
|
@ -93,7 +93,7 @@ void printListInfo(List *p_list, int priority) {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
Node *p_node;
|
Node *p_node;
|
||||||
for (i = 0; i < priority; i++) printf(" ");
|
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(" ");
|
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);
|
printf("HEAD->%p / Tail->%p / Length:%llu\n", p_list->head, p_list->tail, p_list->length);
|
||||||
p_node = p_list->head;
|
p_node = p_list->head;
|
||||||
@ -141,7 +141,7 @@ void printList(List *p_list) {
|
|||||||
void printNodeInfo(Node *p_node, int priority) {
|
void printNodeInfo(Node *p_node, int priority) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < priority; i++) printf(" ");
|
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(" ");
|
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);
|
printf("NEXT->%p / LAST->%p / MALLOC:%d\n", p_node->next, p_node->last, p_node->if_malloc);
|
||||||
if (p_node->type == INT) {
|
if (p_node->type == INT) {
|
||||||
@ -171,7 +171,7 @@ void printNodeInfo(Node *p_node, int priority) {
|
|||||||
|
|
||||||
void printNode(Node *p_node) {
|
void printNode(Node *p_node) {
|
||||||
int i;
|
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(" ");
|
||||||
printf("NEXT->%p / LAST->%p\n", p_node->next, p_node->last);
|
printf("NEXT->%p / LAST->%p\n", p_node->next, p_node->last);
|
||||||
for (i = 0; i < 1; i++) printf(" ");
|
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;
|
Node *t_node = p_list->head;
|
||||||
unsigned long long index = 0;
|
unsigned long long index = 0;
|
||||||
while (t_node != NULL) {
|
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++;
|
index++;
|
||||||
t_node = t_node->next;
|
t_node = t_node->next;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ int printTNode(TNode *p_tnode, int priority) {
|
|||||||
if (priority == 0) printf("###");
|
if (priority == 0) printf("###");
|
||||||
else 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(" ");
|
for (i = 0; i < priority + 1; i++) printf(" ");
|
||||||
printf("ifMalloc: ");
|
printf("ifMalloc: ");
|
||||||
if (p_tnode->if_malloc) {
|
if (p_tnode->if_malloc) {
|
||||||
@ -102,7 +102,7 @@ int printTNodeWithHome(TNode *p_tnode,int priority) {
|
|||||||
if (p_tnode != NULL) {
|
if (p_tnode != NULL) {
|
||||||
if (priority == 0) printf("###");
|
if (priority == 0) printf("###");
|
||||||
else 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(" ");
|
for (i = 0; i < priority + 1; i++) printf(" ");
|
||||||
printf("ifMalloc: ");
|
printf("ifMalloc: ");
|
||||||
if (p_tnode->if_malloc) {
|
if (p_tnode->if_malloc) {
|
||||||
@ -126,7 +126,7 @@ int printTNodeWithHome(TNode *p_tnode,int priority) {
|
|||||||
|
|
||||||
if (p_tnode->father != NULL) {
|
if (p_tnode->father != NULL) {
|
||||||
for (i = 0; i < priority + 1; i++) printf(" ");
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -158,7 +158,7 @@ int printTNodeWithFamily(TNode *p_tnode, int priority) {
|
|||||||
for (i = 0; i < priority; i++) printf(" ");
|
for (i = 0; i < priority; i++) printf(" ");
|
||||||
if (priority == 0) printf("###");
|
if (priority == 0) printf("###");
|
||||||
else 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(" ");
|
for (i = 0; i < priority + 1; i++) printf(" ");
|
||||||
printf("ifMalloc: ");
|
printf("ifMalloc: ");
|
||||||
if (p_tnode->if_malloc) {
|
if (p_tnode->if_malloc) {
|
||||||
@ -182,7 +182,7 @@ int printTNodeWithFamily(TNode *p_tnode, int priority) {
|
|||||||
|
|
||||||
if (p_tnode->father != NULL) {
|
if (p_tnode->father != NULL) {
|
||||||
for (i = 0; i < priority + 1; i++) printf(" ");
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -208,7 +208,7 @@ int printTNodeWithFamily(TNode *p_tnode, int priority) {
|
|||||||
|
|
||||||
int printTree(Tree *p_tree) {
|
int printTree(Tree *p_tree) {
|
||||||
printf("###");
|
printf("###");
|
||||||
printf("Tree(id: %llu)",p_tree->id);
|
printf("Tree(id: %s)",s_idToASCIIString(p_tree->s_id));
|
||||||
printTNodeWithFamily(p_tree->root,0);
|
printTNodeWithFamily(p_tree->root,0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user