diff -r 09ad5d8ab860 -r 094eff4cfc03 src/scanner.c --- a/src/scanner.c Thu Jul 02 10:22:33 2026 +0200 +++ b/src/scanner.c Thu Jul 02 12:44:29 2026 +0200 @@ -79,18 +79,16 @@ } #endif -typedef struct filelist filelist_t; - struct filelist { char *displayname; unsigned displayname_len; char *filename; char *ext; unsigned st_mode; - filelist_t *next; + struct filelist *next; }; -static bool testSuffix(char* filename, string_list_t* list) { +static bool testSuffix(char* filename, string_list* list) { bool ret = false; size_t tokenlen, fnamelen = strlen(filename); for (size_t t = 0 ; t < list->count ; t++) { @@ -106,7 +104,7 @@ return ret; } -static void addResultPerExtension(scanresult_ext_t* result, +static void addResultPerExtension(scanresult_ext* result, char* ext, unsigned value) { if (!result) return; @@ -137,15 +135,15 @@ result->count++; } -scanresult_t* new_scanresult_t(settings_t* settings) { - scanresult_t* result = calloc(1, sizeof(scanresult_t)); +scanresult* new_scanresult(settings* settings) { + scanresult* result = calloc(1, sizeof(scanresult)); if (settings->individual_sums) { - result->ext = calloc(1, sizeof(scanresult_ext_t)); + result->ext = calloc(1, sizeof(scanresult_ext)); } return result; } -void destroy_scanresult_t(scanresult_t* result) { +void destroy_scanresult(scanresult* result) { if (result->ext) { if (result->ext->count > 0) { for (unsigned i = 0 ; i < result->ext->count ; i++) { @@ -159,9 +157,9 @@ free(result); } -static filelist_t *buildFileList(scanner_t scanner, settings_t* settings) { +static struct filelist *buildFileList(scanner scanner, settings* settings) { - filelist_t* list = NULL; + struct filelist* list = NULL; DIR *dirf; struct dirent *entry; struct stat statbuf; @@ -176,7 +174,7 @@ if (strcmp(entry->d_name, ".") != 0 && strcmp(entry->d_name, "..") != 0) { /* Create new filelist entry */ - filelist_t *newentry = (filelist_t*) malloc(sizeof(filelist_t)); + struct filelist *newentry = malloc(sizeof(struct filelist)); newentry->next = NULL; newentry->displayname_len = strlen(entry->d_name); @@ -210,9 +208,9 @@ if (list) { /* create fake root to have a pointer on the true root */ - filelist_t root; + struct filelist root; root.next = list; - filelist_t *parent = &root; + struct filelist *parent = &root; while (parent->next && (strcasecmp(parent->next->displayname, newentry->displayname) < 0 || (!S_ISDIR(newentry->st_mode) && S_ISDIR(parent->next->st_mode)) @@ -235,8 +233,8 @@ return list; } -static bool is_dir_excluded(settings_t* settings, const char* dir) { - const string_list_t * const list = settings->excludeDirs; +static bool is_dir_excluded(settings* settings, const char* dir) { + const string_list * const list = settings->excludeDirs; for (size_t i = 0 ; i < list->count ; i++) { /* determine if the list item is a path or a name */ @@ -264,15 +262,15 @@ return false; } -void scanDirectory(scanner_t scanner, settings_t* settings, - string_list_t* output, scanresult_t* result) { +void scanDirectory(scanner scnr, settings* settings, + string_list* output, scanresult* result) { result->result = 0; bool bfile; char *outbuf; const char *result_type = settings->count_chars ? "chars" : "lines"; - filelist_t *filelist = buildFileList(scanner, settings); + struct filelist *filelist = buildFileList(scnr, settings); while (filelist != NULL) { @@ -285,38 +283,38 @@ /* Print hint */ outbuf = malloc(81); snprintf(outbuf, 81, "%*s%*s%19s\n", - filelist->displayname_len + scanner.spaces, + filelist->displayname_len + scnr.spaces, filelist->displayname, - 60 - filelist->displayname_len - scanner.spaces, + 60 - filelist->displayname_len - scnr.spaces, "", "no match"); add_string(output, outbuf); } } else { - string_list_t *recoutput = settings->verbose ? new_string_list_t() : NULL; - scanresult_t recresult; + string_list *recoutput = settings->verbose ? new_string_list() : NULL; + scanresult recresult; recresult.ext = result->ext; scanDirectory( - (scanner_t) {filelist->filename, scanner.spaces+1}, + (scanner) {filelist->filename, scnr.spaces+1}, settings, recoutput, &recresult); result->result += recresult.result; if (settings->verbose && (!settings->matchesOnly || recresult.result > 0)) { outbuf = (char*) malloc(81); snprintf(outbuf, 81, "%*s/%*s%13u %s\n", - filelist->displayname_len+scanner.spaces, filelist->displayname, - 60-filelist->displayname_len-scanner.spaces-1, "", + filelist->displayname_len+scnr.spaces, filelist->displayname, + 60-filelist->displayname_len-scnr.spaces-1, "", recresult.result, result_type); add_string(output, outbuf); for (unsigned i = 0 ; i < recoutput->count ; i++) { add_string(output, recoutput->items[i]); } } - destroy_string_list_t(recoutput); + destroy_string_list(recoutput); } } } else if (!settings->matchesOnly && settings->verbose) { outbuf = (char*) malloc(81); snprintf(outbuf, 81, "%*s\n", - filelist->displayname_len+scanner.spaces, + filelist->displayname_len+scnr.spaces, filelist->displayname); add_string(output, outbuf); } @@ -381,9 +379,9 @@ if (!settings->matchesOnly && !settings->dirsOnly && settings->verbose) { outbuf = (char*) malloc(81); snprintf(outbuf, 81, - "%*s%*s%19s\n", filelist->displayname_len+scanner.spaces, + "%*s%*s%19s\n", filelist->displayname_len+scnr.spaces, filelist->displayname, - 60-filelist->displayname_len-scanner.spaces, "", "binary"); + 60-filelist->displayname_len-scnr.spaces, "", "binary"); add_string(output, outbuf); } } else { @@ -392,9 +390,9 @@ if (!settings->dirsOnly && settings->verbose) { outbuf = (char*) malloc(81); snprintf(outbuf, 81, "%*s%*s%13u %s\n", - filelist->displayname_len+scanner.spaces, + filelist->displayname_len+scnr.spaces, filelist->displayname, - 60-filelist->displayname_len-scanner.spaces, + 60-filelist->displayname_len-scnr.spaces, "", res_value, result_type @@ -408,8 +406,8 @@ /* Print hint */ outbuf = (char*) malloc(81); snprintf(outbuf, 81, "%*s%*s%19s\n", - filelist->displayname_len+scanner.spaces, filelist->displayname, - 60-filelist->displayname_len-scanner.spaces, "", "no match"); + filelist->displayname_len+scnr.spaces, filelist->displayname, + 60-filelist->displayname_len-scnr.spaces, "", "no match"); add_string(output, outbuf); } } @@ -417,7 +415,7 @@ free(filelist->filename); free(filelist->displayname); - filelist_t *freethis = filelist; + struct filelist *freethis = filelist; filelist = filelist->next; free(freethis); }