Skip to content

Commit

Permalink
Rename some functions with more useful/clear names (#2127)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanNardi authored Oct 29, 2023
1 parent 03fd155 commit 2c2eaf8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion fuzz/fuzz_filecfg_categories.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
ndpi_set_debug_bitmask(ndpi_struct, debug_bitmask);

fd = buffer_to_file(data, size);
ndpi_load_categories_file2(ndpi_struct, fd, NULL);
ndpi_load_categories_file_fd(ndpi_struct, fd, NULL);
if(fd)
fclose(fd);

Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_filecfg_protocols.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
ndpi_set_debug_bitmask(ndpi_struct, debug_bitmask);

fd = buffer_to_file(data, size);
ndpi_load_protocols_file2(ndpi_struct, fd);
ndpi_load_protocols_file_fd(ndpi_struct, fd);
if(fd)
fclose(fd);

Expand Down
6 changes: 3 additions & 3 deletions src/include/ndpi_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -766,8 +766,8 @@ extern "C" {
*/
int ndpi_load_protocols_file(struct ndpi_detection_module_struct *ndpi_mod,
const char* path);
int ndpi_load_protocols_file2(struct ndpi_detection_module_struct *ndpi_mod,
FILE *fd);
int ndpi_load_protocols_file_fd(struct ndpi_detection_module_struct *ndpi_mod,
FILE *fd);

/**
* Add an IP-address based risk mask
Expand Down Expand Up @@ -810,7 +810,7 @@ extern "C" {
* -1 else
*/
int ndpi_load_categories_file(struct ndpi_detection_module_struct *ndpi_str, const char* path, void *user_data);
int ndpi_load_categories_file2(struct ndpi_detection_module_struct *ndpi_str, FILE *fd, void *user_data);
int ndpi_load_categories_file_fd(struct ndpi_detection_module_struct *ndpi_str, FILE *fd, void *user_data);

/**
* Loads a file (separated by <cr>) of domain names associated with the specified category
Expand Down
10 changes: 5 additions & 5 deletions src/lib/ndpi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4415,15 +4415,15 @@ int ndpi_load_categories_file(struct ndpi_detection_module_struct *ndpi_str,
return -1;
}

rc = ndpi_load_categories_file2(ndpi_str, fd, user_data);
rc = ndpi_load_categories_file_fd(ndpi_str, fd, user_data);

fclose(fd);

return rc;
}

int ndpi_load_categories_file2(struct ndpi_detection_module_struct *ndpi_str,
FILE *fd, void *user_data) {
int ndpi_load_categories_file_fd(struct ndpi_detection_module_struct *ndpi_str,
FILE *fd, void *user_data) {
char buffer[512], *line, *name, *category, *saveptr;
int len, num = 0;

Expand Down Expand Up @@ -4801,14 +4801,14 @@ int ndpi_load_protocols_file(struct ndpi_detection_module_struct *ndpi_str, cons
return -1;
}

rc = ndpi_load_protocols_file2(ndpi_str, fd);
rc = ndpi_load_protocols_file_fd(ndpi_str, fd);

fclose(fd);

return rc;
}

int ndpi_load_protocols_file2(struct ndpi_detection_module_struct *ndpi_str, FILE *fd) {
int ndpi_load_protocols_file_fd(struct ndpi_detection_module_struct *ndpi_str, FILE *fd) {
char *buffer, *old_buffer;
int chunk_len = 1024, buffer_len = chunk_len, old_buffer_len;
int i;
Expand Down

0 comments on commit 2c2eaf8

Please sign in to comment.