Core: simplify record container (#1776)

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Sergey Gavrilov
2022-09-25 21:48:57 +10:00
committed by GitHub
parent eadd7801af
commit 92e440c77d
2 changed files with 42 additions and 37 deletions

17
lib/toolbox/m_cstr_dup.h Normal file
View File

@@ -0,0 +1,17 @@
#pragma once
#include <m-core.h>
#define M_INIT_DUP(a) ((a) = strdup(""))
#define M_SET_DUP(a, b) (M_CHECK_DEFAULT_TYPE(a), free((void*)a), (a) = strdup(b))
#define M_CLEAR_DUP(a) (free((void*)a))
#define M_CSTR_DUP_OPLIST \
(INIT(M_INIT_DUP), \
INIT_SET(M_SET_DUP), \
SET(M_SET_DUP), \
CLEAR(M_CLEAR_DUP), \
HASH(m_core_cstr_hash), \
EQUAL(M_CSTR_EQUAL), \
CMP(strcmp), \
TYPE(const char*), \
OUT_STR(M_CSTR_OUT_STR))