diff options
| -rw-r--r-- | include/stc/carc.h | 2 | ||||
| -rw-r--r-- | include/stc/cbits.h | 4 | ||||
| -rw-r--r-- | include/stc/cbox.h | 4 | ||||
| -rw-r--r-- | include/stc/ccommon.h | 6 | ||||
| -rw-r--r-- | include/stc/cdeq.h | 8 | ||||
| -rw-r--r-- | include/stc/clist.h | 6 | ||||
| -rw-r--r-- | include/stc/cmap.h | 8 | ||||
| -rw-r--r-- | include/stc/cpque.h | 2 | ||||
| -rw-r--r-- | include/stc/crandom.h | 4 | ||||
| -rw-r--r-- | include/stc/csmap.h | 4 | ||||
| -rw-r--r-- | include/stc/cstack.h | 4 | ||||
| -rw-r--r-- | include/stc/cstr.h | 16 | ||||
| -rw-r--r-- | include/stc/csview.h | 8 | ||||
| -rw-r--r-- | include/stc/cvec.h | 10 | ||||
| -rw-r--r-- | misc/archived/csmap.h | 4 | ||||
| -rw-r--r-- | misc/archived/cstr.h | 4 | ||||
| -rw-r--r-- | misc/examples/vikings.c | 4 |
17 files changed, 49 insertions, 49 deletions
diff --git a/include/stc/carc.h b/include/stc/carc.h index fa2ee3b4..4f55aefb 100644 --- a/include/stc/carc.h +++ b/include/stc/carc.h @@ -93,7 +93,7 @@ _cx_deftypes(_c_carc_types, _cx_self, i_key); struct _cx_memb(_rep_) { catomic_long counter; i_key value; }; STC_INLINE _cx_self _cx_memb(_init)(void) - { return c_COMPOUND(_cx_self){NULL, NULL}; } + { return c_LITERAL(_cx_self){NULL, NULL}; } STC_INLINE long _cx_memb(_use_count)(const _cx_self* self) { return self->use_count ? *self->use_count : 0; } diff --git a/include/stc/cbits.h b/include/stc/cbits.h index b0cb7a9c..232be16b 100644 --- a/include/stc/cbits.h +++ b/include/stc/cbits.h @@ -123,7 +123,7 @@ STC_INLINE bool _cbits_disjoint(const uint64_t* set, const uint64_t* other, cons struct { uint64_t *data64; size_t _size; } typedef i_type; -STC_INLINE cbits cbits_init(void) { return c_COMPOUND(cbits){NULL}; } +STC_INLINE cbits cbits_init(void) { return c_LITERAL(cbits){NULL}; } STC_INLINE void cbits_create(cbits* self) { self->data64 = NULL; self->_size = 0; } STC_INLINE void cbits_drop(cbits* self) { c_FREE(self->data64); } STC_INLINE size_t cbits_size(const cbits* self) { return self->_size; } @@ -195,7 +195,7 @@ STC_INLINE cbits cbits_with_pattern(const size_t size, const uint64_t pattern) { struct { uint64_t data64[(i_capacity - 1)/64 + 1]; } typedef i_type; -STC_INLINE i_type _i_memb(_init)(void) { return c_COMPOUND(i_type){0}; } +STC_INLINE i_type _i_memb(_init)(void) { return c_LITERAL(i_type){0}; } STC_INLINE void _i_memb(_create)(i_type* self) {} STC_INLINE void _i_memb(_drop)(i_type* self) {} STC_INLINE size_t _i_memb(_size)(const i_type* self) { return i_capacity; } diff --git a/include/stc/cbox.h b/include/stc/cbox.h index 6dc41ed1..0b6c29ec 100644 --- a/include/stc/cbox.h +++ b/include/stc/cbox.h @@ -79,13 +79,13 @@ _cx_deftypes(_c_cbox_types, _cx_self, i_key); // constructors (take ownership) STC_INLINE _cx_self _cx_memb(_init)(void) - { return c_COMPOUND(_cx_self){NULL}; } + { return c_LITERAL(_cx_self){NULL}; } STC_INLINE long _cx_memb(_use_count)(const _cx_self* self) { return (long)(self->get != NULL); } STC_INLINE _cx_self _cx_memb(_from_ptr)(_cx_value* p) - { return c_COMPOUND(_cx_self){p}; } + { return c_LITERAL(_cx_self){p}; } // c++: std::make_unique<i_key>(val) STC_INLINE _cx_self _cx_memb(_make)(_cx_value val) { diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index b61c1972..34d297e3 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -71,12 +71,12 @@ #define c_ALLOC(T) static_cast<T*>(c_MALLOC(sizeof(T))) #define c_ALLOC_N(T, n) static_cast<T*>(c_MALLOC(sizeof(T)*(n))) #define c_NEW(T, ...) new (c_ALLOC(T)) T(__VA_ARGS__) - #define c_COMPOUND(T) T + #define c_LITERAL(T) T #else #define c_ALLOC(T) ((T*)c_MALLOC(sizeof(T))) #define c_ALLOC_N(T, n) ((T*)c_MALLOC(sizeof(T)*(n))) #define c_NEW(T, ...) ((T*)memcpy(c_ALLOC(T), (T[]){__VA_ARGS__}, sizeof(T))) - #define c_COMPOUND(T) (T) + #define c_LITERAL(T) (T) #endif #ifndef c_MALLOC #define c_MALLOC(sz) malloc(sz) @@ -125,7 +125,7 @@ typedef const char* crawstr; #define c_ARRAYLEN(a) (sizeof(a)/sizeof 0[a]) #define c_SV(...) c_MACRO_OVERLOAD(c_SV, __VA_ARGS__) #define c_SV_1(lit) c_SV_2(lit, crawstr_len(lit)) -#define c_SV_2(str, n) (c_COMPOUND(csview){str, n}) +#define c_SV_2(str, n) (c_LITERAL(csview){str, n}) #define c_ARGSV(sv) (int)(sv).size, (sv).str /* use with "%.*s" */ #define c_PAIR(ref) (ref)->first, (ref)->second diff --git a/include/stc/cdeq.h b/include/stc/cdeq.h index befb4146..d17182b1 100644 --- a/include/stc/cdeq.h +++ b/include/stc/cdeq.h @@ -101,11 +101,11 @@ STC_INLINE void _cx_memb(_pop_front)(_cx_self* self) // == _pop() when _ STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self) { size_t n = self->_len; - return c_COMPOUND(_cx_iter){n ? self->data : NULL, self->data + n}; + return c_LITERAL(_cx_iter){n ? self->data : NULL, self->data + n}; } STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self) - { return c_COMPOUND(_cx_iter){NULL, self->data + self->_len}; } + { return c_LITERAL(_cx_iter){NULL, self->data + self->_len}; } STC_INLINE void _cx_memb(_next)(_cx_iter* it) { if (++it->ref == it->end) it->ref = NULL; } @@ -345,7 +345,7 @@ _cx_memb(_insert_uninit)(_cx_self* self, _cx_value* pos, const size_t n) { self->_len += n; pos = self->data + idx; } - return c_COMPOUND(_cx_iter){pos, self->data + self->_len}; + return c_LITERAL(_cx_iter){pos, self->data + self->_len}; } STC_DEF _cx_value* @@ -377,7 +377,7 @@ _cx_memb(_erase_range_p)(_cx_self* self, _cx_value* p1, _cx_value* p2) { { i_keydrop(p); } memmove(p1, p2, (size_t)(end - p2)*sizeof *p1); self->_len -= (size_t)len; - return c_COMPOUND(_cx_iter){p2 == end ? NULL : p1, end - len}; + return c_LITERAL(_cx_iter){p2 == end ? NULL : p1, end - len}; } #if !defined i_no_clone diff --git a/include/stc/clist.h b/include/stc/clist.h index de32b931..fc4d8540 100644 --- a/include/stc/clist.h +++ b/include/stc/clist.h @@ -133,7 +133,7 @@ STC_INLINE _cx_value* _cx_memb(_emplace)(_cx_self* self, _cx_raw raw) { return _cx_memb(_push_back)(self, i_keyfrom(raw)); } #endif // !i_no_emplace -STC_INLINE _cx_self _cx_memb(_init)(void) { return c_COMPOUND(_cx_self){NULL}; } +STC_INLINE _cx_self _cx_memb(_init)(void) { return c_LITERAL(_cx_self){NULL}; } STC_INLINE void _cx_memb(_put_n)(_cx_self* self, const _cx_raw* raw, size_t n) { while (n--) _cx_memb(_push_back)(self, i_keyfrom(*raw++)); } STC_INLINE _cx_self _cx_memb(_from_n)(const _cx_raw* raw, size_t n) @@ -161,12 +161,12 @@ _cx_memb(_count)(const _cx_self* self) { STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self) { _cx_value* head = self->last ? &self->last->next->value : NULL; - return c_COMPOUND(_cx_iter){head, &self->last, self->last}; + return c_LITERAL(_cx_iter){head, &self->last, self->last}; } STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self) - { return c_COMPOUND(_cx_iter){NULL}; } + { return c_LITERAL(_cx_iter){NULL}; } STC_INLINE void _cx_memb(_next)(_cx_iter* it) { diff --git a/include/stc/cmap.h b/include/stc/cmap.h index c2f8cf3e..49d7d159 100644 --- a/include/stc/cmap.h +++ b/include/stc/cmap.h @@ -107,7 +107,7 @@ STC_API chash_bucket_t _cx_memb(_bucket_)(const _cx_self* self, const _cx_rawke STC_API _cx_result _cx_memb(_insert_entry_)(_cx_self* self, _cx_rawkey rkey); STC_API void _cx_memb(_erase_entry)(_cx_self* self, _cx_value* val); -STC_INLINE _cx_self _cx_memb(_init)(void) { return c_COMPOUND(_cx_self){0}; } +STC_INLINE _cx_self _cx_memb(_init)(void) { return c_LITERAL(_cx_self){0}; } STC_INLINE void _cx_memb(_shrink_to_fit)(_cx_self* self) { _cx_memb(_reserve)(self, self->size); } STC_INLINE float _cx_memb(_max_load_factor)(const _cx_self* self) { return (float)(i_max_load_factor); } STC_INLINE bool _cx_memb(_empty)(const _cx_self* map) { return !map->size; } @@ -166,7 +166,7 @@ _cx_memb(_emplace)(_cx_self* self, _cx_rawkey rkey _i_MAP_ONLY(, i_valraw rmappe STC_INLINE _cx_raw _cx_memb(_value_toraw)(const _cx_value* val) { return _i_SET_ONLY( i_keyto(val) ) - _i_MAP_ONLY( c_COMPOUND(_cx_raw){i_keyto((&val->first)), i_valto((&val->second))} ); + _i_MAP_ONLY( c_LITERAL(_cx_raw){i_keyto((&val->first)), i_valto((&val->second))} ); } STC_INLINE void @@ -222,7 +222,7 @@ STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self) { STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self) - { return c_COMPOUND(_cx_iter){NULL}; } + { return c_LITERAL(_cx_iter){NULL}; } STC_INLINE void _cx_memb(_next)(_cx_iter* it) { @@ -240,7 +240,7 @@ STC_INLINE _cx_iter _cx_memb(_find)(const _cx_self* self, _cx_rawkey rkey) { size_t idx; if (self->size && self->_hashx[idx = _cx_memb(_bucket_)(self, &rkey).idx]) - return c_COMPOUND(_cx_iter){self->table + idx, + return c_LITERAL(_cx_iter){self->table + idx, self->table + self->bucket_count, self->_hashx + idx}; return _cx_memb(_end)(self); diff --git a/include/stc/cpque.h b/include/stc/cpque.h index 83fcb684..8bb70216 100644 --- a/include/stc/cpque.h +++ b/include/stc/cpque.h @@ -45,7 +45,7 @@ STC_API void _cx_memb(_erase_at)(_cx_self* self, size_t idx); STC_API void _cx_memb(_push)(_cx_self* self, _cx_value value); STC_INLINE _cx_self _cx_memb(_init)(void) - { return c_COMPOUND(_cx_self){NULL}; } + { return c_LITERAL(_cx_self){NULL}; } STC_INLINE void _cx_memb(_put_n)(_cx_self* self, const _cx_raw* raw, size_t n) { while (n--) _cx_memb(_push)(self, i_keyfrom(*raw++)); } diff --git a/include/stc/crandom.h b/include/stc/crandom.h index 9cb23e93..5641d788 100644 --- a/include/stc/crandom.h +++ b/include/stc/crandom.h @@ -100,12 +100,12 @@ STC_INLINE double stc64_uniformf(stc64_t* rng, stc64_uniformf_t* dist) { /* Init uniform distributed float64 RNG, range [low, high). */ STC_INLINE stc64_uniformf_t stc64_uniformf_new(double low, double high) { - return c_COMPOUND(stc64_uniformf_t){low, high - low}; + return c_LITERAL(stc64_uniformf_t){low, high - low}; } /* Marsaglia polar method for gaussian/normal distribution, float64. */ STC_INLINE stc64_normalf_t stc64_normalf_new(double mean, double stddev) { - return c_COMPOUND(stc64_normalf_t){mean, stddev, 0.0, 0}; + return c_LITERAL(stc64_normalf_t){mean, stddev, 0.0, 0}; } /* -------------------------- IMPLEMENTATION ------------------------- */ diff --git a/include/stc/csmap.h b/include/stc/csmap.h index 67b2265e..fba08eba 100644 --- a/include/stc/csmap.h +++ b/include/stc/csmap.h @@ -143,7 +143,7 @@ _cx_memb(_clear)(_cx_self* self) STC_INLINE _cx_raw _cx_memb(_value_toraw)(const _cx_value* val) { return _i_SET_ONLY( i_keyto(val) ) - _i_MAP_ONLY( c_COMPOUND(_cx_raw){i_keyto((&val->first)), + _i_MAP_ONLY( c_LITERAL(_cx_raw){i_keyto((&val->first)), i_valto((&val->second))} ); } @@ -231,7 +231,7 @@ _cx_memb(_reserve)(_cx_self* self, const size_t cap) { _cx_node* nodes = (_cx_node*)c_REALLOC(self->nodes, (cap + 1)*sizeof(_cx_node)); if (!nodes) return false; - nodes[0] = c_COMPOUND(_cx_node){{0, 0}, 0}; + nodes[0] = c_LITERAL(_cx_node){{0, 0}, 0}; self->nodes = nodes; self->cap = (i_size)cap; return true; diff --git a/include/stc/cstack.h b/include/stc/cstack.h index a40b74de..2a4d620d 100644 --- a/include/stc/cstack.h +++ b/include/stc/cstack.h @@ -175,12 +175,12 @@ STC_INLINE i_keyraw _cx_memb(_value_toraw)(const _cx_value* val) #endif // !i_no_clone STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self) { - return c_COMPOUND(_cx_iter){self->_len ? (_cx_value*)self->data : NULL, + return c_LITERAL(_cx_iter){self->_len ? (_cx_value*)self->data : NULL, (_cx_value*)self->data + self->_len}; } STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self) - { return c_COMPOUND(_cx_iter){NULL, (_cx_value*)self->data + self->_len}; } + { return c_LITERAL(_cx_iter){NULL, (_cx_value*)self->data + self->_len}; } STC_INLINE void _cx_memb(_next)(_cx_iter* it) { if (++it->ref == it->end) it->ref = NULL; } diff --git a/include/stc/cstr.h b/include/stc/cstr.h index b500065e..04091968 100644 --- a/include/stc/cstr.h +++ b/include/stc/cstr.h @@ -71,7 +71,7 @@ STC_API char* _cstr_internal_move(cstr* self, size_t pos1, size_t pos2); /**************************** PUBLIC API **********************************/ #define cstr_lit(literal) cstr_from_n(literal, crawstr_len(literal)) -#define cstr_NULL (c_COMPOUND(cstr){{{0}, 0}}) +#define cstr_NULL (c_LITERAL(cstr){{{0}, 0}}) #define cstr_toraw(self) cstr_str(self) STC_API char* cstr_reserve(cstr* self, size_t cap); @@ -90,12 +90,12 @@ STC_API cstr cstr_replace_sv(csview sv, csview search, csview repl, unsigned STC_INLINE cstr_buf cstr_buffer(cstr* s) { return cstr_is_long(s) - ? c_COMPOUND(cstr_buf){s->lon.data, cstr_l_size(s), cstr_l_cap(s)} - : c_COMPOUND(cstr_buf){s->sml.data, cstr_s_size(s), cstr_s_cap}; + ? c_LITERAL(cstr_buf){s->lon.data, cstr_l_size(s), cstr_l_cap(s)} + : c_LITERAL(cstr_buf){s->sml.data, cstr_s_size(s), cstr_s_cap}; } STC_INLINE csview cstr_sv(const cstr* s) { - return cstr_is_long(s) ? c_COMPOUND(csview){s->lon.data, cstr_l_size(s)} - : c_COMPOUND(csview){s->sml.data, cstr_s_size(s)}; + return cstr_is_long(s) ? c_LITERAL(csview){s->lon.data, cstr_l_size(s)} + : c_LITERAL(csview){s->sml.data, cstr_s_size(s)}; } STC_INLINE cstr cstr_init(void) @@ -222,11 +222,11 @@ STC_INLINE csview cstr_u8_chr(const cstr* self, size_t u8idx) { STC_INLINE cstr_iter cstr_begin(const cstr* self) { csview sv = cstr_sv(self); - if (!sv.size) return c_COMPOUND(cstr_iter){NULL}; - return c_COMPOUND(cstr_iter){.u8 = {{sv.str, utf8_chr_size(sv.str)}}}; + if (!sv.size) return c_LITERAL(cstr_iter){NULL}; + return c_LITERAL(cstr_iter){.u8 = {{sv.str, utf8_chr_size(sv.str)}}}; } STC_INLINE cstr_iter cstr_end(const cstr* self) { - (void)self; return c_COMPOUND(cstr_iter){NULL}; + (void)self; return c_LITERAL(cstr_iter){NULL}; } STC_INLINE void cstr_next(cstr_iter* it) { it->ref += it->u8.chr.size; diff --git a/include/stc/csview.h b/include/stc/csview.h index c53cd1c0..4df735b3 100644 --- a/include/stc/csview.h +++ b/include/stc/csview.h @@ -37,7 +37,7 @@ STC_API size_t csview_find_sv(csview sv, csview search); STC_INLINE csview csview_from(const char* str) - { return c_COMPOUND(csview){str, strlen(str)}; } + { return c_LITERAL(csview){str, strlen(str)}; } STC_INLINE void csview_clear(csview* self) { *self = csview_NULL; } STC_INLINE size_t csview_size(csview sv) { return sv.size; } @@ -76,12 +76,12 @@ STC_INLINE csview csview_slice(csview sv, size_t p1, size_t p2) { /* utf8 iterator */ STC_INLINE csview_iter csview_begin(const csview* self) { - if (!self->size) return c_COMPOUND(csview_iter){NULL}; - return c_COMPOUND(csview_iter){.u8 = {{self->str, utf8_chr_size(self->str)}, + if (!self->size) return c_LITERAL(csview_iter){NULL}; + return c_LITERAL(csview_iter){.u8 = {{self->str, utf8_chr_size(self->str)}, self->str + self->size}}; } STC_INLINE csview_iter csview_end(const csview* self) { - return c_COMPOUND(csview_iter){.u8 = {{NULL}, self->str + self->size}}; + return c_LITERAL(csview_iter){.u8 = {{NULL}, self->str + self->size}}; } STC_INLINE void csview_next(csview_iter* it) { it->ref += it->u8.chr.size; diff --git a/include/stc/cvec.h b/include/stc/cvec.h index 8010aea3..0905526a 100644 --- a/include/stc/cvec.h +++ b/include/stc/cvec.h @@ -199,11 +199,11 @@ _cx_memb(_at_mut)(_cx_self* self, const size_t idx) { STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self) { size_t n = self->_len; - return c_COMPOUND(_cx_iter){n ? self->data : NULL, self->data + n}; + return c_LITERAL(_cx_iter){n ? self->data : NULL, self->data + n}; } STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self) - { return c_COMPOUND(_cx_iter){NULL, self->data + self->_len}; } + { return c_LITERAL(_cx_iter){NULL, self->data + self->_len}; } STC_INLINE void _cx_memb(_next)(_cx_iter* it) { if (++it->ref == it->end) it->ref = NULL; } @@ -259,7 +259,7 @@ _cx_memb(_sort)(_cx_self* self) { STC_DEF _cx_self _cx_memb(_init)(void) { - return c_COMPOUND(_cx_self){NULL}; + return c_LITERAL(_cx_self){NULL}; } STC_DEF void @@ -328,7 +328,7 @@ _cx_memb(_insert_uninit)(_cx_self* self, _cx_value* pos, const size_t n) { memmove(pos + n, pos, (self->_len - idx)*sizeof *pos); self->_len += n; } - return c_COMPOUND(_cx_iter){pos, self->data + self->_len}; + return c_LITERAL(_cx_iter){pos, self->data + self->_len}; } STC_DEF _cx_iter @@ -348,7 +348,7 @@ _cx_memb(_erase_range_p)(_cx_self* self, _cx_value* p1, _cx_value* p2) { { i_keydrop(p); } memmove(p1, p2, (size_t)(end - p2)*sizeof *p1); self->_len -= len; - return c_COMPOUND(_cx_iter){p2 == end ? NULL : p1, end - len}; + return c_LITERAL(_cx_iter){p2 == end ? NULL : p1, end - len}; } #if !defined i_no_clone diff --git a/misc/archived/csmap.h b/misc/archived/csmap.h index 2daec3b9..6f3ee98b 100644 --- a/misc/archived/csmap.h +++ b/misc/archived/csmap.h @@ -129,7 +129,7 @@ _cx_memb(_clear)(_cx_self* self) STC_INLINE _cx_raw _cx_memb(_value_toraw)(_cx_value* val) { return _i_SET_ONLY( i_keyto(val) ) - _i_MAP_ONLY( c_COMPOUND(_cx_raw){i_keyto((&val->first)), + _i_MAP_ONLY( c_LITERAL(_cx_raw){i_keyto((&val->first)), i_valto((&val->second))} ); } @@ -470,7 +470,7 @@ _cx_memb(_clone_r_)(_cx_node *tn) { STC_DEF _cx_self _cx_memb(_clone)(_cx_self cx) { - return c_COMPOUND(_cx_self){_cx_memb(_clone_r_)(cx.root), cx.size}; + return c_LITERAL(_cx_self){_cx_memb(_clone_r_)(cx.root), cx.size}; } #endif // !i_no_clone diff --git a/misc/archived/cstr.h b/misc/archived/cstr.h index 1a5b0da4..f4e9dde2 100644 --- a/misc/archived/cstr.h +++ b/misc/archived/cstr.h @@ -67,7 +67,7 @@ STC_INLINE cstr cstr_init() { return cstr_NULL; } STC_INLINE const char* cstr_str(const cstr* self) { return self->str; } #define cstr_toraw(self) (self)->str STC_INLINE csview cstr_sv(const cstr* self) - { return c_COMPOUND(csview){self->str, _cstr_p(self)->size}; } + { return c_LITERAL(csview){self->str, _cstr_p(self)->size}; } #define cstr_lit(literal) \ cstr_from_n(literal, crawstr_len(literal)) STC_INLINE cstr cstr_from(const char* str) @@ -118,7 +118,7 @@ STC_INLINE bool cstr_getline(cstr *self, FILE *stream) STC_INLINE cstr_buf cstr_buffer(cstr* s) { cstr_priv* p = _cstr_p(s); - return c_COMPOUND(cstr_buf){s->str, p->size, p->cap}; + return c_LITERAL(cstr_buf){s->str, p->size, p->cap}; } STC_INLINE cstr cstr_with_capacity(const size_t cap) { diff --git a/misc/examples/vikings.c b/misc/examples/vikings.c index a050b324..86d60519 100644 --- a/misc/examples/vikings.c +++ b/misc/examples/vikings.c @@ -23,11 +23,11 @@ static inline int RViking_cmp(const RViking* rx, const RViking* ry) { } static inline Viking Viking_from(RViking raw) { // note: parameter is by value - return c_COMPOUND(Viking){cstr_from(raw.name), cstr_from(raw.country)}; + return c_LITERAL(Viking){cstr_from(raw.name), cstr_from(raw.country)}; } static inline RViking Viking_toraw(const Viking* vp) { - return c_COMPOUND(RViking){cstr_str(&vp->name), cstr_str(&vp->country)}; + return c_LITERAL(RViking){cstr_str(&vp->name), cstr_str(&vp->country)}; } // With this in place, we define the Viking => int hash map type: |
