EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
Macros | Functions
hashmap.c File Reference

File containing the implementation of the hashmap utilities. More...

#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "hashmap.h"
#include "log.h"
Include dependency graph for hashmap.c:

Macros

#define _POSIX_C_SOURCE   200809L
 
#define strnlen_s(_string, _maxlen)    ((_string) == NULL ? 0 : strnlen((_string), (_maxlen)))
 

Functions

const char * hmap_str_keychar_get (const hmap_str_keychar *hmap, const char *keyptr)
 Retrieves a string from string hashmap for a given key. More...
 
bool hmap_str_keychar_put (hmap_str_keychar **hmap, const char *keyptr, const char *value)
 Inserts a string into a string hashmap for a given key. More...
 
void hmap_str_keychar_free (hmap_str_keychar **hmap)
 Deletes the string hashmap object. More...
 

Detailed Description

File containing the implementation of the hashmap utilities.

Author
Alexandru Mereacre
Date
2020

Macro Definition Documentation

◆ _POSIX_C_SOURCE

#define _POSIX_C_SOURCE   200809L

◆ strnlen_s

#define strnlen_s (   _string,
  _maxlen 
)     ((_string) == NULL ? 0 : strnlen((_string), (_maxlen)))

Function Documentation

◆ hmap_str_keychar_free()

void hmap_str_keychar_free ( hmap_str_keychar **  hmap)

Deletes the string hashmap object.

Parameters
hmapThe string hashmap object

◆ hmap_str_keychar_get()

const char* hmap_str_keychar_get ( const hmap_str_keychar hmap,
const char *  keyptr 
)

Retrieves a string from string hashmap for a given key.

Parameters
hmapThe string hashmap object.
keyptrThe hashmap key.
Returns
Returned string, NULL if not found. Valid until the hashmap entry is deleted.

◆ hmap_str_keychar_put()

bool hmap_str_keychar_put ( hmap_str_keychar **  hmap,
const char *  keyptr,
const char *  value 
)

Inserts a string into a string hashmap for a given key.

Parameters
[in,out]hmapPointer to the string hashmap object.
keyptrThe hashmap key
valueThe hashmap string value
Returns
true on succes, false if there's an insertion error