From 27e2243e7cfd40438ba4c6070734b00a00a7e1f7 Mon Sep 17 00:00:00 2001 From: evanweaver Date: Mon, 22 Oct 2007 02:58:02 +0000 Subject: pure ruby URIClassifier passes on C and JRuby both; now time to profile and see if it's worth keeping git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@722 19e92222-5c0b-0410-8929-a290d50e31e9 --- ext/http11/tst_search.c | 73 ------------------------------------------------- 1 file changed, 73 deletions(-) delete mode 100644 ext/http11/tst_search.c (limited to 'ext/http11/tst_search.c') diff --git a/ext/http11/tst_search.c b/ext/http11/tst_search.c deleted file mode 100644 index 176f953..0000000 --- a/ext/http11/tst_search.c +++ /dev/null @@ -1,73 +0,0 @@ - -#include "tst.h" -#include -#include -#include - - -void *tst_search(const unsigned char *key, struct tst *tst, int option, - unsigned int *match_len) -{ - struct node *current_node; - struct node *longest_match = NULL; - unsigned int longest_match_len = 0; - int key_index; - - assert(key != NULL && "key can't be NULL"); - assert(tst != NULL && "tst can't be NULL"); - - if (key[0] == 0) - return NULL; - - if (tst->head[(int) key[0]] == NULL) - return NULL; - - if (match_len) - *match_len = 0; - - current_node = tst->head[(int) key[0]]; - key_index = 1; - - while (current_node != NULL) { - if (key[key_index] == current_node->value) { - if (current_node->value == 0) { - if (match_len) - *match_len = key_index; - return current_node->middle; - } else { - current_node = current_node->middle; - key_index++; - continue; - } - } else { - if (current_node->value == 0) { - if (option & TST_LONGEST_MATCH) { - longest_match = current_node->middle; - longest_match_len = key_index; - } - - if (key[key_index] < 64) { - current_node = current_node->left; - continue; - } else { - current_node = current_node->right; - continue; - } - } else { - if (key[key_index] < current_node->value) { - current_node = current_node->left; - continue; - } else { - current_node = current_node->right; - continue; - } - } - } - } - - if (match_len) - *match_len = longest_match_len; - - return longest_match; - -} -- cgit v1.2.3-24-ge0c7