# HG changeset patch # User Tatsuki IHA # Date 1430828164 -32400 # Node ID 2bdd8e2118c75727e1c78e76935d550c44a01fa2 # Parent c3314208d7b9f3ceb5e2fb33f21ab7d5dda7ec89 Add tail pointer to List data segment diff -r c3314208d7b9 -r 2bdd8e2118c7 src/list/list.c --- a/src/list/list.c Tue May 05 18:07:12 2015 +0900 +++ b/src/list/list.c Tue May 05 21:16:04 2015 +0900 @@ -20,7 +20,7 @@ __code meta_code2(struct Context* context, enum Code next) { context->data[List]->list.head = context->data[context->dataNum]; - context->data[List]->list.current = context->data[List]->list.head; + context->data[List]->list.tail = context->data[List]->list.head; context->data[context->dataNum]->element.next = 0; goto (context->code[next])(context); } @@ -39,16 +39,13 @@ } __code meta_append(struct Context* context, enum Code next) { - if (context->data[List]->list.current->element.next) { - context->data[List]->list.current = context->data[List]->list.current->element.next; - goto meta_append(context, next); - } - context->data[List]->list.current->element.next = context->data[context->dataNum]; + context->data[List]->list.tail->element.next = context->data[context->dataNum]; + context->data[List]->list.tail = context->data[List]->list.tail->element.next; + context->data[List]->list.tail->element.next = 0; goto (context->code[next])(context); } __code append(struct Context* context) { - context->data[List]->list.current = context->data[List]->list.head; goto meta_append(context, context->data[Allocate]->allocate.after_append); } diff -r c3314208d7b9 -r 2bdd8e2118c7 src/list/listContext.h --- a/src/list/listContext.h Tue May 05 18:07:12 2015 +0900 +++ b/src/list/listContext.h Tue May 05 21:16:04 2015 +0900 @@ -36,6 +36,7 @@ long count; struct List { union Data* head; + union Data* tail; union Data* current; } list; struct Element {