Skip to content

Allocate dmlist_create() on the caller's own DMOD_CURRENT_ALLOCATOR - #11

Merged
JohnAmadis merged 1 commit into
masterfrom
claude/epic-hopper-jck8tq
Sep 19, 2026
Merged

JohnAmadis merged 1 commit into
masterfrom
claude/epic-hopper-jck8tq

Conversation

@JohnAmadis

Copy link
Copy Markdown
Contributor

Summary

Companion PR to choco-technologies/dmod#307, which requires DMOD_CURRENT_ALLOCATOR to be defined on the system side too (it used to default to NULL/anonymous there).

  • Renamed the dmlist_create Built-in API to dmlist_create_ex(module_name) (implementation in src/dmlist.c, declaration in include/dmlist.h) - same behavior, explicit-owner allocation.
  • Added dmlist_create() back as a macro: #define dmlist_create() dmlist_create_ex(DMOD_CURRENT_ALLOCATOR). Every caller - an application module, a library module, or a system-side library - now gets its list allocated under its own identity automatically, the same way Dmod_Malloc/Dmod_Free already work, instead of having to pass its own name explicitly.
  • Updated tests/test_simple.c and README.md examples to the new zero-argument dmlist_create() call.
  • tests/CMakeLists.txt: added dmod_set_current_allocator(test_simple) so the raw test executable (not built through create_library_makefile()) satisfies dmod_sal.h's new requirement.
  • Manually mirrored the DMOD_CURRENT_ALLOCATOR="dmlist" compile definition into the committed root Makefile (used for Make-based builds) - this file already appears to have drifted from what CMake would currently regenerate (missing src/dmlist_registrations.c), so this PR makes only the one targeted addition rather than a full regeneration.

Depends on

This needs choco-technologies/dmod#307 merged first - until then, building this against dmod's develop branch will hit the new #error in dmod_sal.h unless DMOD_CURRENT_ALLOCATOR is otherwise defined.

Test plan

  • Built dmlist + test_simple against a local copy of the dmod branch from PR #307 (-DFETCHCONTENT_SOURCE_DIR_DMOD=...) - compiles cleanly, DMOD_CURRENT_ALLOCATOR="dmlist" correctly injected.
  • Confirmed (by building the unmodified test_simple against unmodified dmod) that the pre-existing __dmod_inputs_end/__dmod_outputs_end link failure for that test target is not caused by this change - it reproduces identically without any of these changes.
  • CI build.

🤖 Generated with Claude Code

https://claude.ai/code/session_01E7dx6Rd66adYqPjRLyE1GM


Generated by Claude Code

dmlist_create() used to require every caller to pass its own module
name explicitly. Rename the underlying Built-in API to
dmlist_create_ex(module_name) and add dmlist_create() back as a macro
that forwards to it with DMOD_CURRENT_ALLOCATOR (see dmod's dmod_sal.h)
- the identity of whoever calls it, whether that's a module or a
system-side library. This matches how Dmod_Malloc/Dmod_Free already
attribute allocations, and callers that do need to attribute a list to
someone other than themselves can still call dmlist_create_ex()
directly.

Requires dmod's DMOD_CURRENT_ALLOCATOR system-side support (see the
companion dmod PR).
@JohnAmadis
JohnAmadis merged commit 4be0861 into master Sep 19, 2026
JohnAmadis pushed a commit to choco-technologies/dmvfs that referenced this pull request Sep 19, 2026
dmlist_create() is now a macro that forwards to dmlist_create_ex()
with the caller's own DMOD_CURRENT_ALLOCATOR instead of taking an
explicit module name (see choco-technologies/dmlist#11) - update the
one call site in tests/main.c accordingly.

Verified: full CMake build of the fs_tester test binary against the
now-merged dmod (develop) and dmlist's fix branch compiles and links
cleanly.
JohnAmadis pushed a commit to choco-technologies/dmod-boot that referenced this pull request Sep 19, 2026
dmvfs.c includes dmfsi.h, whose inline helpers (dmfsi_strndup,
dmfsi_path_create, ...) use the plain Dmod_Malloc/Dmod_Free macros -
these expand into whatever translation unit includes the header, so
dmvfs's own compilation now needs DMOD_CURRENT_ALLOCATOR defined too,
not just dmfsi's:

  error: DMOD_CURRENT_ALLOCATOR must be defined manually on the system side

choco-technologies/dmvfs already fixed this on its develop branch
(PR #55, same coordinated rollout as the previous two bumps), but that
same PR range also lands PR #56, which updates dmvfs's call site for
dmlist's dmlist_create() - that function changed from taking an explicit
module-name argument to a zero-arg macro that pulls DMOD_CURRENT_ALLOCATOR
in automatically (choco-technologies/dmlist#11, from the same rollout).
Taking the dmvfs fix without the matching dmlist bump would trade one
compile error for another (argument-count mismatch), so bump both
together. Both bumps verified ancestor-safe via git merge-base
--is-ancestor; nothing else in this repo's submodule tree calls
dmlist_create() directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants