aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tree_based_check.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/tree_based_check.c b/src/tree_based_check.c
index abf1232..6e76981 100644
--- a/src/tree_based_check.c
+++ b/src/tree_based_check.c
@@ -36,7 +36,7 @@
struct list_node {
struct list_node *next;
- char data[FULL_DATABLOCK_SIZE];
+ unsigned char data[FULL_DATABLOCK_SIZE];
};
struct list_head {
@@ -64,14 +64,14 @@ size_t freed = 0;
struct list_head *create_list_head();
void destroy_list(struct list_head *head);
-int insert_data_into_list(struct list_head *head, char *data);
+int insert_data_into_list(struct list_head *head, unsigned char *data);
int remove_data_from_list(struct list_head *head, char *data);
-int check_list_for_data(struct list_head *head, char *data);
+int check_list_for_data(struct list_head *head, unsigned char *data);
struct tree_root *create_tree_root();
void destroy_tree_branches(struct tree_branch *branch);
void destroy_tree(struct tree_root *root);
-int insert_into_tree(struct tree_root *root, char *data);
-int check_tree_for_data(struct tree_root *root, char *data);
+int insert_into_tree(struct tree_root *root, unsigned char *data);
+int check_tree_for_data(struct tree_root *root, unsigned char *data);
void print_list_plain(struct list_head *head, FILE *fd);
void print_tree_branch(struct tree_branch *branch, FILE *fd);
void print_tree(struct tree_root *root, FILE *fd);
@@ -135,7 +135,7 @@ inline void destroy_list(struct list_head *head) {
}
/* No time consuming duplicate check, data to be processed is expected to be gone sorted through uniq */
-inline int insert_data_into_list(struct list_head *head, char *data) {
+inline int insert_data_into_list(struct list_head *head, unsigned char *data) {
struct list_node *node;
if (head == NULL || data == NULL) {
LOGERR("ERROR: Improper arguments.\n");
@@ -217,7 +217,7 @@ inline int remove_data_from_list(struct list_head *head, char *data) {
* removed to safe time with future checks. However, in case the input file is
* sorted, Thread safety has negative performance impact.
*/
-inline int check_list_for_data(struct list_head *head, char *data) {
+inline int check_list_for_data(struct list_head *head, unsigned char *data) {
struct list_node *node;
int rc = 1;
if (head == NULL || data == NULL) {
@@ -275,7 +275,7 @@ inline void destroy_tree(struct tree_root *root) {
free(root);
}
-inline int insert_into_tree(struct tree_root *root, char *data) {
+inline int insert_into_tree(struct tree_root *root, unsigned char *data) {
int depth = 0, i =0;
struct tree_branch *ptr = NULL;
unsigned char uc = 0;
@@ -323,7 +323,7 @@ inline int insert_into_tree(struct tree_root *root, char *data) {
/* Return values:
* < 0 ERROR | == 0 FOUND | > 0 NOT FOUND */
-inline int check_tree_for_data(struct tree_root *root, char *data) {
+inline int check_tree_for_data(struct tree_root *root, unsigned char *data) {
int depth = 0;
struct tree_branch *ptr;
unsigned char uc;
@@ -391,7 +391,8 @@ struct tree_root *read_file_into_tree(char *filename) {
size_t line_nr=0;
struct tree_root *root = NULL;
FILE *fd = NULL;
- char *line = NULL, *data = NULL;
+ char *line = NULL;
+ unsigned char *data = NULL;
if (filename == NULL || strlen(filename) == 0) {
return NULL;
@@ -461,7 +462,8 @@ struct tree_root *read_file_into_tree(char *filename) {
int filter_file_with_tree(char *filename, FILE *output, struct tree_root *root) {
size_t line_nr=0;
FILE *fd = NULL;
- char *line = NULL, *data = NULL;
+ char *line = NULL;
+ unsigned char *data = NULL;
int check_result = 0;
int rc = 0;