#include <h2o/memory.h>
#include <htils/basictypes.h>
#include <h2otils/string.h>
Go to the source code of this file.
◆ __H2O_SM_VAL
| #define __H2O_SM_VAL |
( |
|
val | ) |
(val), sizeof(*val) |
◆ h2o_sm_insert
◆ h2o_stringmap_entry_state_t
The state of a h2o_stringmap entry.
- Parameters
-
| EMPTY | The entry is empty. |
| OCCUPIED | The entry is occupied. |
| DEAD | The entry is dead. |
◆ h2o_stringmap_entry_t
A h2o_stringmap entry.
- Parameters
-
| key | The key of the entry. |
| value | The value of the entry. |
| state | The state of the entry. |
◆ h2o_stringmap_result_t
The result of a stringmap operation.
- Parameters
-
| CREATED | The entry was created. |
| UPDATED | The entry was updated. |
| NOT_FOUND | The entry was not found. |
| KILLED | The entry was killed. |
◆ h2o_stringmap_t
A h2o_stringmap_t.
- Parameters
-
◆ h2o_stringmap_entry_state
The state of a h2o_stringmap entry.
- Parameters
-
| EMPTY | The entry is empty. |
| OCCUPIED | The entry is occupied. |
| DEAD | The entry is dead. |
| Enumerator |
|---|
| EMPTY | |
| OCCUPIED | |
| DEAD | |
◆ h2o_stringmap_result
The result of a stringmap operation.
- Parameters
-
| CREATED | The entry was created. |
| UPDATED | The entry was updated. |
| NOT_FOUND | The entry was not found. |
| KILLED | The entry was killed. |
| Enumerator |
|---|
| CREATED | |
| UPDATED | |
| NOT_FOUND | |
| KILLED | |
◆ __h2o_sm_insert()
Insert key and value into the h2o_stringmap_t.
Hashes and duplicates the key and sets the value, if the key already exists, it will be updated, if the capacity is too small, it will be automatically grown.
- Note
- This function is not meant to be run directly, and is called by the h2o_sm_insert() macro.
- Parameters
-
| map | The h2o_stringmap_t to insert into. |
| key | The key to insert. |
| value | The value to associate with the key. |
| vsize | The size of the value. |
- Precondition
map and key must be valid and cannot be null.
value can't be null, as it would lead to a null dereference.
- Returns
- The result of the insert (which will be either CREATED or UPDATED in this case).
◆ h2o_sm_get()
Get a V from the h2o_stringmap_t.
Gets an entry from the h2o_stringmap_t, if the entry doesn't exist, it will be null.
- Parameters
-
- Precondition
map and key must be valid and cannot be null.
- Returns
- The value associated with the key, or null if it doesn't exist or is dead.
◆ h2o_sm_kill()
Remove / Kill entry at key from the h2o_stringmap_t.
Marks an entry as DEAD, if the key doesn't exist, it will return NOT_FOUND, otherwise it will return KILLED.
- Parameters
-
- Precondition
stringmap and key must be valid and cannot be null.
- Returns
- The result of the remove (which will be either KILLED or NOT_FOUND in this case).
◆ h2o_sm_new()
Initializes a new h2o_stringmap_t.
Optionally use a nullable type for h2o_stringmaps.
With the capacity, and pool, if the given capacity is 0, it will use the built in default capacity, which is 16.
- Parameters
-
| pool | The memory pool to allocate from. |
| capacity | The capacity of the h2o_stringmap_t. |
- Precondition
pool must be valid and cannot be null.
- Returns
- A pointer to the new h2o_stringmap_t.