LIRC libraries
LinuxInfraredRemoteControl
 All Classes Files Functions Variables Typedefs Enumerations Macros Modules Pages
dictionary.c File Reference

(9c596ec 2015-02-10 14:16:32 +0100)

Implements a dictionary for string variables. More...

#include "dictionary.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

Go to the source code of this file.

Macros

#define MAXVALSZ   1024
 Maximum value size for integers and doubles. More...
 
#define DICTMINSZ   128
 Minimal allocated number of entries in a dictionary.
 
#define DICT_INVALID_KEY   ((char*)-1)
 Invalid key token.
 

Functions

unsigned dictionary_hash (const char *key)
 Compute the hash key for a string. More...
 
dictionarydictionary_new (int size)
 Create a new dictionary object. More...
 
void dictionary_del (dictionary *vd)
 Delete a dictionary object. More...
 
const char * dictionary_get (dictionary *d, const char *key, const char *def)
 Get a value from a dictionary. More...
 
int dictionary_set (dictionary *vd, const char *key, const char *val)
 Set a value in a dictionary. More...
 
void dictionary_unset (dictionary *d, const char *key)
 Delete a key in a dictionary. More...
 
void dictionary_dump (dictionary *d, FILE *out)
 Dump a dictionary to an opened file pointer. More...
 

Detailed Description

Implements a dictionary for string variables.

Author
N. Devillard
Date
Sep 2007
Version
Revision: 1.27 This module implements a simple dictionary object, i.e. a list of string/string associations. This object is useful to store e.g. information retrieved from a configuration file (ini files).

Definition in file dictionary.c.