aboutsummaryrefslogtreecommitdiff
path: root/strbst.c
diff options
context:
space:
mode:
authorHolden Rohrer <hr@hrhr.dev>2020-05-28 10:55:38 -0400
committerHolden Rohrer <hr@hrhr.dev>2020-05-28 10:55:38 -0400
commit9addd39acd0e53656ccedf4fb5380c8df7845a8f (patch)
treebd7e0a2e969523e7c7f07fc40b26931c58dbd30c /strbst.c
parentd6e6291efe4281adb4d69071537f6f7010e71dfd (diff)
made functions static
Diffstat (limited to 'strbst.c')
-rw-r--r--strbst.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/strbst.c b/strbst.c
index b8b5dce..16c2e61 100644
--- a/strbst.c
+++ b/strbst.c
@@ -58,8 +58,10 @@ e b => a c
*bst = (*bst)->right; // tip = b
(*bst)->left->right = flip;
}
+// NOTE: These functions are valid because `b` is guaranteed in the
+// conditions where the rotations are called.
-int insnode(strbstnode** bst, strbstnode* new) {
+static int insnode(strbstnode** bst, strbstnode* new) {
// returns height of right node minus height of left node ("bias")
if (!*bst) { // When an empty node is reached,
*bst = new; // place the node
@@ -96,7 +98,7 @@ void insbst(strbst* bst, char* ind, void* data) {
insnode(&(bst->head), newbstnode(ind, data)); // allows recursion
}
-void* querynode(strbstnode* node, char* ind){
+static void* querynode(strbstnode* node, char* ind){
// tail-recursive finding algorithm
if (!node) return NULL; // NULL => node not found
int cmp = strcmp(ind, node->ind);