libamxc  1.10.3
C Generic Data Containers
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
variant_htable.c
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** SPDX-License-Identifier: BSD-2-Clause-Patent
4 **
5 ** SPDX-FileCopyrightText: Copyright (c) 2023 SoftAtHome
6 **
7 ** Redistribution and use in source and binary forms, with or without modification,
8 ** are permitted provided that the following conditions are met:
9 **
10 ** 1. Redistributions of source code must retain the above copyright notice,
11 ** this list of conditions and the following disclaimer.
12 **
13 ** 2. Redistributions in binary form must reproduce the above copyright notice,
14 ** this list of conditions and the following disclaimer in the documentation
15 ** and/or other materials provided with the distribution.
16 **
17 ** Subject to the terms and conditions of this license, each copyright holder
18 ** and contributor hereby grants to those receiving rights under this license
19 ** a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
20 ** (except for failure to satisfy the conditions of this license) patent license
21 ** to make, have made, use, offer to sell, sell, import, and otherwise transfer
22 ** this software, where such license applies only to those patent claims, already
23 ** acquired or hereafter acquired, licensable by such copyright holder or contributor
24 ** that are necessarily infringed by:
25 **
26 ** (a) their Contribution(s) (the licensed copyrights of copyright holders and
27 ** non-copyrightable additions of contributors, in source or binary form) alone;
28 ** or
29 **
30 ** (b) combination of their Contribution(s) with the work of authorship to which
31 ** such Contribution(s) was added by such copyright holder or contributor, if,
32 ** at the time the Contribution is added, such addition causes such combination
33 ** to be necessarily infringed. The patent license shall not apply to any other
34 ** combinations which include the Contribution.
35 **
36 ** Except as expressly stated above, no rights or licenses from any copyright
37 ** holder or contributor is granted under this license, whether expressly, by
38 ** implication, estoppel or otherwise.
39 **
40 ** DISCLAIMER
41 **
42 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
43 ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
45 ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
46 ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
47 ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
48 ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
49 ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
50 ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
51 ** USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52 **
53 ****************************************************************************/
54 
55 #include <stdlib.h>
56 #include <string.h>
57 #include <stdio.h>
58 
59 #include <amxc/amxc_string.h>
60 #include <amxc_variant_priv.h>
61 
62 static int variant_htable_init(amxc_var_t* const var) {
63  return amxc_htable_init(&var->data.vm, 10);
64 }
65 
69 }
70 
73 }
74 
75 static int variant_htable_copy_htable(amxc_var_t* const dest,
76  const amxc_htable_t* const src_htable) {
77  int retval = -1;
78 
79  amxc_htable_for_each(it, src_htable) {
80  amxc_var_t* var = NULL;
82  const char* key = amxc_htable_it_get_key(it);
83  when_null(item, exit);
84  when_failed(amxc_var_new(&var), exit);
85  if(amxc_var_copy(var, item) != 0) {
87  goto exit;
88  }
89  amxc_htable_insert(&dest->data.vm, key, &var->hit);
90  }
91 
92  retval = 0;
93 
94 exit:
95  return retval;
96 }
97 
98 static int variant_htable_copy(amxc_var_t* const dest,
99  const amxc_var_t* const src) {
100  const amxc_htable_t* htable = &src->data.vm;
101  return variant_htable_copy_htable(dest, htable);
102 }
103 
104 static int variant_htable_move(amxc_var_t* const dest,
105  amxc_var_t* const src) {
106  int retval = 0;
107  amxc_htable_t* src_htable = &src->data.vm;
108  amxc_htable_t* dst_htable = &dest->data.vm;
109  retval = amxc_htable_move(dst_htable, src_htable);
110  return retval;
111 }
112 
113 // TODO - refactor function to long
114 static int variant_htable_to_string(amxc_var_t* const dest,
115  const amxc_var_t* const src) {
116  int retval = -1;
117  const amxc_htable_t* htable = &src->data.vm;
118  amxc_string_t string;
119  amxc_var_t intermediate;
120  const char* sep = "";
121 
122  amxc_var_init(&intermediate);
123  when_failed(amxc_string_init(&string, 100), exit);
124 
127  const char* key = amxc_htable_it_get_key(it);
128  size_t length = 0;
129  size_t key_length = 0;
130  if(amxc_var_convert(&intermediate, item, AMXC_VAR_ID_CSTRING) != 0) {
131  amxc_string_clean(&string);
132  goto exit;
133  }
134  if(*sep != 0) {
135  if(amxc_string_append(&string, sep, strlen(sep)) != 0) {
136  amxc_string_clean(&string);
137  goto exit;
138  }
139  }
140  key_length = strlen(key);
141  if(key_length != 0) {
142  if(amxc_string_append(&string, key, key_length) != 0) {
143  amxc_string_clean(&string);
144  goto exit;
145  }
146  }
147  if(amxc_string_append(&string, ":", 1) != 0) {
148  amxc_string_clean(&string);
149  goto exit;
150  }
151  length = intermediate.data.s == NULL ? 0 : strlen(intermediate.data.s);
152  if(length == 0) {
153  continue;
154  }
155  if(amxc_string_append(&string, intermediate.data.s, length) != 0) {
156  amxc_string_clean(&string);
157  goto exit;
158  }
159  sep = ",";
160  }
161 
162  string.buffer[string.last_used] = 0;
163  dest->data.s = string.buffer;
164  retval = 0;
165 
166 exit:
167  amxc_var_clean(&intermediate);
168  return retval;
169 }
170 
171 static int variant_htable_to_number(amxc_var_t* const dest,
172  const amxc_var_t* const src) {
173  int retval = -1;
174 
175  amxc_var_t intermediate;
176  intermediate.type_id = AMXC_VAR_ID_UINT64;
177  intermediate.data.ui64 = amxc_htable_size(&src->data.vm);
178 
179  retval = amxc_var_convert(dest, &intermediate, dest->type_id);
180 
181  return retval;
182 }
183 
184 static int variant_htable_to_bool(amxc_var_t* const dest,
185  const amxc_var_t* const src) {
186  dest->data.b = !amxc_htable_is_empty(&src->data.vm);
187 
188  return 0;
189 }
190 
191 static int variant_htable_to_llist(amxc_var_t* const dest,
192  const amxc_var_t* const src) {
193  int retval = -1;
194  const amxc_htable_t* htable = &src->data.vm;
195 
197  amxc_var_t* copy = NULL;
199 
200  when_failed(amxc_var_new(&copy), exit);
201  if(amxc_var_copy(copy, item) != 0) {
202  amxc_var_delete(&copy);
203  goto exit;
204  }
205  if(amxc_llist_append(&dest->data.vl, &copy->lit) != 0) {
206  amxc_var_delete(&copy);
207  goto exit;
208  }
209  }
210 
211  retval = 0;
212 
213 exit:
214  return retval;
215 }
216 
217 static int variant_htable_convert_to(amxc_var_t* const dest,
218  const amxc_var_t* const src) {
219  int retval = -1;
220 
237  NULL,
238  NULL,
242  };
243 
244  if(dest->type_id >= AMXC_VAR_ID_CUSTOM_BASE) {
245  goto exit;
246  }
247 
248  if(convfn[dest->type_id] != NULL) {
249  if(dest->type_id == AMXC_VAR_ID_ANY) {
251  }
252  retval = convfn[dest->type_id](dest, src);
253  }
254 
255 exit:
256  return retval;
257 }
258 
260  const char* const key,
261  int flags) {
262  amxc_var_t* retval = NULL;
263  const amxc_htable_t* htable = &src->data.vm;
265  amxc_var_t* src_var = NULL;
266 
267  when_null(hit, exit);
268 
269  src_var = amxc_htable_it_get_data(hit, amxc_var_t, hit);
270  if((flags & AMXC_VAR_FLAG_COPY) == AMXC_VAR_FLAG_COPY) {
271  when_failed(amxc_var_new(&retval), exit);
272  when_failed(amxc_var_copy(retval, src_var), exit);
273  } else {
274  retval = src_var;
275  }
276 
277 exit:
278  return retval;
279 }
280 
281 static int variant_htable_set_key(amxc_var_t* const dest,
282  amxc_var_t* const src,
283  const char* const key,
284  int flags) {
285  int retval = -1;
286  amxc_var_t* dest_var = NULL;
287  amxc_htable_t* htable = &dest->data.vm;
288  amxc_htable_it_t* current_hit = amxc_htable_take(htable, key);
289 
290  if((current_hit != NULL) &&
291  ((flags & AMXC_VAR_FLAG_UPDATE) == 0)) {
292  amxc_htable_insert(htable, key, current_hit);
293  goto exit;
294  }
295 
296  if((flags & AMXC_VAR_FLAG_COPY) == AMXC_VAR_FLAG_COPY) {
297  if(current_hit != NULL) {
298  dest_var = amxc_htable_it_get_data(current_hit, amxc_var_t, hit);
299  } else {
300  when_failed(amxc_var_new(&dest_var), exit);
301  }
302 
303  when_failed(amxc_htable_insert(htable, key, &dest_var->hit), exit);
304  when_failed(amxc_var_copy(dest_var, src), exit);
305  } else {
306  when_failed(amxc_htable_insert(htable, key, &src->hit), exit);
307  if(current_hit != NULL) {
309  }
310  }
311 
312  retval = 0;
313 
314 exit:
315  if((current_hit == NULL) && (retval != 0)) {
316  amxc_var_delete(&dest_var);
317  }
318  return retval;
319 }
320 
322  const int64_t index,
323  int flags) {
324  amxc_var_t* retval = NULL;
325  const amxc_htable_t* htable = &src->data.vm;
326  amxc_htable_it_t* found_hit = NULL;
327  amxc_var_t* src_var = NULL;
328  int64_t pos = 0;
329 
330  when_true(index < 0, exit);
331  when_true(index > (int64_t) amxc_htable_size(htable), exit);
333  if(pos == index) {
334  found_hit = hit;
335  break;
336  }
337  pos++;
338  }
339  when_null(found_hit, exit);
340 
341  src_var = amxc_var_from_htable_it(found_hit);
342  if((flags & AMXC_VAR_FLAG_COPY) == AMXC_VAR_FLAG_COPY) {
343  when_failed(amxc_var_new(&retval), exit);
344  when_failed(amxc_var_copy(retval, src_var), exit);
345  } else {
346  retval = src_var;
347  }
348 
349 exit:
350  return retval;
351 }
352 
353 static int variant_htable_compare(const amxc_var_t* const lval,
354  const amxc_var_t* const rval,
355  int* const result) {
356  int ret = 0;
359  size_t size_l = amxc_array_size(keys_l);
360  size_t size_r = amxc_array_size(keys_r);
361 
362  if(size_l > size_r) {
363  *result = 1;
364  goto exit;
365  } else if(size_l < size_r) {
366  *result = -1;
367  goto exit;
368  }
369 
370  for(size_t i = 0; i < size_l; i++) {
371  const char* key_l = (const char*) amxc_array_get_data_at(keys_l, i);
372  const char* key_r = (const char*) amxc_array_get_data_at(keys_r, i);
373 
374  if((key_l == NULL) || (key_r == NULL)) {
375  continue;
376  }
377  *result = strcmp(key_l, key_r);
378  when_false(*result == 0, exit);
379 
382  result);
383  when_false((ret == 0) && (*result == 0), exit);
384  }
385 
386 exit:
387  amxc_array_delete(&keys_l, NULL);
388  amxc_array_delete(&keys_r, NULL);
389  return ret;
390 }
391 
394  .del = variant_htable_delete,
395  .copy = variant_htable_copy,
396  .move = variant_htable_move,
397  .convert_from = NULL,
398  .convert_to = variant_htable_convert_to,
399  .compare = variant_htable_compare,
400  .get_key = variant_htable_get_key,
401  .set_key = variant_htable_set_key,
402  .get_index = variant_htable_get_index,
403  .set_index = NULL,
404  .type_id = 0,
405  .hit = { .ait = NULL, .key = NULL, .next = NULL },
406  .name = AMXC_VAR_NAME_HTABLE
407 };
408 
411 }
412 
415 }
416 
418  amxc_htable_t* htable = NULL;
419  amxc_htable_it_t* it = NULL;
420  amxc_var_t variant;
421  when_null(var, exit);
422 
423  amxc_var_init(&variant);
425 
426  if(amxc_htable_new(&htable, amxc_htable_capacity(&variant.data.vm)) != 0) {
427  amxc_var_clean(&variant);
428  goto exit;
429  }
430 
431  it = amxc_htable_take_first(&variant.data.vm);
432  while(it != NULL) {
433  const char* key = amxc_htable_it_get_key(it);
435  it = amxc_htable_take_first(&variant.data.vm);
436  }
437 
438  amxc_var_clean(&variant);
439 
440 exit:
441  return htable;
442 }
443 
445  const amxc_htable_t* retval = NULL;
446  when_null(var, exit);
448 
449  retval = &var->data.vm;
450 
451 exit:
452  return retval;
453 }
454 
456  const amxc_htable_t* htable) {
457  amxc_var_t* subvar = NULL;
458 
459  when_null(var, exit);
460  subvar = amxc_var_add_new(var);
461  when_null(subvar, exit);
462 
464  when_null(htable, exit);
465 
466  if(variant_htable_copy_htable(subvar, htable) != 0) {
467  amxc_var_delete(&subvar);
468  }
469 
470 exit:
471  return subvar;
472 }
473 
475  const char* key,
476  const amxc_htable_t* htable) {
477  amxc_var_t* subvar = NULL;
478 
479  when_null(var, exit);
480  subvar = amxc_var_add_new_key(var, key);
481  when_null(subvar, exit);
482 
484  when_null(htable, exit);
485 
486  if(variant_htable_copy_htable(subvar, htable) != 0) {
487  amxc_var_delete(&subvar);
488  }
489 
490 exit:
491  return subvar;
492 }
#define when_failed(x, l)
Definition: amxc_macros.h:142
#define when_true(x, l)
Definition: amxc_macros.h:134
#define CONSTRUCTOR
Definition: amxc_macros.h:86
#define when_null(x, l)
Definition: amxc_macros.h:126
#define when_false(x, l)
Definition: amxc_macros.h:138
#define UNUSED
Definition: amxc_macros.h:70
#define DESTRUCTOR
Definition: amxc_macros.h:90
Ambiorix string API header file.
#define amxc_var_from_htable_it(ht_it)
Get the variant pointer from an amxc htable iterator.
Definition: amxc_variant.h:790
int PRIVATE amxc_var_default_convert_to_null(amxc_var_t *const dest, const amxc_var_t *const src)
uint32_t PRIVATE amxc_var_add_type(amxc_var_type_t *const type, const uint32_t index)
int PRIVATE amxc_var_remove_type(amxc_var_type_t *const type)
size_t amxc_array_size(const amxc_array_t *const array)
Calculates the number of used items in the array.
Definition: amxc_array.c:415
AMXC_INLINE void * amxc_array_get_data_at(const amxc_array_t *const array, const unsigned int index)
Gets the data pointer of the item at the given index.
Definition: amxc_array.h:711
void amxc_array_delete(amxc_array_t **array, const amxc_array_it_delete_t func)
Frees the previously allocated array.
Definition: amxc_array.c:213
void amxc_htable_it_clean(amxc_htable_it_t *const it, amxc_htable_it_delete_t func)
Removes the iterator from the htable and frees allocated memory.
AMXC_INLINE const char * amxc_htable_it_get_key(const amxc_htable_it_t *const it)
Gets the key from the iterator.
Definition: amxc_htable.h:672
#define amxc_htable_it_get_data(it, type, member)
Gets the data pointer from an hash table iterator.
Definition: amxc_htable.h:87
int amxc_htable_init(amxc_htable_t *const htable, const size_t reserve)
Initializes a hash table.
Definition: amxc_htable.c:185
amxc_array_t * amxc_htable_get_sorted_keys(const amxc_htable_t *const htable)
Creates an array containing all keys of the hash table.
Definition: amxc_htable.c:339
int amxc_htable_new(amxc_htable_t **htable, const size_t reserve)
Allocates a hash table.
Definition: amxc_htable.c:148
AMXC_INLINE size_t amxc_htable_size(const amxc_htable_t *const htable)
Calculates the size of the hash table.
Definition: amxc_htable.h:334
AMXC_INLINE bool amxc_htable_is_empty(const amxc_htable_t *const htable)
Checks that the hash table is empty.
Definition: amxc_htable.h:311
int amxc_htable_move(amxc_htable_t *const dest, amxc_htable_t *const src)
Moves all items from one hash table to another hash table.
Definition: amxc_htable.c:363
amxc_htable_it_t * amxc_htable_take(amxc_htable_t *const htable, const char *const key)
Removes a hash table iterator from the hash table.
Definition: amxc_htable.c:304
amxc_htable_it_t * amxc_htable_get(const amxc_htable_t *const htable, const char *const key)
Gets a hash table iterator from the hash table.
Definition: amxc_htable.c:278
AMXC_INLINE size_t amxc_htable_capacity(const amxc_htable_t *const htable)
Calculates the capacity of the hash table.
Definition: amxc_htable.h:351
AMXC_INLINE amxc_htable_it_t * amxc_htable_take_first(const amxc_htable_t *const htable)
Removes the first item stored in the table.
Definition: amxc_htable.h:696
int amxc_htable_insert(amxc_htable_t *const htable, const char *const key, amxc_htable_it_t *const it)
Inserts an item in the hash table.
Definition: amxc_htable.c:237
#define amxc_htable_for_each(it, htable)
Loops over items in the hash table.
Definition: amxc_htable.h:102
void amxc_htable_clean(amxc_htable_t *const htable, amxc_htable_it_delete_t func)
Removes all items from the hash table.
Definition: amxc_htable.c:200
#define amxc_htable_iterate(it, htable)
Loops over items in the hash table.
Definition: amxc_htable.h:119
int amxc_llist_append(amxc_llist_t *const llist, amxc_llist_it_t *const it)
Adds an item to the end of the linked list.
Definition: amxc_llist.c:169
AMXC_INLINE int amxc_string_append(amxc_string_t *const string, const char *const text, const size_t length)
Appends text to the end of the current content of the string buffer.
Definition: amxc_string.h:920
int amxc_string_init(amxc_string_t *const string, const size_t length)
Initializes a string.
Definition: amxc_string.c:163
void amxc_string_clean(amxc_string_t *const string)
Frees the string buffer and reset length attributes.
Definition: amxc_string.c:189
#define AMXC_VAR_FLAG_DEFAULT
The default flag, do not copy, use variant as is.
Definition: amxc_variant.h:392
#define AMXC_VAR_FLAG_COPY
Copy the variant, creates a new variant, leaves the source variant untouched.
Definition: amxc_variant.h:398
#define AMXC_VAR_FLAG_UPDATE
Replaces the value of the variant, leaves the source variant untouched.
Definition: amxc_variant.h:404
amxc_var_t * amxc_var_add_new_amxc_htable_t(amxc_var_t *const var, const amxc_htable_t *htable)
Conversion helper function.
amxc_var_t * amxc_var_add_new_key_amxc_htable_t(amxc_var_t *const var, const char *key, const amxc_htable_t *htable)
Conversion helper function.
amxc_htable_t * amxc_var_get_amxc_htable_t(const amxc_var_t *const var)
Conversion helper function.
const amxc_htable_t * amxc_var_get_const_amxc_htable_t(const amxc_var_t *const var)
Conversion helper function.
#define AMXC_VAR_ID_CUSTOM_BASE
Base variant id for custom variants.
Definition: amxc_variant.h:257
#define AMXC_VAR_ID_CSTRING
C-string variant id (aka char *), null terminated string.
Definition: amxc_variant.h:134
#define AMXC_VAR_ID_UINT64
Unsigned 64 bit integer variant id.
Definition: amxc_variant.h:182
#define AMXC_VAR_NAME_HTABLE
Provides a name for variant id AMXC_VAR_ID_HTABLE.
Definition: amxc_variant.h:354
#define AMXC_VAR_ID_ANY
Special variant id, typically used in cast or conversion functions.
Definition: amxc_variant.h:247
#define AMXC_VAR_ID_HTABLE
Ambiorix Hash Table variant id.
Definition: amxc_variant.h:212
int(* amxc_var_convert_fn_t)(amxc_var_t *const dest, const amxc_var_t *const src)
Variant type callback function prototype for dynamically converting one type to another.
int amxc_var_set_type(amxc_var_t *const var, const uint32_t type)
Change the variant data type.
Definition: amxc_variant.c:261
amxc_var_t * amxc_var_get_key(const amxc_var_t *const var, const char *const key, const int flags)
Get a reference to a part of composed variant using a key.
Definition: amxc_variant.c:449
int amxc_var_new(amxc_var_t **var)
Allocates a variant and initializes it to the null variant type.
Definition: amxc_variant.c:194
int amxc_var_init(amxc_var_t *const var)
Initializes a variant.
Definition: amxc_variant.c:223
amxc_var_t * amxc_var_add_new(amxc_var_t *const var)
Adds a new variant to a composite variant.
Definition: amxc_variant.c:551
int amxc_var_copy(amxc_var_t *const dest, const amxc_var_t *const src)
Copy the type and data from one variant (source) in another variant (destination).
Definition: amxc_variant.c:285
void amxc_var_clean(amxc_var_t *const var)
Clean-up and reset variant.
Definition: amxc_variant.c:237
void amxc_var_delete(amxc_var_t **var)
Frees the previously allocated variant.
Definition: amxc_variant.c:207
amxc_var_t * amxc_var_add_new_key(amxc_var_t *const var, const char *key)
Adds a new variant with a key to a composite variant.
Definition: amxc_variant.c:526
int amxc_var_convert(amxc_var_t *const dest, const amxc_var_t *src, const uint32_t type_id)
Converts one variant (source) to another variant(destination) using the specified variant type id.
Definition: amxc_variant.c:333
int amxc_var_compare(const amxc_var_t *const var1, const amxc_var_t *const var2, int *const result)
Compares two variants.
Definition: amxc_variant.c:397
#define amxc_var_constcast(type, var)
Takes the content from a variant.
Definition: amxc_variant.h:722
The array structure.
Definition: amxc_array.h:162
The hash table iterator structure.
Definition: amxc_htable.h:138
The hash table structure.
Definition: amxc_htable.h:175
The string structure.
Definition: amxc_string.h:103
A variant type structure.
amxc_var_new_fn_t init
The variant struct definition.
Definition: amxc_variant.h:861
void * data
Definition: amxc_variant.h:883
amxc_llist_it_t lit
Definition: amxc_variant.h:862
amxc_htable_it_t hit
Definition: amxc_variant.h:863
uint32_t type_id
Definition: amxc_variant.h:864
static amxc_htable_it_t it[2000]
static amxc_htable_t * htable
static amxc_var_t * var
Definition: test_issue_58.c:77
static int variant_htable_move(amxc_var_t *const dest, amxc_var_t *const src)
static int variant_htable_to_bool(amxc_var_t *const dest, const amxc_var_t *const src)
static int variant_htable_to_number(amxc_var_t *const dest, const amxc_var_t *const src)
static int variant_htable_set_key(amxc_var_t *const dest, amxc_var_t *const src, const char *const key, int flags)
static int variant_htable_copy_htable(amxc_var_t *const dest, const amxc_htable_t *const src_htable)
static amxc_var_type_t amxc_variant_htable
void variant_htable_it_free(UNUSED const char *key, amxc_htable_it_t *it)
static int variant_htable_convert_to(amxc_var_t *const dest, const amxc_var_t *const src)
static void variant_htable_delete(amxc_var_t *var)
static amxc_var_t * variant_htable_get_index(const amxc_var_t *const src, const int64_t index, int flags)
static int variant_htable_init(amxc_var_t *const var)
static int variant_htable_to_llist(amxc_var_t *const dest, const amxc_var_t *const src)
static int variant_htable_to_string(amxc_var_t *const dest, const amxc_var_t *const src)
static int variant_htable_compare(const amxc_var_t *const lval, const amxc_var_t *const rval, int *const result)
static amxc_var_t * variant_htable_get_key(const amxc_var_t *const src, const char *const key, int flags)
static CONSTRUCTOR void amxc_var_htable_init(void)
static DESTRUCTOR void amxc_var_htable_cleanup(void)
static int variant_htable_copy(amxc_var_t *const dest, const amxc_var_t *const src)