Apache HTTPD
Classes | Macros | Functions
apr_tables.c File Reference
#include "apr_private.h"
#include "apr_general.h"
#include "apr_pools.h"
#include "apr_tables.h"
#include "apr_strings.h"
#include "apr_lib.h"

Go to the source code of this file.

Classes

struct  apr_table_t
 
struct  table_getm_t
 

Macros

#define CASE_MASK   0xdfdfdfdf
 
#define TABLE_HASH_SIZE   32
 
#define TABLE_INDEX_MASK   0x1f
 
#define TABLE_HASH(key)   (TABLE_INDEX_MASK & *(unsigned char *)(key))
 
#define TABLE_INDEX_IS_INITIALIZED(t, i)   ((t)->index_initialized & (1u << (i)))
 
#define TABLE_SET_INDEX_INITIALIZED(t, i)   ((t)->index_initialized |= (1u << (i)))
 
#define COMPUTE_KEY_CHECKSUM(key, checksum)
 
#define table_push(t)   ((apr_table_entry_t *) apr_array_push_noclear(&(t)->a))
 

Functions

static void make_array_core (apr_array_header_t *res, apr_pool_t *p, int nelts, int elt_size, int clear)
 
 APR_DECLARE (int)
 
 APR_DECLARE (apr_array_header_t *)
 
 APR_DECLARE (void)
 
 APR_DECLARE (void *)
 
static void * apr_array_push_noclear (apr_array_header_t *arr)
 
static APR_INLINE void copy_array_hdr_core (apr_array_header_t *res, const apr_array_header_t *arr)
 
 apr_array_copy_hdr (apr_pool_t *p, const apr_array_header_t *arr)
 
 apr_array_append (apr_pool_t *p, const apr_array_header_t *first, const apr_array_header_t *second)
 
 APR_DECLARE (char *)
 
 APR_DECLARE (const apr_array_header_t *)
 
 APR_DECLARE (apr_table_t *)
 
static void table_reindex (apr_table_t *t)
 
 APR_DECLARE (const char *)
 
 APR_DECLARE_NONSTD (int)
 
static apr_table_entry_t ** table_mergesort (apr_pool_t *pool, apr_table_entry_t **values, apr_size_t n)
 
static void apr_table_cat (apr_table_t *t, const apr_table_t *s)
 
static int table_getm_do (void *v, const char *key, const char *val)
 

Macro Definition Documentation

◆ CASE_MASK

#define CASE_MASK   0xdfdfdfdf

Definition at line 293 of file apr_tables.c.

◆ COMPUTE_KEY_CHECKSUM

#define COMPUTE_KEY_CHECKSUM (   key,
  checksum 
)
Value:
{ \
const char *k = (key); \
(checksum) = c; \
(checksum) <<= 8; \
if (c) { \
c = (apr_uint32_t)*++k; \
checksum |= c; \
} \
(checksum) <<= 8; \
if (c) { \
c = (apr_uint32_t)*++k; \
checksum |= c; \
} \
(checksum) <<= 8; \
if (c) { \
c = (apr_uint32_t)*++k; \
checksum |= c; \
} \
}
#define CASE_MASK
Definition apr_tables.c:293
apr_size_t size
const char * key
apr_vformatter_buff_t * c
Definition apr_lib.h:175

Definition at line 308 of file apr_tables.c.

◆ TABLE_HASH

#define TABLE_HASH (   key)    (TABLE_INDEX_MASK & *(unsigned char *)(key))

Definition at line 298 of file apr_tables.c.

◆ TABLE_HASH_SIZE

#define TABLE_HASH_SIZE   32

Definition at line 296 of file apr_tables.c.

◆ TABLE_INDEX_IS_INITIALIZED

#define TABLE_INDEX_IS_INITIALIZED (   t,
  i 
)    ((t)->index_initialized & (1u << (i)))

Definition at line 299 of file apr_tables.c.

◆ TABLE_INDEX_MASK

#define TABLE_INDEX_MASK   0x1f

Definition at line 297 of file apr_tables.c.

◆ table_push

#define table_push (   t)    ((apr_table_entry_t *) apr_array_push_noclear(&(t)->a))

Definition at line 387 of file apr_tables.c.

◆ TABLE_SET_INDEX_INITIALIZED

#define TABLE_SET_INDEX_INITIALIZED (   t,
  i 
)    ((t)->index_initialized |= (1u << (i)))

Definition at line 300 of file apr_tables.c.

Function Documentation

◆ apr_array_append()

apr_array_append ( apr_pool_t p,
const apr_array_header_t first,
const apr_array_header_t second 
)

Definition at line 213 of file apr_tables.c.

◆ apr_array_copy_hdr()

apr_array_copy_hdr ( apr_pool_t p,
const apr_array_header_t arr 
)

Definition at line 199 of file apr_tables.c.

◆ apr_array_push_noclear()

static void * apr_array_push_noclear ( apr_array_header_t arr)
static

Definition at line 126 of file apr_tables.c.

◆ APR_DECLARE() [1/4]

APR_DECLARE ( apr_array_header_t )

Definition at line 83 of file apr_tables.c.

◆ APR_DECLARE() [2/4]

APR_DECLARE ( apr_table_t )

Definition at line 400 of file apr_tables.c.

◆ APR_DECLARE() [3/4]

APR_DECLARE ( char )

Definition at line 229 of file apr_tables.c.

◆ APR_DECLARE() [4/4]

APR_DECLARE ( const apr_array_header_t )

Definition at line 390 of file apr_tables.c.

◆ apr_table_cat()

static void apr_table_cat ( apr_table_t t,
const apr_table_t s 
)
static

Definition at line 1207 of file apr_tables.c.

◆ copy_array_hdr_core()

static APR_INLINE void copy_array_hdr_core ( apr_array_header_t res,
const apr_array_header_t arr 
)
static

Definition at line 189 of file apr_tables.c.

◆ make_array_core()

static void make_array_core ( apr_array_header_t res,
apr_pool_t p,
int  nelts,
int  elt_size,
int  clear 
)
static

Definition at line 54 of file apr_tables.c.

◆ table_getm_do()

static int table_getm_do ( void *  v,
const char key,
const char val 
)
static

The most common case is a single header, and this is covered by a fast path that doesn't allocate any memory. On the second and subsequent header, an array is created and the array concatenated together to form the final value.

Definition at line 1254 of file apr_tables.c.

◆ table_mergesort()

static apr_table_entry_t ** table_mergesort ( apr_pool_t pool,
apr_table_entry_t **  values,
apr_size_t  n 
)
static

Definition at line 1002 of file apr_tables.c.

◆ table_reindex()

static void table_reindex ( apr_table_t t)
static

Definition at line 448 of file apr_tables.c.