debug
This commit is contained in:
parent
42fb87bacd
commit
896e454c40
BIN
list/list.c
BIN
list/list.c
Binary file not shown.
@ -140,19 +140,19 @@ void printNodeInfo(Node *p_node, int priority) {
|
|||||||
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 (!strcmp(p_node->type, "int")) {
|
if (!strcmp(p_node->type, "int")) {
|
||||||
for (int i = 0; i < priority + 1; i++) printf(" ");
|
for (int i = 0; i < priority + 1; i++) printf(" ");
|
||||||
printf("VALUE(Int):%d\n", *(int *)(p_node->value));
|
printf("VALUE(int):%d\n", *(int *)(p_node->value));
|
||||||
}
|
}
|
||||||
else if (!strcmp(p_node->type, "double")) {
|
else if (!strcmp(p_node->type, "double")) {
|
||||||
for (int i = 0; i < priority + 1; i++) printf(" ");
|
for (int i = 0; i < priority + 1; i++) printf(" ");
|
||||||
printf("VALUE(Double):%a\n", *(double *)(p_node->value));
|
printf("VALUE(double):%a\n", *(double *)(p_node->value));
|
||||||
}
|
}
|
||||||
else if (!strcmp(p_node->type, "string")) {
|
else if (!strcmp(p_node->type, "string")) {
|
||||||
for (int i = 0; i < priority + 1; i++) printf(" ");
|
for (int i = 0; i < priority + 1; i++) printf(" ");
|
||||||
printf("VALUE(String):%s\n", (char *)(p_node->value));
|
printf("VALUE(string):%s\n", (char *)(p_node->value));
|
||||||
}
|
}
|
||||||
else if (!strcmp(p_node->type, "pointer")) {
|
else if (!strcmp(p_node->type, "pointer")) {
|
||||||
for (int i = 0; i < priority + 1; i++) printf(" ");
|
for (int i = 0; i < priority + 1; i++) printf(" ");
|
||||||
printf("VALUE(Pointer):%s\n", (char *)(p_node->value));
|
printf("VALUE(pointer):%s\n", (char *)(p_node->value));
|
||||||
}
|
}
|
||||||
else if (!strcmp(p_node->type, "list")) {
|
else if (!strcmp(p_node->type, "list")) {
|
||||||
for (int i = 0; i < priority + 1; i++) printf(" ");
|
for (int i = 0; i < priority + 1; i++) printf(" ");
|
||||||
@ -166,8 +166,13 @@ void printNodeInfo(Node *p_node, int priority) {
|
|||||||
void printNode(Node *p_node) {
|
void printNode(Node *p_node) {
|
||||||
printf("#NODE(location:%p, id:%llu){\n", p_node, p_node->id);
|
printf("#NODE(location:%p, id:%llu){\n", p_node, p_node->id);
|
||||||
printf(" ");
|
printf(" ");
|
||||||
printf("NEXT->%p / LAST->%p / MALLOC:%d\n", p_node->next, p_node->last, p_node->if_malloc);
|
printf("NEXT->%p / LAST->%p\n", p_node->next, p_node->last, p_node->if_malloc);
|
||||||
printf(" ");
|
for (int i = 0; i < 1; i++) printf(" ");
|
||||||
|
printf("ifMalloc: ");
|
||||||
|
if (p_node->if_malloc) {
|
||||||
|
printf("YES\n");
|
||||||
|
for (int i = 0; i < 1; i++) printf(" ");
|
||||||
|
printf("Value(type: %s): ", p_node->type);
|
||||||
if (!strcmp(p_node->type, "int")) {
|
if (!strcmp(p_node->type, "int")) {
|
||||||
printf("%d", *(int *)(p_node->value));
|
printf("%d", *(int *)(p_node->value));
|
||||||
}
|
}
|
||||||
@ -183,6 +188,9 @@ void printNode(Node *p_node) {
|
|||||||
else if (!strcmp(p_node->type, "list")) {
|
else if (!strcmp(p_node->type, "list")) {
|
||||||
printList((List *)p_node->value);
|
printList((List *)p_node->value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else printf("NO\n");
|
||||||
|
|
||||||
printf("}\n");
|
printf("}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
test.c
3
test.c
@ -47,8 +47,9 @@ int tree(void) {
|
|||||||
addChildInRight(cl_tnode, tnodeWithInt(5));
|
addChildInRight(cl_tnode, tnodeWithInt(5));
|
||||||
addChildInRight(cr_tnode, tnodeWithInt(6));
|
addChildInRight(cr_tnode, tnodeWithInt(6));
|
||||||
addChildInRight(cr_tnode, tnodeWithInt(7));
|
addChildInRight(cr_tnode, tnodeWithInt(7));
|
||||||
|
|
||||||
|
removeChildByIndex(cr_tnode, 1);
|
||||||
printTNodeWithFamily(t_tnode, 0);
|
printTNodeWithFamily(t_tnode, 0);
|
||||||
//removeChildByIndex(t_tnode, 0);
|
|
||||||
releaseAllForTree();
|
releaseAllForTree();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ TNode *getChildByIndex(TNode *p_tnode, unsigned long long index) {
|
|||||||
List *p_home = p_tnode->home;
|
List *p_home = p_tnode->home;
|
||||||
Node *p_node = p_home->head;
|
Node *p_node = p_home->head;
|
||||||
int m_index = 0;
|
int m_index = 0;
|
||||||
if (index < p_tnode->child_num - 1)
|
if (index < p_tnode->child_num)
|
||||||
{
|
{
|
||||||
while (p_node != NULL && m_index < index) {
|
while (p_node != NULL && m_index < index) {
|
||||||
m_index++;
|
m_index++;
|
||||||
|
Loading…
Reference in New Issue
Block a user