ソースを参照

Update macros for list find function

Allow current item pointer to have custom type.
feature/data-structs
コミット
25eefd8173
3個のファイルの変更5行の追加5行の削除
  1. +1
    -1
      src/packages/game/data/IZ_list.h
  2. +3
    -3
      src/packages/game/data/data.test.c
  3. +1
    -1
      src/packages/game/memory/IZ_pool.c

+ 1
- 1
src/packages/game/data/IZ_list.h ファイルの表示

@@ -22,7 +22,7 @@ void IZ_ListTeardown(IZ_List*);

IZ_ListNode* IZ_ListAppendNode(IZ_List*, void*);

#define IZ_LIST_FILTER_FUNCTION(X) static IZ_PoolItem* X = NULL;
#define IZ_ListFilterFunctionArgs(X) static X = NULL;

void _IZ_ListDeleteFirstNode(IZ_List*, IZ_ListFindFilter);



+ 3
- 3
src/packages/game/data/data.test.c ファイルの表示

@@ -3,15 +3,15 @@
#include "../../../__mocks__/SDL_stdinc.mock.h"
#include "IZ_list.h"

bool NodeExists(IZ_ListNode* node, u64 _index) {
IZ_ListFilterFunctionArgs(IZ_ListNode* __current_item_NodeExists) bool NodeExists(IZ_ListNode* node, u64 _index) {
return *((u64*) node->value) == 42069;
}

bool NodeExists2(IZ_ListNode* node, u64 _index) {
IZ_ListFilterFunctionArgs(IZ_ListNode* __current_item_NodeExists2) bool NodeExists2(IZ_ListNode* node, u64 _index) {
return *((u64*) node->value) == 69420;
}

bool NodeDoesNotExist(IZ_ListNode* node, u64 _index) {
IZ_ListFilterFunctionArgs(IZ_ListNode* __current_item_NodeDoesNotExist) bool NodeDoesNotExist(IZ_ListNode* node, u64 _index) {
return *((u64*) node->value) == 55555;
}



+ 1
- 1
src/packages/game/memory/IZ_pool.c ファイルの表示

@@ -37,7 +37,7 @@ IZ_PoolItem* IZ_PoolAllocate(IZ_Pool* pool, IZ_PoolAllocationArgs args) {
return new_item->value;
}

IZ_LIST_FILTER_FUNCTION(__current_item) bool IZ_PoolGetSameItem(IZ_ListNode* node, u64 _index) {
IZ_ListFilterFunctionArgs(IZ_PoolItem* __current_item) bool IZ_PoolGetSameItem(IZ_ListNode* node, u64 _index) {
return node->value == __current_item;
}



読み込み中…
キャンセル
保存