CUBRID Engine  latest
ini_parser.c File Reference
#include "config.h"
#include "porting.h"
#include "ini_parser.h"
#include "chartype.h"
Include dependency graph for ini_parser.c:

Go to the source code of this file.

Macros

#define INI_BUFSIZ   (512)
 
#define INI_INVALID_KEY   ((char*)-1)
 

Typedefs

typedef enum ini_line_status INI_LINE_STATUS
 

Enumerations

enum  ini_line_status {
  LINE_UNPROCESSED, LINE_ERROR, LINE_EMPTY, LINE_COMMENT,
  LINE_SECTION, LINE_VALUE
}
 

Functions

static void * ini_dblalloc (void *ptr, int size)
 
static unsigned int ini_table_hash (char *key)
 
static INI_TABLEini_table_new (int size)
 
static void ini_table_free (INI_TABLE *vd)
 
static const char * ini_table_get (INI_TABLE *ini, char *key, const char *def, int *lineno)
 
static int ini_table_set (INI_TABLE *vd, char *key, char *val, int lineno)
 
static char * ini_str_lower (const char *s)
 
static char * ini_str_trim (char *s)
 
static INI_LINE_STATUS ini_parse_line (char *input_line, char *section, char *key, char *value)
 
static const char * ini_get_internal (INI_TABLE *ini, const char *key, const char *def, int *lineno)
 
INI_TABLEini_parser_load (const char *ininame)
 
void ini_parser_free (INI_TABLE *ini)
 
int ini_findsec (INI_TABLE *ini, const char *sec)
 
char * ini_getsecname (INI_TABLE *ini, int n, int *lineno)
 
int ini_hassec (const char *key)
 
int ini_seccmp (const char *key1, const char *key2)
 
const char * ini_getstr (INI_TABLE *ini, const char *sec, const char *key, const char *def, int *lineno)
 
int ini_getint (INI_TABLE *ini, const char *sec, const char *key, int def, int *lineno)
 
int ini_getuint (INI_TABLE *ini, const char *sec, const char *key, int def, int *lineno)
 
int ini_getuint_max (INI_TABLE *ini, const char *sec, const char *key, int def, int max, int *lineno)
 
int ini_gethex (INI_TABLE *ini, const char *sec, const char *key, int def, int *lineno)
 
float ini_getfloat (INI_TABLE *ini, const char *sec, const char *key, float def, int *lineno)
 

Macro Definition Documentation

#define INI_BUFSIZ   (512)

Definition at line 30 of file ini_parser.c.

Referenced by ini_getstr(), ini_parse_line(), ini_parser_load(), ini_str_lower(), and ini_str_trim().

#define INI_INVALID_KEY   ((char*)-1)

Definition at line 31 of file ini_parser.c.

Referenced by ini_getfloat(), ini_gethex(), and ini_getint().

Typedef Documentation

Definition at line 42 of file ini_parser.c.

Enumeration Type Documentation

Enumerator
LINE_UNPROCESSED 
LINE_ERROR 
LINE_EMPTY 
LINE_COMMENT 
LINE_SECTION 
LINE_VALUE 

Definition at line 33 of file ini_parser.c.

Function Documentation

static void * ini_dblalloc ( void *  ptr,
int  size 
)
static

Definition at line 65 of file ini_parser.c.

References NULL.

Referenced by ini_table_set().

Here is the caller graph for this function:

int ini_findsec ( INI_TABLE ini,
const char *  sec 
)

Definition at line 697 of file ini_parser.c.

References i, ini_table::key, NULL, and ini_table::size.

Referenced by broker_config_read_internal(), and get_master_shm_id().

Here is the caller graph for this function:

static const char * ini_get_internal ( INI_TABLE ini,
const char *  key,
const char *  def,
int *  lineno 
)
static

Definition at line 836 of file ini_parser.c.

References ini_str_lower(), ini_table_get(), and NULL.

Referenced by ini_getstr().

Here is the caller graph for this function:

float ini_getfloat ( INI_TABLE ini,
const char *  sec,
const char *  key,
float  def,
int *  lineno 
)

Definition at line 1020 of file ini_parser.c.

References ini_getstr(), INI_INVALID_KEY, and NULL.

int ini_gethex ( INI_TABLE ini,
const char *  sec,
const char *  key,
int  def,
int *  lineno 
)

Definition at line 993 of file ini_parser.c.

References ini_getstr(), INI_INVALID_KEY, and parse_int().

Referenced by broker_config_read_internal(), and get_master_shm_id().

Here is the caller graph for this function:

int ini_getint ( INI_TABLE ini,
const char *  sec,
const char *  key,
int  def,
int *  lineno 
)

Definition at line 885 of file ini_parser.c.

References ini_getstr(), INI_INVALID_KEY, and parse_int().

Referenced by broker_config_read_internal(), and ini_getuint().

Here is the caller graph for this function:

char* ini_getsecname ( INI_TABLE ini,
int  n,
int *  lineno 
)

Definition at line 729 of file ini_parser.c.

References i, ini_table::key, ini_table::lineno, NULL, and ini_table::size.

Referenced by broker_config_read_internal().

Here is the caller graph for this function:

const char* ini_getstr ( INI_TABLE ini,
const char *  sec,
const char *  key,
const char *  def,
int *  lineno 
)

Definition at line 865 of file ini_parser.c.

References INI_BUFSIZ, and ini_get_internal().

Referenced by broker_config_read_internal(), ini_getfloat(), ini_gethex(), and ini_getint().

Here is the caller graph for this function:

int ini_getuint ( INI_TABLE ini,
const char *  sec,
const char *  key,
int  def,
int *  lineno 
)

Definition at line 912 of file ini_parser.c.

References ini_getint(), ini_getuint(), and min.

Referenced by broker_config_read_internal(), ini_getuint(), and ini_getuint_max().

Here is the caller graph for this function:

int ini_getuint_max ( INI_TABLE ini,
const char *  sec,
const char *  key,
int  def,
int  max,
int *  lineno 
)

Definition at line 968 of file ini_parser.c.

References ini_getuint(), and max.

Referenced by broker_config_read_internal().

Here is the caller graph for this function:

int ini_hassec ( const char *  key)

Definition at line 772 of file ini_parser.c.

Referenced by prm_load_by_section().

Here is the caller graph for this function:

static INI_LINE_STATUS ini_parse_line ( char *  input_line,
char *  section,
char *  key,
char *  value 
)
static

Definition at line 488 of file ini_parser.c.

References INI_BUFSIZ, ini_str_lower(), ini_str_trim(), LINE_COMMENT, LINE_EMPTY, LINE_ERROR, LINE_SECTION, LINE_UNPROCESSED, LINE_VALUE, and strlen.

Referenced by ini_parser_load().

Here is the caller graph for this function:

void ini_parser_free ( INI_TABLE ini)

Definition at line 683 of file ini_parser.c.

References ini_table_free().

Referenced by broker_config_read_internal(), get_master_shm_id(), and prm_read_and_parse_ini_file().

Here is the caller graph for this function:

INI_TABLE* ini_parser_load ( const char *  ininame)
int ini_seccmp ( const char *  key1,
const char *  key2 
)

Definition at line 786 of file ini_parser.c.

References CAST_STRLEN, and strlen.

Referenced by prm_load_by_section().

Here is the caller graph for this function:

static char * ini_str_lower ( const char *  s)
static

Definition at line 420 of file ini_parser.c.

References char_tolower(), i, INI_BUFSIZ, and NULL.

Referenced by ini_get_internal(), and ini_parse_line().

Here is the caller graph for this function:

static char * ini_str_trim ( char *  s)
static

Definition at line 448 of file ini_parser.c.

References char_isspace(), INI_BUFSIZ, NULL, and strlen.

Referenced by ini_parse_line().

Here is the caller graph for this function:

static void ini_table_free ( INI_TABLE vd)
static

Definition at line 191 of file ini_parser.c.

References ini_table::hash, i, ini_table::key, ini_table::lineno, NULL, ini_table::size, and ini_table::val.

Referenced by ini_parser_free(), and ini_parser_load().

Here is the caller graph for this function:

static const char * ini_table_get ( INI_TABLE ini,
char *  key,
const char *  def,
int *  lineno 
)
static

Definition at line 234 of file ini_parser.c.

References ini_table::hash, i, ini_table_hash(), ini_table::key, ini_table::lineno, NULL, ini_table::size, and ini_table::val.

Referenced by ini_get_internal().

Here is the caller graph for this function:

static unsigned int ini_table_hash ( char *  key)
static

Definition at line 92 of file ini_parser.c.

References i, and strlen.

Referenced by ini_table_get(), and ini_table_set().

Here is the caller graph for this function:

static INI_TABLE * ini_table_new ( int  size)
static

Definition at line 120 of file ini_parser.c.

References error(), ini_table::hash, ini_table::key, ini_table::lineno, NULL, ini_table::size, and ini_table::val.

Referenced by ini_parser_load().

Here is the caller graph for this function:

static int ini_table_set ( INI_TABLE vd,
char *  key,
char *  val,
int  lineno 
)
static

Definition at line 274 of file ini_parser.c.

References ini_table::hash, i, ini_dblalloc(), ini_table_hash(), ini_table::key, ini_table::lineno, ini_table::n, ini_table::nsec, NULL, ini_table::size, strdup(), and ini_table::val.

Referenced by ini_parser_load().

Here is the caller graph for this function: