smap.h: map handling (key-value storage)
Map functions handle key-value storage, which is implemented as a
Red-Black tree (O(log n) time complexity for insert/read/delete)
Supported key/value modes (enum eSM_Type):
SM_II32: int32_t key, int32_t value
SM_UU32: uint32_t key, uint32_t value
SM_II: int64_t key, int64_t value
SM_FF: float (single-precision floating point) key, float value
SM_DD: double (double-precision floating point) key, double value
SM_IS: int64_t key, string value
SM_IP: int64_t key, pointer value
SM_SI: string key, int64_t value
SM_DS: double key, string value
SM_DP: double key, pointer value
SM_SD: string key, double value
SM_SS: string key, string value
SM_SP: string key, pointer value
Callback types for the sm_itr_*() functions:
typedef srt_bool (*srt_map_it_ii32)(int32_t k, int32_t v, void *context);
typedef srt_bool (*srt_map_it_uu32)(uint32_t k, uint32_t v, void *context);
typedef srt_bool (*srt_map_it_ii)(int64_t k, int64_t v, void *context);
typedef srt_bool (*srt_map_it_ff)(float k, float v, void *context);
typedef srt_bool (*srt_map_it_dd)(double k, double v, void *context);
typedef srt_bool (*srt_map_it_is)(int64_t k, const srt_string *, void *context);
typedef srt_bool (*srt_map_it_ip)(int64_t k, const void *, void *context);
typedef srt_bool (*srt_map_it_si)(const srt_string *, int64_t v, void *context);
typedef srt_bool (*srt_map_it_ds)(double k, const srt_string *, void *context);
typedef srt_bool (*srt_map_it_dp)(double k, const void *, void *context);
typedef srt_bool (*srt_map_it_sd)(const srt_string *, double v, void *context);
typedef srt_bool (*srt_map_it_ss)(const srt_string *, const srt_string *, void *context);
typedef srt_bool (*srt_map_it_sp)(const srt_string *, const void *, void *context);
srt_map *sm_alloc(enum eSM_Type t, size_t initial_num_elems_reserve)
- Allocate map (heap)
- enum eSM_Type t: map type
- size_t initial_num_elems_reserve: initial reserve
- Return (srt_map *): map
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_map *sm_alloca(enum eSM_Type t, size_t n)
- Allocate map (stack)
- enum eSM_Type t: map type
- size_t n: initial reserve
- Return (srt_map *): map
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
double sm_at_dd(const srt_map *m, double k)
- Access to map element (SM_DD)
- const srt_map *m: map
- double k: key
- Return (double): value
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
const void *sm_at_dp(const srt_map *m, double k)
- Access to map element (SM_DP)
- const srt_map *m: map
- double k: key
- Return (const void *): value
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
const srt_string *sm_at_ds(const srt_map *m, double k)
- Access to map element (SM_DS)
- const srt_map *m: map
- double k: key
- Return (const srt_string *): value
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
float sm_at_ff(const srt_map *m, float k)
- Access to map element (SM_FF)
- const srt_map *m: map
- float k: key
- Return (float): value
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
int64_t sm_at_ii(const srt_map *m, int64_t k)
- Access to map element (SM_II)
- const srt_map *m: map
- int64_t k: key
- Return (int64_t): value
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
int32_t sm_at_ii32(const srt_map *m, int32_t k)
- Access to map element (SM_II32)
- const srt_map *m: map
- int32_t k: key
- Return (int32_t): value
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
const void *sm_at_ip(const srt_map *m, int64_t k)
- Access to map element (SM_IP)
- const srt_map *m: map
- int64_t k: key
- Return (const void *): value
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
const srt_string *sm_at_is(const srt_map *m, int64_t k)
- Access to map element (SM_IS)
- const srt_map *m: map
- int64_t k: key
- Return (const srt_string *): value
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
double sm_at_sd(const srt_map *m, const srt_string *k)
- Access to map element (SM_SD)
- const srt_map *m: map
- const srt_string *k: key
- Return (double): value
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
int64_t sm_at_si(const srt_map *m, const srt_string *k)
- Access to map element (SM_SI)
- const srt_map *m: map
- const srt_string *k: key
- Return (int64_t): value
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
const void *sm_at_sp(const srt_map *m, const srt_string *k)
- Access to map element (SM_SP)
- const srt_map *m: map
- const srt_string *k: key
- Return (const void *): value
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
const srt_string *sm_at_ss(const srt_map *m, const srt_string *k)
- Access to map element (SM_SS)
- const srt_map *m: map
- const srt_string *k: key
- Return (const srt_string *): value
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
uint32_t sm_at_uu32(const srt_map *m, uint32_t k)
- Access to map element (SM_UU32)
- const srt_map *m: map
- uint32_t k: key
- Return (uint32_t): value
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_capacity(const srt_map *m)
- Allocated space
- const srt_map *m: map
- Return (size_t): current allocated space (vector elements)
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_capacity_left(const srt_map *m)
- Preallocated space left
- const srt_map *m: map
- Return (size_t): allocated space left
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
void sm_clear(srt_map *m)
- Reset/clean map (keeping map type)
- srt_map *m: map
- Return (void): -
- Time complexity: O(1) for simple maps, O(n) for maps having nodes with strings
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_count_d(const srt_map *m, double k)
- Map element count/check
- const srt_map *m: map (SM_D*)
- double k: key
- Return (size_t): S_TRUE: element found; S_FALSE: not in the map
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_count_f(const srt_map *m, float k)
- Map element count/check
- const srt_map *m: map (SM_FF)
- float k: key
- Return (size_t): S_TRUE: element found; S_FALSE: not in the map
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_count_i(const srt_map *m, int64_t k)
- Map element count/check
- const srt_map *m: map (SM_II)
- int64_t k: key
- Return (size_t): S_TRUE: element found; S_FALSE: not in the map
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_count_i32(const srt_map *m, int32_t k)
- Map element count/check (SM_II32)
- const srt_map *m: map
- int32_t k: key
- Return (size_t): S_TRUE: element found; S_FALSE: not in the map
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_count_s(const srt_map *m, const srt_string *k)
- Map element count/check
- const srt_map *m: map (SM_S*)
- const srt_string *k: key
- Return (size_t): S_TRUE: element found; S_FALSE: not in the map
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_count_u32(const srt_map *m, uint32_t k)
- Map element count/check
- const srt_map *m: map (SM_UU32)
- uint32_t k: key
- Return (size_t): S_TRUE: element found; S_FALSE: not in the map
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_map *sm_cpy(srt_map **m, const srt_map *src)
- Overwrite map with a map copy
- srt_map **m: output map
- const srt_map *src: input map
- Return (srt_map *): output map reference (optional usage)
- Time complexity: O(n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_delete_d(srt_map *m, double k)
- Delete map element (SM_D*)
- srt_map *m: map
- double k: key
- Return (srt_bool): S_TRUE: found and deleted; S_FALSE: not found
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [0/2] basic (Coverity, clang analyzer)
- Quality: [1/4] reviewed, with quality issues
srt_bool sm_delete_f(srt_map *m, float k)
- Delete map element (SM_FF)
- srt_map *m: map
- float k: key
- Return (srt_bool): S_TRUE: found and deleted; S_FALSE: not found
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [0/2] basic (Coverity, clang analyzer)
- Quality: [1/4] reviewed, with quality issues
srt_bool sm_delete_i(srt_map *m, int64_t k)
- Delete map element (SM_I*)
- srt_map *m: map
- int64_t k: key
- Return (srt_bool): S_TRUE: found and deleted; S_FALSE: not found
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_delete_i32(srt_map *m, int32_t k)
- Delete map element (SM_II32)
- srt_map *m: map
- int32_t k: key
- Return (srt_bool): S_TRUE: found and deleted; S_FALSE: not found
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_delete_s(srt_map *m, const srt_string *k)
- Delete map element (SM_S*)
- srt_map *m: map
- const srt_string *k: key
- Return (srt_bool): S_TRUE: found and deleted; S_FALSE: not found
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_delete_u32(srt_map *m, uint32_t k)
- Delete map element (SM_UU32)
- srt_map *m: map
- uint32_t k: key
- Return (srt_bool): S_TRUE: found and deleted; S_FALSE: not found
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_map *sm_dup(const srt_map *src)
- Duplicate map
- const srt_map *src: input map
- Return (srt_map *): output map
- Time complexity: O(n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_empty(const srt_map *m)
- Tells if a map is empty (zero elements)
- const srt_map *m: map
- Return (srt_bool): S_TRUE: empty; S_FALSE: not empty
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
void sm_free(srt_map **m, ...)
- Free one or more maps (heap)
- srt_map **m: map
- ...: more maps (optional)
- Return (void): -
- Time complexity: O(1) for simple maps, O(n) for maps having nodes with strings
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_grow(srt_map **m, size_t extra_elems)
- Ensure space for extra elements
- srt_map **m: map
- size_t extra_elems: number of extra elements
- Return (size_t): extra size allocated
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_inc_dd(srt_map **m, double k, double v)
- Increment map element (SM_DD)
- srt_map **m: map
- double k: key
- double v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_inc_ff(srt_map **m, float k, float v)
- Increment map element (SM_FF)
- srt_map **m: map
- float k: key
- float v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_inc_ii(srt_map **m, int64_t k, int64_t v)
- Increment map element (SM_II)
- srt_map **m: map
- int64_t k: key
- int64_t v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_inc_ii32(srt_map **m, int32_t k, int32_t v)
- Increment map element (SM_II32)
- srt_map **m: map
- int32_t k: key
- int32_t v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_inc_sd(srt_map **m, const srt_string *k, double v)
- Increment map element (SM_SD)
- srt_map **m: map
- const srt_string *k: key
- double v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_inc_si(srt_map **m, const srt_string *k, int64_t v)
- Increment map element (SM_SI)
- srt_map **m: map
- const srt_string *k: key
- int64_t v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_inc_uu32(srt_map **m, uint32_t k, uint32_t v)
- Increment map element (SM_UU32)
- srt_map **m: map
- uint32_t k: key
- uint32_t v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_insert_dd(srt_map **m, double k, double v)
- Insert map element (SM_DD)
- srt_map **m: map
- double k: key
- double v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_insert_dp(srt_map **m, double k, const void *v)
- Insert map element (SM_DP)
- srt_map **m: map
- double k: key
- const void *v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_insert_ds(srt_map **m, double k, const srt_string *v)
- Insert map element (SM_DS)
- srt_map **m: map
- double k: key
- const srt_string *v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_insert_ff(srt_map **m, float k, float v)
- Insert map element (SM_FF)
- srt_map **m: map
- float k: key
- float v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_insert_ii(srt_map **m, int64_t k, int64_t v)
- Insert map element
- srt_map **m: map (SM_II)
- int64_t k: key
- int64_t v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_insert_ii32(srt_map **m, int32_t k, int32_t v)
- Insert map element (SM_II32)
- srt_map **m: map
- int32_t k: key
- int32_t v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_insert_ip(srt_map **m, int64_t k, const void *v)
- Insert map element (SM_IP)
- srt_map **m: map
- int64_t k: key
- const void *v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_insert_is(srt_map **m, int64_t k, const srt_string *v)
- Insert map element (SM_IS)
- srt_map **m: map
- int64_t k: key
- const srt_string *v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_insert_sd(srt_map **m, const srt_string *k, double v)
- Insert map element (SM_SD)
- srt_map **m: map
- const srt_string *k: key
- double v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_insert_si(srt_map **m, const srt_string *k, int64_t v)
- Insert map element (SM_SI)
- srt_map **m: map
- const srt_string *k: key
- int64_t v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_insert_sp(srt_map **m, const srt_string *k, const void *v)
- Insert map element (SM_SP)
- srt_map **m: map
- const srt_string *k: key
- const void *v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_insert_ss(srt_map **m, const srt_string *k, const srt_string *v)
- Insert map element (SM_SS)
- srt_map **m: map
- const srt_string *k: key
- const srt_string *v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_bool sm_insert_uu32(srt_map **m, uint32_t k, uint32_t v)
- Insert map element (SM_UU32)
- srt_map **m: map
- uint32_t k: key
- uint32_t v: value
- Return (srt_bool): S_TRUE: OK, S_FALSE: insertion error
- Time complexity: O(log n)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
double sm_it_d_k(const srt_map *m, srt_tndx i)
- Enumerate map keys (SM_D*)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (double): double
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
double sm_it_dd_v(const srt_map *m, srt_tndx i)
- Enumerate map values (SM_DD)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (double): double
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
const void *sm_it_dp_v(const srt_map *m, srt_tndx i)
- Enumerate map values (SM_DP)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (const void *): pointer
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
const srt_string *sm_it_ds_v(const srt_map *m, srt_tndx i)
- Enumerate map values (SM_DS)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (const srt_string *): string
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
float sm_it_f_k(const srt_map *m, srt_tndx i)
- Enumerate map keys (SM_FF)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (float): float
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
float sm_it_ff_v(const srt_map *m, srt_tndx i)
- Enumerate map values (SM_FF)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (float): float
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
int32_t sm_it_i32_k(const srt_map *m, srt_tndx i)
- Enumerate map keys (SM_II32)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (int32_t): int32_t
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
int64_t sm_it_i_k(const srt_map *m, srt_tndx i)
- Enumerate map keys (SM_I*)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (int64_t): int64_t
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
int32_t sm_it_ii32_v(const srt_map *m, srt_tndx i)
- Enumerate map values (SM_II32)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (int32_t): int32_t
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
int64_t sm_it_ii_v(const srt_map *m, srt_tndx i)
- Enumerate map values (SM_II)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (int64_t): int64_t
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
const void *sm_it_ip_v(const srt_map *m, srt_tndx i)
- Enumerate map values (SM_IP)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (const void *): pointer
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
const srt_string *sm_it_is_v(const srt_map *m, srt_tndx i)
- Enumerate map values (SM_IS)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (const srt_string *): string
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
const srt_string *sm_it_s_k(const srt_map *m, srt_tndx i)
- Enumerate map keys (SM_S*)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (const srt_string *): string
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
double sm_it_sd_v(const srt_map *m, srt_tndx i)
- Enumerate map values (SM_SD)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (double): int64_t
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
int64_t sm_it_si_v(const srt_map *m, srt_tndx i)
- Enumerate map values (SM_SI)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (int64_t): int64_t
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
const void *sm_it_sp_v(const srt_map *m, srt_tndx i)
- Enumerate map (SM_SP)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (const void *): pointer
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
const srt_string *sm_it_ss_v(const srt_map *m, srt_tndx i)
- Enumerate map values (SM_SS)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (const srt_string *): string
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
uint32_t sm_it_u32_k(const srt_map *m, srt_tndx i)
- Enumerate map keys (SM_UU32)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (uint32_t): uint32_t
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
uint32_t sm_it_uu32_v(const srt_map *m, srt_tndx i)
- Enumerate map values (SM_UU32)
- const srt_map *m: map
- srt_tndx i: element, 0 to n - 1
- Return (uint32_t): uint32_t
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_itr_dd(const srt_map *m, double key_min, double key_max, srt_map_it_dd f, void *context)
- Enumerate map elements in a given key range (SM_DD)
- const srt_map *m: map
- double key_min: key lower bound
- double key_max: key upper bound
- srt_map_it_dd f: callback function
- void *context: callback function context
- Return (size_t): Elements processed
- Time complexity: O(log n) + O(log m)
- Space complexity: additional 2 * O(log n) space required, allocated on the stack, i.e. fast
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_itr_dp(const srt_map *m, double key_min, double key_max, srt_map_it_dp f, void *context)
- Enumerate map elements in a given key range (SM_DP)
- const srt_map *m: map
- double key_min: key lower bound
- double key_max: key upper bound
- srt_map_it_dp f: callback function
- void *context: callback function context
- Return (size_t): Elements processed
- Time complexity: O(log n) + O(log m)
- Space complexity: additional 2 * O(log n) space required, allocated on the stack, i.e. fast
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_itr_ds(const srt_map *m, double key_min, double key_max, srt_map_it_ds f, void *context)
- Enumerate map elements in a given key range (SM_DS)
- const srt_map *m: map
- double key_min: key lower bound
- double key_max: key upper bound
- srt_map_it_ds f: callback function
- void *context: callback function context
- Return (size_t): Elements processed
- Time complexity: O(log n) + O(log m)
- Space complexity: additional 2 * O(log n) space required, allocated on the stack, i.e. fast
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_itr_ff(const srt_map *m, float key_min, float key_max, srt_map_it_ff f, void *context)
- Enumerate map elements in a given key range (SM_FF)
- const srt_map *m: map
- float key_min: key lower bound
- float key_max: key upper bound
- srt_map_it_ff f: callback function
- void *context: callback function context
- Return (size_t): Elements processed
- Time complexity: O(log n) + O(log m)
- Space complexity: additional 2 * O(log n) space required, allocated on the stack, i.e. fast
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_itr_ii(const srt_map *m, int64_t key_min, int64_t key_max, srt_map_it_ii f, void *context)
- Enumerate map elements in a given key range (SM_II)
- const srt_map *m: map
- int64_t key_min: key lower bound
- int64_t key_max: key upper bound
- srt_map_it_ii f: callback function
- void *context: callback function context
- Return (size_t): Elements processed
- Time complexity: O(log n) + O(log m)
- Space complexity: additional 2 * O(log n) space required, allocated on the stack, i.e. fast
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_itr_ii32(const srt_map *m, int32_t key_min, int32_t key_max, srt_map_it_ii32 f, void *context)
- Enumerate map elements in a given key range (SM_II32)
- const srt_map *m: map
- int32_t key_min: key lower bound
- int32_t key_max: key upper bound
- srt_map_it_ii32 f: callback function
- void *context: callback function context
- Return (size_t): Elements processed
- Time complexity: O(log n) + O(log m)
- Space complexity: additional 2 * O(log n) space required, allocated on the stack, i.e. fast
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_itr_ip(const srt_map *m, int64_t key_min, int64_t key_max, srt_map_it_ip f, void *context)
- Enumerate map elements in a given key range (SM_IP)
- const srt_map *m: map
- int64_t key_min: key lower bound
- int64_t key_max: key upper bound
- srt_map_it_ip f: callback function
- void *context: callback function context
- Return (size_t): Elements processed
- Time complexity: O(log n) + O(log m)
- Space complexity: additional 2 * O(log n) space required, allocated on the stack, i.e. fast
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_itr_is(const srt_map *m, int64_t key_min, int64_t key_max, srt_map_it_is f, void *context)
- Enumerate map elements in a given key range (SM_IS)
- const srt_map *m: map
- int64_t key_min: key lower bound
- int64_t key_max: key upper bound
- srt_map_it_is f: callback function
- void *context: callback function context
- Return (size_t): Elements processed
- Time complexity: O(log n) + O(log m)
- Space complexity: additional 2 * O(log n) space required, allocated on the stack, i.e. fast
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_itr_sd(const srt_map *m, const srt_string *key_min, const srt_string *key_max, srt_map_it_sd f, void *context)
- Enumerate map elements in a given key range (SM_SD)
- const srt_map *m: map
- const srt_string *key_min: key lower bound
- const srt_string *key_max: key upper bound
- srt_map_it_sd f: callback function
- void *context: callback function context
- Return (size_t): Elements processed
- Time complexity: O(log n) + O(log m)
- Space complexity: additional 2 * O(log n) space required, allocated on the stack, i.e. fast
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_itr_si(const srt_map *m, const srt_string *key_min, const srt_string *key_max, srt_map_it_si f, void *context)
- Enumerate map elements in a given key range (SM_SI)
- const srt_map *m: map
- const srt_string *key_min: key lower bound
- const srt_string *key_max: key upper bound
- srt_map_it_si f: callback function
- void *context: callback function context
- Return (size_t): Elements processed
- Time complexity: O(log n) + O(log m)
- Space complexity: additional 2 * O(log n) space required, allocated on the stack, i.e. fast
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_itr_sp(const srt_map *m, const srt_string *key_min, const srt_string *key_max, srt_map_it_sp f, void *context)
- Enumerate map elements in a given key range (SM_SP)
- const srt_map *m: map
- const srt_string *key_min: key lower bound
- const srt_string *key_max: key upper bound
- srt_map_it_sp f: callback function
- void *context: callback function context
- Return (size_t): Elements processed
- Time complexity: O(log n) + O(log m)
- Space complexity: additional 2 * O(log n) space required, allocated on the stack, i.e. fast
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_itr_ss(const srt_map *m, const srt_string *key_min, const srt_string *key_max, srt_map_it_ss f, void *context)
- Enumerate map elements in a given key range (SM_SS)
- const srt_map *m: map
- const srt_string *key_min: key lower bound
- const srt_string *key_max: key upper bound
- srt_map_it_ss f: callback function
- void *context: callback function context
- Return (size_t): Elements processed
- Time complexity: O(log n) + O(log m)
- Space complexity: additional 2 * O(log n) space required, allocated on the stack, i.e. fast
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_itr_uu32(const srt_map *m, uint32_t key_min, uint32_t key_max, srt_map_it_uu32 f, void *context)
- Enumerate map elements in a given key range (SM_UU32)
- const srt_map *m: map
- uint32_t key_min: key lower bound
- uint32_t key_max: key upper bound
- srt_map_it_uu32 f: callback function
- void *context: callback function context
- Return (size_t): Elements processed
- Time complexity: O(log n) + O(log m)
- Space complexity: additional 2 * O(log n) space required, allocated on the stack, i.e. fast
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_reserve(srt_map **m, size_t max_elems)
- Ensure space for elements
- srt_map **m: map
- size_t max_elems: absolute element reserve
- Return (size_t): reserved elements
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
srt_map *sm_shrink(srt_map **m)
- Make the map use the minimum possible memory
- srt_map **m: map
- Return (srt_map *): map reference (optional usage)
- Time complexity: O(1) for allocators using memory remap
- Space complexity: O(n) for naive allocators
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)
size_t sm_size(const srt_map *m)
- Get map size
- const srt_map *m: map
- Return (size_t): Map number of elements
- Time complexity: O(1)
- Space complexity: no extra space
- Coverage: [1/2] test covered (test + Valgrind)
- Quality: [2/4] reviewed, clean (-Wall, style, speed)