bdk: utils: improve dirlist

Stop doing unnecessary copies during reordering and use pointers for that.
This commit is contained in:
CTCaer
2024-10-09 15:14:44 +03:00
parent f15af01727
commit d2fc6379c6
3 changed files with 34 additions and 26 deletions

View File

@@ -62,7 +62,7 @@ int ini_parse(link_t *dst, const char *ini_path, bool is_dir)
ini_sec_t *csec = NULL;
char *lbuf = NULL;
char *filelist = NULL;
dirlist_t *filelist = NULL;
char *filename = (char *)malloc(256);
strcpy(filename, ini_path);
@@ -85,9 +85,9 @@ int ini_parse(link_t *dst, const char *ini_path, bool is_dir)
// Copy ini filename in path string.
if (is_dir)
{
if (filelist[k * 256])
if (filelist->name[k])
{
strcpy(filename + pathlen, &filelist[k * 256]);
strcpy(filename + pathlen, filelist->name[k]);
k++;
}
else