|
|
Message-ID: <20261118125553.9133-11-ilt@envs.net>
Date: Wed, 18 Nov 2026 15:49:52 +0300
From: illiliti <ilt@...s.net>
To: musl@...ts.openwall.com
Cc: illiliti <ilt@...s.net>
Subject: [PATCH v1 10/18] fts: drop aligned statp alloc support
---
src/misc/fts.c | 34 +---------------------------------
1 file changed, 1 insertion(+), 33 deletions(-)
diff --git a/src/misc/fts.c b/src/misc/fts.c
index bae0f8a9..498ef576 100644
--- a/src/misc/fts.c
+++ b/src/misc/fts.c
@@ -53,12 +53,6 @@ static unsigned short fts_stat(FTS *, FTSENT *, int);
static int fts_safe_changedir(const FTS *, const FTSENT *, int,
const char *);
-#if defined(ALIGNBYTES) && defined(ALIGN)
-#define FTS_ALLOC_ALIGNED 1
-#else
-#undef FTS_ALLOC_ALIGNED
-#endif
-
#ifndef ftsent_namelen_truncate
#define ftsent_namelen_truncate(a) \
((a) > UINT_MAX ? UINT_MAX : (unsigned int)(a))
@@ -989,29 +983,7 @@ static FTSENT *
fts_alloc(FTS *sp, const char *name, size_t namelen)
{
FTSENT *p;
-#if defined(FTS_ALLOC_ALIGNED)
- size_t len;
-#endif
-
-#if defined(FTS_ALLOC_ALIGNED)
- /*
- * The file name is a variable length array and no stat structure is
- * necessary if the user has set the nostat bit. Allocate the FTSENT
- * structure, the file name and the stat structure in one chunk, but
- * be careful that the stat structure is reasonably aligned. Since the
- * fts_name field is declared to be of size 1, the fts_name pointer is
- * namelen + 2 before the first possible address of the stat structure.
- */
- len = sizeof(FTSENT) + namelen;
- if (!ISSET(FTS_NOSTAT))
- len += sizeof(*(p->fts_statp)) + ALIGNBYTES;
- if ((p = malloc(len)) == NULL)
- return (NULL);
- if (!ISSET(FTS_NOSTAT))
- p->fts_statp = (__fts_stat_t *)ALIGN(
- (unsigned long)(p->fts_name + namelen + 2));
-#else
if ((p = malloc(sizeof(FTSENT) + namelen)) == NULL)
return (NULL);
@@ -1020,7 +992,6 @@ fts_alloc(FTS *sp, const char *name, size_t namelen)
free(p);
return (NULL);
}
-#endif
if (ISSET(FTS_NOSTAT))
p->fts_statp = NULL;
@@ -1041,10 +1012,7 @@ fts_alloc(FTS *sp, const char *name, size_t namelen)
static void
fts_free(FTSENT *p)
{
-#if !defined(FTS_ALLOC_ALIGNED)
- if (p->fts_statp)
- free(p->fts_statp);
-#endif
+ free(p->fts_statp);
free(p);
}
--
2.55.0
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.