Browse Source

[core] pass array_get_element_klen() const array *

personal/stbuehler/fix-fdevent
Glenn Strauss 3 years ago
parent
commit
2496c1af4c
  1. 4
      src/array.c
  2. 2
      src/array.h

4
src/array.c

@ -88,7 +88,7 @@ data_unset *array_pop(array *a) {
* if rndx != NULL it stores the position in a->sorted[] where the key needs
* to be inserted
*/
static size_t array_get_index(array *a, const char *key, size_t keylen, size_t *rndx) {
static size_t array_get_index(const array *a, const char *key, size_t keylen, size_t *rndx) {
/* invariant: [lower-1] < key < [upper]
* "virtual elements": [-1] = -INFTY, [a->used] = +INFTY
* also an invariant: 0 <= lower <= upper <= a->used
@ -120,7 +120,7 @@ static size_t array_get_index(array *a, const char *key, size_t keylen, size_t *
return ARRAY_NOT_FOUND;
}
data_unset *array_get_element_klen(array *a, const char *key, size_t klen) {
data_unset *array_get_element_klen(const array *a, const char *key, size_t klen) {
size_t ndx;
force_assert(NULL != key);

2
src/array.h

@ -147,7 +147,7 @@ int array_is_kvstring(array *a);
int array_print(array *a, int depth);
data_unset *array_get_unused_element(array *a, data_type_t t);
#define array_get_element(a, key) array_get_element_klen((a), (key), sizeof(key)-1)
data_unset *array_get_element_klen(array *a, const char *key, size_t klen);
data_unset *array_get_element_klen(const array *a, const char *key, size_t klen);
data_unset *array_extract_element_klen(array *a, const char *key, size_t klen); /* removes found entry from array */
void array_set_key_value(array *hdrs, const char *key, size_t key_len, const char *value, size_t val_len);
void array_replace(array *a, data_unset *entry);

Loading…
Cancel
Save