From d4ff84b8d3afa45a69c23eb18899194bf7219140 Mon Sep 17 00:00:00 2001 From: evanweaver Date: Fri, 26 Oct 2007 02:59:15 +0000 Subject: reverts for 1.0.2 git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@741 19e92222-5c0b-0410-8929-a290d50e31e9 --- ext/http11/tst_init.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 ext/http11/tst_init.c (limited to 'ext/http11/tst_init.c') diff --git a/ext/http11/tst_init.c b/ext/http11/tst_init.c new file mode 100644 index 0000000..259734a --- /dev/null +++ b/ext/http11/tst_init.c @@ -0,0 +1,41 @@ + +#include "tst.h" +#include +#include + +struct tst *tst_init(int width) +{ + struct tst *tst; + struct node *current_node; + int i; + + +if((tst = (struct tst *) calloc(1, sizeof(struct tst))) == NULL) + return NULL; + +if ((tst->node_lines = (struct node_lines *) calloc(1, sizeof(struct node_lines))) == NULL) +{ + free(tst); + return NULL; +} + +tst->node_line_width = width; +tst->node_lines->next = NULL; +if ((tst->node_lines->node_line = (struct node *) calloc(width, sizeof(struct node))) == NULL) +{ + free(tst->node_lines); + free(tst); + return NULL; +} + +current_node = tst->node_lines->node_line; +tst->free_list = current_node; +for (i = 1; i < width; i++) +{ + current_node->middle = &(tst->node_lines->node_line[i]); + current_node = current_node->middle; +} +current_node->middle = NULL; +return tst; +} + -- cgit v1.2.3-24-ge0c7