CUBRID Engine  latest
variable_string.c File Reference
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "porting.h"
#include "variable_string.h"
#include "error_code.h"
#include "error_manager.h"
Include dependency graph for variable_string.c:

Go to the source code of this file.

Macros

#define FUDGE   16
 
#define PREFIX_CUSHION   8
 
#define VS_INC   32
 

Functions

static int vs_cannot_hold (varstring *vstr, int n)
 
static int vs_grow (varstring *vstr, int n)
 
static int vs_do_sprintf (varstring *vstr, const char *fmt, va_list args)
 
static int vs_itoa (varstring *vstr, int n)
 
varstringvs_new (varstring *vstr)
 
void vs_free (varstring *vstr)
 
void vs_clear (varstring *vstr)
 
int vs_append (varstring *vstr, const char *suffix)
 
int vs_prepend (varstring *vstr, const char *prefix)
 
int vs_sprintf (varstring *vstr, const char *fmt,...)
 
int vs_strcat (varstring *vstr, const char *str)
 
int vs_strcatn (varstring *vstr, const char *str, int length)
 
int vs_strcpy (varstring *vstr, const char *str)
 
int vs_putc (varstring *vstr, int ch)
 
char * vs_str (varstring *vstr)
 
int vs_strlen (const varstring *vstr)
 

Variables

static const char * EMPTY_STRING = ""
 

Macro Definition Documentation

#define FUDGE   16

Definition at line 38 of file variable_string.c.

Referenced by vs_prepend(), vs_putc(), vs_str(), vs_strcat(), and vs_strcatn().

#define PREFIX_CUSHION   8

Definition at line 39 of file variable_string.c.

Referenced by vs_clear(), vs_grow(), and vs_prepend().

#define VS_INC   32

Definition at line 40 of file variable_string.c.

Referenced by vs_do_sprintf().

Function Documentation

int vs_append ( varstring vstr,
const char *  suffix 
)

Definition at line 295 of file variable_string.c.

References vs_strcat().

Referenced by pp_print_link().

Here is the caller graph for this function:

static int vs_cannot_hold ( varstring vstr,
int  n 
)
static

Definition at line 56 of file variable_string.c.

References varstring::base, varstring::end, varstring::limit, and NULL.

Referenced by vs_prepend(), vs_putc(), vs_str(), vs_strcat(), and vs_strcatn().

Here is the caller graph for this function:

void vs_clear ( varstring vstr)

Definition at line 274 of file variable_string.c.

References varstring::base, varstring::end, varstring::limit, NULL, PREFIX_CUSHION, and varstring::start.

Referenced by pp_add_host_str(), pp_addr_expr(), pp_print_decl(), pp_print_link(), and vs_strcpy().

Here is the caller graph for this function:

static int vs_do_sprintf ( varstring vstr,
const char *  fmt,
va_list  args 
)
static

Definition at line 129 of file variable_string.c.

References varstring::base, varstring::end, ER_FAILED, varstring::limit, NO_ERROR, NULL, p, vs_grow(), VS_INC, vs_itoa(), and vs_strcat().

Referenced by vs_sprintf().

Here is the caller graph for this function:

void vs_free ( varstring vstr)

Definition at line 249 of file variable_string.c.

References varstring::base, varstring::heap_allocated, and NULL.

Referenced by pp_finish(), pp_free_host_ref(), pp_free_host_var(), pp_new_pseudo_def(), pp_print_decls(), pp_print_link(), and pp_print_specs().

Here is the caller graph for this function:

static int vs_grow ( varstring vstr,
int  n 
)
static

Definition at line 69 of file variable_string.c.

References varstring::base, CAST_STRLEN, varstring::end, ER_FAILED, varstring::limit, NO_ERROR, NULL, PREFIX_CUSHION, and varstring::start.

Referenced by vs_do_sprintf(), vs_prepend(), vs_putc(), vs_str(), vs_strcat(), and vs_strcatn().

Here is the caller graph for this function:

static int vs_itoa ( varstring vstr,
int  n 
)
static

Definition at line 204 of file variable_string.c.

References vs_strcat().

Referenced by vs_do_sprintf().

Here is the caller graph for this function:

int vs_prepend ( varstring vstr,
const char *  prefix 
)

Definition at line 309 of file variable_string.c.

References varstring::base, CAST_STRLEN, varstring::end, ER_FAILED, FUDGE, NO_ERROR, NULL, PREFIX_CUSHION, varstring::start, strlen, vs_cannot_hold(), and vs_grow().

Referenced by pp_add_struct_field_refs(), pp_print_decl(), and pp_print_link().

Here is the caller graph for this function:

int vs_putc ( varstring vstr,
int  ch 
)

Definition at line 478 of file variable_string.c.

References varstring::end, ER_FAILED, FUDGE, NO_ERROR, NULL, vs_cannot_hold(), and vs_grow().

Referenced by pp_translate_string().

Here is the caller graph for this function:

int vs_sprintf ( varstring vstr,
const char *  fmt,
  ... 
)

Definition at line 376 of file variable_string.c.

References ER_FAILED, NULL, and vs_do_sprintf().

Referenced by pp_addr_expr(), pp_get_input_size(), pp_get_output_size(), pp_get_precision(), pp_new_pseudo_def(), and pp_print_link().

Here is the caller graph for this function:

int vs_strcat ( varstring vstr,
const char *  str 
)

Definition at line 400 of file variable_string.c.

References varstring::end, ER_FAILED, FUDGE, NO_ERROR, NULL, strlen, vs_cannot_hold(), and vs_grow().

Referenced by pp_new_host_var(), pp_print_link(), pp_translate_string(), vs_append(), vs_do_sprintf(), vs_itoa(), and vs_strcpy().

Here is the caller graph for this function:

int vs_strcatn ( varstring vstr,
const char *  str,
int  length 
)

Definition at line 435 of file variable_string.c.

References varstring::end, ER_FAILED, FUDGE, NO_ERROR, NULL, vs_cannot_hold(), and vs_grow().

int vs_strcpy ( varstring vstr,
const char *  str 
)

Definition at line 465 of file variable_string.c.

References vs_clear(), and vs_strcat().

Referenced by pp_get_addr_expr(), pp_get_expr(), pp_get_ind_addr_expr(), pp_get_ind_expr(), pp_get_input_size(), pp_get_precision(), pp_print_decl(), and pp_print_link().

Here is the caller graph for this function:

int vs_strlen ( const varstring vstr)

Definition at line 530 of file variable_string.c.

References varstring::base, CAST_STRLEN, varstring::end, NULL, and varstring::start.

Variable Documentation

const char* EMPTY_STRING = ""
static

Definition at line 42 of file variable_string.c.

Referenced by vs_str().