Skip to content

Commit 33f7174

Browse files
budget: rename Init to snake_case + add PascalCase macro wrappers
Convention says FooInit is a macro at the public surface. Budget had real functions, BudgetAllocatorInit and BudgetAllocatorInitAligned. Both return BudgetAllocator by value, so the existing return-by-value ergonomics callers depend on (BudgetAllocator bp = BudgetAllocatorInit (...);) carry over unchanged: the macros are thin pass-through wrappers over the renamed budget_allocator_init / _aligned helpers. All test callers continue to use the PascalCase name and need no updates.
1 parent 6288c6f commit 33f7174

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

Include/Misra/Std/Allocator/Budget.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ extern "C" {
104104
///
105105
/// TAGS: Allocator, Budget, Init
106106
///
107-
BudgetAllocator BudgetAllocatorInit(void *buf, size buf_bytes, size slot_size);
107+
BudgetAllocator budget_allocator_init(void *buf, size buf_bytes, size slot_size);
108+
#define BudgetAllocatorInit(buf, buf_bytes, slot_size) budget_allocator_init((buf), (buf_bytes), (slot_size))
108109

109110
///
110111
/// Initialize a `BudgetAllocator` with an alignment floor. Slot size
@@ -118,7 +119,9 @@ extern "C" {
118119
///
119120
/// TAGS: Allocator, Budget, Init, Alignment
120121
///
121-
BudgetAllocator BudgetAllocatorInitAligned(void *buf, size buf_bytes, size slot_size, size alignment);
122+
BudgetAllocator budget_allocator_init_aligned(void *buf, size buf_bytes, size slot_size, size alignment);
123+
#define BudgetAllocatorInitAligned(buf, buf_bytes, slot_size, alignment) \
124+
budget_allocator_init_aligned((buf), (buf_bytes), (slot_size), (alignment))
122125

123126
///
124127
/// Tear down a `BudgetAllocator`. No-op for the backing memory (the

Source/Misra/Std/Allocator/Budget.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,11 @@ static BudgetAllocator budget_build(void *buf_in, size buf_bytes, size slot_size
272272
};
273273
}
274274

275-
BudgetAllocator BudgetAllocatorInit(void *buf, size buf_bytes, size slot_size) {
275+
BudgetAllocator budget_allocator_init(void *buf, size buf_bytes, size slot_size) {
276276
return budget_build(buf, buf_bytes, slot_size, sizeof(void *));
277277
}
278278

279-
BudgetAllocator BudgetAllocatorInitAligned(void *buf, size buf_bytes, size slot_size, size alignment) {
279+
BudgetAllocator budget_allocator_init_aligned(void *buf, size buf_bytes, size slot_size, size alignment) {
280280
return budget_build(buf, buf_bytes, slot_size, alignment);
281281
}
282282

0 commit comments

Comments
 (0)