Fast*er* string comparison
Go to file
2024-08-27 18:59:30 +02:00
.gitignore feat: implement funky tree lookup 2024-08-25 14:04:27 +02:00
LEAKS feat: add custom delimiter to gentree 2024-08-27 18:59:30 +02:00
Makefile feat: add custom delimiter to gentree 2024-08-27 18:59:30 +02:00
README feat: add custom delimiter to gentree 2024-08-27 18:59:30 +02:00
streecmp.c feat: add custom delimiter to gentree 2024-08-27 18:59:30 +02:00
streecmp.h feat: add custom delimiter to gentree 2024-08-27 18:59:30 +02:00
test.c feat: add custom delimiter to gentree 2024-08-27 18:59:30 +02:00

+==============+
|   streecmp   |
+==============+

    Fast*er* string comparison - an alternative to thousands of strcmp calls

    RES: en.wikipedia.org/wiki/Trie
    RES: en.wikipedia.org/wiki/Suffix_tree
    RES: en.wikipedia.org/wiki/Radix_tree
    RES: facweb.cs.depaul.edu/mobasher/classes/csc575/Suffix_Trees/index.html

TECHNICALS

    struct nod 
        * data structure that represents a node of the tree
    void frenod(struct nod *nod)
        * free memory of node and all of its children
    struct nod *allocnod(void)
        * allocate memory for a node and its pool size for 
            character hashmap
        * returns: poiner to said node or NULL if function fails
    struct nod *mknod(struct nod *nod, int loc)
        * create a child node below given parent node
        * loc is the character of the node (consult source code 
            of mkstr for more information) 
        * returns: pointer to said node or NULL if function fails
    int mkstr(struct nod *nod, char *str)
        * fit string into tree if it does not already exist
        * warning: string has to be null-byte terminated 
        * returns: the assigned ID of the string, 0 if string 
            is already inside tree, or -1 if function fails
    int gentree(struct nod *nod, char *strs, char *delim)
        * generate tree from character seperated strings
        * if delim is NULL, then "\n" is assumed
        * warning: seperation character is '\n'
        * returns: 0 if ok or -1 if function fails
    int streecmp(struct nod *nod, char *str) 
        * traverse tree and search for str
        * returns: id of string or 0 if there is no match

    test.c provides a practical example for comparing against 
    HTTP header fields

LEAKS

    LEAKS file contains the most recent valgrind memory leaks 
    dump ran on test.c.

TODO

    * everything done so far 

COMMITS
    
    Each commit is prefixed with an indicator token of what the change is
    *mostly* about. List of tokens is: 
    
        * repo: change docs or code style
        * feat: implement new change
        * fix: implement fix for a bug