]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Make b-tree cache functions static.
authorFrederic Marchal <fmarchal@users.sourceforge.net>
Sun, 4 Oct 2015 14:30:20 +0000 (16:30 +0200)
committerFrederic Marchal <fmarchal@users.sourceforge.net>
Sun, 4 Oct 2015 14:30:20 +0000 (16:30 +0200)
btree_cache.c

index 4bc109161c1c1ce8002a8557784dd13d487538a7..5ce689de8f11c75dfb4ffe57fe24beadb2536d78 100644 (file)
@@ -43,12 +43,12 @@ int sizeof_bt;
 
 FILE *dbgfp = NULL;
 
-void set_balance_info(struct bt *node);
-struct bt *get_disbalanced_node(struct bt *node);
-void balance_node(struct bt *node);
+static void set_balance_info(struct bt *node);
+static struct bt *get_disbalanced_node(struct bt *node);
+static void balance_node(struct bt *node);
 
 
-struct bt *insert_node(struct bt *root, const char *item, const char *value)
+static struct bt *insert_node(struct bt *root, const char *item, const char *value)
 {
        struct bt *new_item_bt = NULL;
        if (!root)
@@ -87,7 +87,7 @@ struct bt *insert_node(struct bt *root, const char *item, const char *value)
 
 
 
-void balance_tree(struct bt *node)
+static void balance_tree(struct bt *node)
 {
        struct bt *disbalanced_node = NULL;
        do
@@ -103,7 +103,7 @@ void balance_tree(struct bt *node)
 
 
 
-void delete_tree(struct bt *root)
+static void delete_tree(struct bt *root)
 {
        if (root)
        {
@@ -114,7 +114,7 @@ void delete_tree(struct bt *root)
        }
 }
 
-struct bt *search_item(struct bt *root, const char *item)
+static struct bt *search_item(struct bt *root, const char *item)
 {
        int result;
        while (root && (result = strncmp(root->value, item, 64)))
@@ -127,7 +127,7 @@ struct bt *search_item(struct bt *root, const char *item)
        return root;
 }
 
-int get_length(struct bt *node, int d)
+static int get_length(struct bt *node, int d)
 {
        int l_depth = d, r_depth = d;
        if (node->left)
@@ -137,7 +137,7 @@ int get_length(struct bt *node, int d)
        return( ( l_depth > r_depth ) ? l_depth : r_depth );
 }
 
-struct bt *get_parent(struct bt *node)
+static struct bt *get_parent(struct bt *node)
 {
        if (node == root_bt)
                return NULL;
@@ -165,7 +165,7 @@ struct bt *get_parent(struct bt *node)
        }
 }
 
-void set_balance_info(struct bt *node)
+static void set_balance_info(struct bt *node)
 {
        int l_depth = 0, r_depth = 0;
        if (node->left)
@@ -181,7 +181,7 @@ void set_balance_info(struct bt *node)
        node->balanceinfo = r_depth - l_depth;
 }
 
-void rotate_right(struct bt *node)
+static void rotate_right(struct bt *node)
 {
        struct bt *left, *right, *tmp, *parent = get_parent(node);
        left = node->left;
@@ -203,7 +203,7 @@ void rotate_right(struct bt *node)
        }
 }
 
-void rotate_left(struct bt *node)
+static void rotate_left(struct bt *node)
 {
        struct bt *left, *right, *tmp, *parent = get_parent(node);
        left = node->right->left;
@@ -225,7 +225,7 @@ void rotate_left(struct bt *node)
        }
 }
 
-int get_disbalance_type(struct bt *node)
+static int get_disbalance_type(struct bt *node)
 {
        if (node->balanceinfo < 0)
                if (node->left->balanceinfo > 0)
@@ -239,7 +239,7 @@ int get_disbalance_type(struct bt *node)
                        return AVL_SINGLE_LEFT_ROTATION;
 }
 
-void balance_node(struct bt *node)
+static void balance_node(struct bt *node)
 {
        switch (get_disbalance_type(node))
        {
@@ -265,7 +265,7 @@ void balance_node(struct bt *node)
        }
 }
 
-struct bt *get_disbalanced_node(struct bt *node)
+static struct bt *get_disbalanced_node(struct bt *node)
 {
        struct bt *rdn;
        if (fabs(node->balanceinfo) > 1)