diff options
author | Josias <me@josias.dev> | 2021-11-23 17:38:32 -0800 |
---|---|---|
committer | Josias <me@josias.dev> | 2021-11-23 17:38:32 -0800 |
commit | bf5ee7abf4a0a6dcd3b467984dd4d7a59b8c1ae5 (patch) | |
tree | 5bc172c7dc089ea0d3cb76000f8be6d4d09ac034 | |
parent | abccb7bed44f8eb6fbebd44507bccc0d447a99d0 (diff) |
search: change struct result to search_result
-rw-r--r-- | include/search.h | 4 | ||||
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | search.c | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/include/search.h b/include/search.h index 4b42e6c..1aafaa3 100644 --- a/include/search.h +++ b/include/search.h @@ -3,13 +3,13 @@ #include "notebook.h" -struct result { +struct search_result { char path[512]; //char first_text[51]; //size_t occurances; //size_t placements[]; // where each occurance is found in the document }; -struct result *search(struct notebook notebook, const char *query, size_t *count); +struct search_result *search(struct notebook notebook, const char query[100], size_t *count); #endif @@ -162,7 +162,7 @@ int main(int argc, char **argv) } size_t count = 0; - struct result *results = search(notebook, argv[3], &count); + struct search_result *results = search(notebook, argv[3], &count); if (results && count > 0) { for (size_t i = 0; i < count; ++i) { printf("%s\n", results[i].path); @@ -12,13 +12,13 @@ // is found within it. If so, get basic information about it and // add it to the list. -struct result *search(struct notebook notebook, const char query[100], size_t *result_count) +struct search_result *search(struct notebook notebook, const char query[100], size_t *result_count) { if (strcmp(query, "") == 0) { return NULL; } - static struct result results[1000]; + static struct search_result results[1000]; size_t result_index = 0; char path[512]; @@ -59,7 +59,7 @@ struct result *search(struct notebook notebook, const char query[100], size_t *r contents[i] = '\0'; if (strstr(contents, query) != NULL) { - struct result r; + struct search_result r; strncpy(r.path, notebook.path, 256); strncat(r.path, path, 256); r.path[256] = '\0'; |