Implement . and .. detection manually.

strcmp() startup cost is too high and not worth it here.
This commit is contained in:
Érico Nogueira 2022-06-12 21:29:22 -03:00
parent 2fbe3a2789
commit 851bd62ab6
1 changed files with 4 additions and 1 deletions

View File

@ -155,7 +155,10 @@ static void *process_queue_item(void *arg)
size_t plen = strlen(t.path);
struct dirent *entry;
while ((entry = readdir(d))) {
if (strcmp(".", entry->d_name)==0 || strcmp("..", entry->d_name)==0) continue;
if (entry->d_name[0] == '.' &&
(entry->d_name[1] == '\0' ||
(entry->d_name[1] == '.' && entry->d_name[2] == '\0')))
continue;
/* fast path to avoid allocations */
int trv;