Hash :
6918b223
Author :
Date :
2023-12-11T17:47:38
savedir: scale better when sorting by name * lib/savedir.c: Include attribute.h. (direntry_t): The ‘name’ member is now idx_t, not char *, so that it survives name_space relocation. (direntry_cmp_name, direntry_cmp_inode, comparison_function): Adjust to qsort_r API, and to direntry_t layout change. (streamsavedir): Redo to avoid need for xstrdup on each directory entry. Instead, copy the string data into name_space; this typically scales better the memory allocator is called O(log N) rather than O(N) times. Use qsort_r so that name_space can be passed to the comparison functions. Simplify calls to ‘free’ so that lack of leakage is more obvious. * modules/savedir (Depends-on): Add attribute, qsort_r.
Description:
Return the entries of a directory (just the names) as an argz string.
Files:
lib/savedir.h
lib/savedir.c
m4/savedir.m4
Depends-on:
attribute
closedir
dirent-safer
fdopendir
free-posix
opendir
qsort_r
readdir
stpcpy
xalloc
configure.ac:
gl_SAVEDIR
Makefile.am:
lib_SOURCES += savedir.c
Include:
"savedir.h"
License:
GPL
Maintainer:
Jim Meyering