diff options
author | evanweaver <evanweaver@19e92222-5c0b-0410-8929-a290d50e31e9> | 2007-10-26 02:59:15 +0000 |
---|---|---|
committer | evanweaver <evanweaver@19e92222-5c0b-0410-8929-a290d50e31e9> | 2007-10-26 02:59:15 +0000 |
commit | d4ff84b8d3afa45a69c23eb18899194bf7219140 (patch) | |
tree | 4a8e4b4e36ea36a8f543bfaaa2e6ec50fa1e94b6 /ext/http11/tst_grow_node_free_list.c | |
parent | 4ff4a7d915f01dabcb87125aa89159fcc5d48534 (diff) | |
download | unicorn-d4ff84b8d3afa45a69c23eb18899194bf7219140.tar.gz |
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@741 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'ext/http11/tst_grow_node_free_list.c')
-rw-r--r-- | ext/http11/tst_grow_node_free_list.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/ext/http11/tst_grow_node_free_list.c b/ext/http11/tst_grow_node_free_list.c new file mode 100644 index 0000000..da21333 --- /dev/null +++ b/ext/http11/tst_grow_node_free_list.c @@ -0,0 +1,38 @@ + +#include "tst.h" +#include <stdio.h> +#include <stdlib.h> + +int tst_grow_node_free_list(struct tst *tst) +{ + struct node *current_node; + struct node_lines *new_line; + int i; + + + if((new_line = (struct node_lines *) malloc(sizeof(struct node_lines))) == NULL) + return TST_ERROR; + + if((new_line->node_line = (struct node *) + calloc(tst->node_line_width, sizeof(struct node))) == NULL) + { + free(new_line); + return TST_ERROR; + } + else + { + new_line->next = tst->node_lines; + tst->node_lines = new_line; + } + + current_node = tst->node_lines->node_line; + tst->free_list = current_node; + for (i = 1; i < tst->node_line_width; i++) + { + current_node->middle = &(tst->node_lines->node_line[i]); + current_node = current_node->middle; + } + current_node->middle = NULL; + return 1; +} + |