sarg  2.4.0
About: SARG ia a Squid Analysis Report Generator.
  Fossies Dox: sarg-2.4.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

dichotomic.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define true   1
 
#define false   0
 

Typedefs

typedef int bool
 
typedef struct DichotomicStructDichotomicObject
 The object to store key/value pairs. More...
 

Functions

DichotomicObject Dichotomic_Create (void)
 
void Dichotomic_Destroy (DichotomicObject *ObjPtr)
 
const char * Dichotomic_Search (DichotomicObject Obj, const char *key)
 
bool Dichotomic_Insert (DichotomicObject Obj, const char *key, const char *value)
 

Macro Definition Documentation

◆ false

#define false   0

Definition at line 12 of file dichotomic.h.

◆ true

#define true   1

Definition at line 9 of file dichotomic.h.

Typedef Documentation

◆ bool

typedef int bool

Definition at line 7 of file dichotomic.h.

◆ DichotomicObject

The object to store key/value pairs.

Definition at line 17 of file dichotomic.h.

Function Documentation

◆ Dichotomic_Create()

DichotomicObject Dichotomic_Create ( void  )

Create an object to store key/value pairs and retrieve them.

Returns
The object to pass to the functions in this module. The returned pointer is NULL if there is not enough memory to allocate the object. The object must be freed with a call to Dichotomic_Destroy().

Definition at line 61 of file dichotomic.c.

Referenced by ip2name().

Here is the caller graph for this function:

◆ Dichotomic_Destroy()

void Dichotomic_Destroy ( DichotomicObject ObjPtr)

Destroy an object created by Dichotomic_Create().

Parameters
ObjPtrThe pointer to the variable containing the object to destroy. The pointer is reset to NULL by this function. It is safe to pass NULL or a NULL pointer.

Definition at line 82 of file dichotomic.c.

References DichotomicStruct::Items, DichotomicItemStruct::Key, DichotomicStruct::NItems, and DichotomicItemStruct::Value.

Referenced by ip2name_cleanup().

Here is the caller graph for this function:

◆ Dichotomic_Insert()

bool Dichotomic_Insert ( DichotomicObject  Obj,
const char *  key,
const char *  value 
)

Insert a key/value pair into the array.

Parameters
ObjThe object created by Dichotomic_Create().
keyThe key of the pair.
valueThe value of the pair.
Returns
True if the pair was inserted or false if it failed.

Definition at line 139 of file dichotomic.c.

References _, debuga(), Dichotomic_FindKeyPos(), DichotomicStruct::Items, DichotomicItemStruct::Key, DichotomicStruct::NAllocated, DichotomicStruct::NItems, and DichotomicItemStruct::Value.

Referenced by ip2name().

Here is the caller graph for this function:

◆ Dichotomic_Search()

const char* Dichotomic_Search ( DichotomicObject  Obj,
const char *  key 
)

Search for the value of a key.

Parameters
ObjThe object created by Dichotomic_Create().
keyThe key to search for.
Returns
The value of the key or NULL if the key was not found.

Definition at line 192 of file dichotomic.c.

References Dichotomic_FindKeyPos(), DichotomicStruct::Items, DichotomicStruct::NItems, and DichotomicItemStruct::Value.

Referenced by ip2name().

Here is the caller graph for this function: