ekg2
Funkcje
Dokumentacja pliku remote/dynstuff.c
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "dynstuff.h"
#include "dynstuff_inline.h"
#include "xmalloc.h"

Funkcje

EXPORTNOT void * list_add_beginning (list_t *list, void *data)
void * list_add_sorted3 (list_t *list, list_t new, int(*comparision)(void *, void *))
EXPORTNOT void list_add_beginning3 (list_t *list, list_t new)
void * list_add3 (list_t *list, list_t new)
int list_count (list_t list)
EXPORTNOT int list_remove_safe (list_t *list, void *data)
EXPORTNOT void list_cleanup (list_t *list)
void * list_remove3 (list_t *list, list_t elem, void(*func)(list_t data))
EXPORTNOT void * list_remove3i (list_t *list, list_t elem, void(*func)(list_t data))
EXPORTNOT void * list_unlink3 (list_t *list, list_t elem)
int list_destroy3 (list_t list, void(*func)(void *))
EXPORTNOT int list_destroy (list_t list)
static void string_realloc (string_t s, int count)
int string_append_c (string_t s, char c)
EXPORTNOT int string_append_n (string_t s, const char *str, int count)
EXPORTNOT int string_append_raw (string_t s, const char *str, int count)
int string_append (string_t s, const char *str)
string_t string_init (const char *value)
EXPORTNOT void string_remove (string_t s, int count)
char * string_free (string_t s, int free_string)
const char * itoa (long int i)
char ** array_make (const char *string, const char *sep, int max, int trim, int quotes)
int array_count (char **array)
int array_add (char ***array, char *string)
int array_add_check (char ***array, char *string, int casesensitive)
char * array_join (char **array, const char *sep)
int array_item_contains (char **array, const char *string, int casesensitive)
void array_free (char **array)
static int private_data_cmp (private_data_t *item1, private_data_t *item2)
static void private_data_free (private_data_t *item)
static __DYNSTUFF_ADD_SORTED (static __DYNSTUFF_REMOVE_SAFE(private_items, static __DYNSTUFF_REMOVE_SAFE(private_data_t, private_data_cmp)
int private_item_get_int (private_data_t **data, const char *item_name)
EXPORTNOT void private_item_set (private_data_t **data, const char *item_name, const char *value)

Dokumentacja funkcji

static __DYNSTUFF_ADD_SORTED ( static __DYNSTUFF_REMOVE_SAFE(  private_items,
static __DYNSTUFF_REMOVE_SAFE(  private_data_t,
private_data_cmp   
) [static]
int array_add ( char ***  array,
char *  string 
)
int array_add_check ( char ***  array,
char *  string,
int  casesensitive 
)
int array_count ( char **  array)
void array_free ( char **  array)
int array_item_contains ( char **  array,
const char *  string,
int  casesensitive 
)
char* array_join ( char **  array,
const char *  sep 
)
char** array_make ( const char *  string,
const char *  sep,
int  max,
int  trim,
int  quotes 
)
const char* itoa ( long int  i)
void* list_add3 ( list_t list,
list_t  new 
)
EXPORTNOT void* list_add_beginning ( list_t list,
void *  data 
)

list_add_beginning()

Add item data to the begining of the list
(Once again), item will be added at begining of the list - as first item

Zobacz również:
list_add()
list_remove()
EXPORTNOT void list_add_beginning3 ( list_t list,
list_t  new 
)
void* list_add_sorted3 ( list_t list,
list_t  new,
int(*)(void *, void *)  comparision 
)
EXPORTNOT void list_cleanup ( list_t list)

list_cleanup()

Remove from list_t all items with l->data set to NULL.
Use with list_remove_safe() after list is not in use.

int list_count ( list_t  list)

list_count()

Parametry:
list- list_t
Zwraca:
items count on list_t list.
EXPORTNOT int list_destroy ( list_t  list)
int list_destroy3 ( list_t  list,
void(*)(void *)  func 
)
void* list_remove3 ( list_t list,
list_t  elem,
void(*)(list_t data)  func 
)
EXPORTNOT void* list_remove3i ( list_t list,
list_t  elem,
void(*)(list_t data)  func 
)
EXPORTNOT int list_remove_safe ( list_t list,
void *  data 
)
EXPORTNOT void* list_unlink3 ( list_t list,
list_t  elem 
)
static int private_data_cmp ( private_data_t item1,
private_data_t item2 
) [static]
static void private_data_free ( private_data_t item) [static]
int private_item_get_int ( private_data_t **  data,
const char *  item_name 
)
EXPORTNOT void private_item_set ( private_data_t **  data,
const char *  item_name,
const char *  value 
)
int string_append ( string_t  s,
const char *  str 
)

string_append()

Append to string_t s, NUL terminated string pointed by str
Wrapper to:string_append_n(s, str, -1)

Zobacz również:
string_append_n()
int string_append_c ( string_t  s,
char  c 
)

string_append_c()

Append to string_t s char c.

Parametry:
s- string_t
c- char to append
Zwraca:
0 on success
-1 and errno set to EFAULT if input params were wrong (s == NULL || format == NULL)
EXPORTNOT int string_append_n ( string_t  s,
const char *  str,
int  count 
)

string_append_n()

Append to string_t s, first count chars, from str

Parametry:
s- string_t
str- buffer to append.
count- how many chars copy copy from str, or -1 to copy whole.
Do zrobienia:
We append here NUL terminated string, so maybe let's always do count = xstrnlen(str, count);?
Because now programmer can pass negative value, and it'll possible do SIGSEGV
Also we can allocate less memory for string, when for example str[count-3] was NUL char.
Zwraca:
0 on success
-1 and errno set to EFAULT if input params were wrong (s == NULL || str == NULL)
EXPORTNOT int string_append_raw ( string_t  s,
const char *  str,
int  count 
)

string_append_raw()

Append to string_t s, count bytes from memory pointed by str

Zobacz również:
string_append_n() - If you want to append NUL terminated (C-like) String
Do zrobienia:
XXX Protect from negative count (and less than -1) ?
char* string_free ( string_t  s,
int  free_string 
)

string_free()

Cleanup memory after string_t s, and perhaps (if free_string set) cleanup memory after char buffer.

Parametry:
s- string_t which we want to free.
free_string- do we want to free memory after char buffer?
Zobacz również:
string_clear() - if you just want to clear saved char buffer, and you don't want to free internal string_t struct.
Zwraca:
if free_string != 0 always NULL
else returns saved char buffer, which need be free()'d after use by xfree()
string_t string_init ( const char *  value)

string_init()

init string_t struct, allocating memory for string passed by value, and setting internal string_t data.

Parametry:
value- if NULL char buffer will be inited with "", otherwise with given value.
Zobacz również:
string_free() - to free memory used by string_t
Zwraca:
pointer to allocated string_t struct.
static void string_realloc ( string_t  s,
int  count 
) [static]
EXPORTNOT void string_remove ( string_t  s,
int  count 
)

string_remove()

Remove first count chars from string.

 All Struktury Danych Pliki Funkcje Zmienne Definicje typów Wyliczenia Wartości wyliczeń Definicje