[core] (data_unset *) from array_get_element_klen

return (data_unset *) from array_get_element_klen() to prep for
putting buffer into data_string for value member, rather than as
(buffer *)

(allow in-place modification of these buffer values)
personal/stbuehler/ci-build
Glenn Strauss 3 years ago
parent 47a758f959
commit b7942c58cc
  1. 2
      src/array.c
  2. 2
      src/array.h
  3. 4
      src/http_header.c

@ -142,7 +142,7 @@ static int32_t array_get_index(const array * const a, const char * const k, cons
}
__attribute_hot__
const data_unset *array_get_element_klen(const array * const a, const char *key, const size_t klen) {
data_unset *array_get_element_klen(const array * const a, const char *key, const size_t klen) {
const int32_t ipos = array_get_index(a, key, klen);
return ipos >= 0 ? a->data[ipos] : NULL;
}

@ -88,7 +88,7 @@ __attribute_pure__
int array_is_kvstring(const array *a);
__attribute_pure__
const data_unset *array_get_element_klen(const array *a, const char *key, size_t klen);
data_unset *array_get_element_klen(const array *a, const char *key, size_t klen);
__attribute_cold__
__attribute_pure__

@ -92,8 +92,8 @@ static inline void http_header_token_append(buffer * const vb, const char * cons
__attribute_pure__
static inline buffer * http_header_generic_get_ifnotempty(const array * const a, const char * const k, const size_t klen) {
const data_string * const ds =
(const data_string *)array_get_element_klen(a, k, klen);
data_string * const ds =
(data_string *)array_get_element_klen(a, k, klen);
return ds && !buffer_string_is_empty(ds->value) ? ds->value : NULL;
}

Loading…
Cancel
Save