git: 53cbd14ea7ca - main - rtld: extract donelist heap allocation into donelist_alloc()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 29 Oct 2026 15:56:15 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=53cbd14ea7ca78c140ee90c1e459589bb574d938
commit 53cbd14ea7ca78c140ee90c1e459589bb574d938
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-10-25 17:57:39 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-10-29 15:55:37 +0000
rtld: extract donelist heap allocation into donelist_alloc()
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
---
libexec/rtld-elf/rtld.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 7ca5f9ada09f..0ec2b8d17189 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -1040,21 +1040,26 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
#define DLP_ALLOCA_LIMIT 100 /* 800 bytes on LP64 */
#define donelist_init(_DLP, _REQ) do { \
DoneList *_dlp = _DLP; \
- SymLook *_r = _REQ; \
_dlp->num_alloc = obj_count; \
_dlp->req = NULL; \
if (_dlp->num_alloc > DLP_ALLOCA_LIMIT) { \
- _dlp->objs = xcalloc(_dlp->num_alloc, sizeof(_dlp->objs[0])); \
- if (_r != NULL && _r->donelist_mem == NULL) { \
- _r->donelist_mem = _dlp->objs; \
- _dlp->req = _r; \
- } \
+ donelist_alloc(_dlp, _REQ); \
} else { \
_dlp->objs = alloca(_dlp->num_alloc * sizeof(_dlp->objs[0])); \
} \
_dlp->num_used = 0; \
} while (0)
+static void
+donelist_alloc(DoneList *dlp, SymLook *req)
+{
+ dlp->objs = xcalloc(dlp->num_alloc, sizeof(dlp->objs[0]));
+ if (req != NULL && req->donelist_mem == NULL) {
+ req->donelist_mem = dlp->objs;
+ dlp->req = req;
+ }
+}
+
static void
donelist_free(DoneList *dlp)
{