Files | Defines | Functions | Variables

Cp_string

Files

file  str.c
 

cp_string - 'safe' string implementation


Defines

#define CHUNK   0x1000
#define LINELEN   81
#define CHARS_PER_LINE   16

Functions

cp_stringcp_string_create (char *data, int len)
 allocate a new cp_string
cp_stringcp_string_create_empty (int initial_size)
 allocate an empty cp_string with a given buffer size
void cp_string_delete (cp_string *str)
 deallocate a cp_string
void cp_string_drop_wrap (cp_string *str)
void cp_string_drop_content (char *str)
void cp_string_destroy (cp_string *str)
 synonym for cp_string_delete
void cp_string_clear (cp_string *str)
 sets string to 0
void cp_string_reset (cp_string *str)
 releases existing string and sets string to empty string
cp_stringcp_string_cstrcpy (cp_string *str, char *cstr)
 copies the content of a null terminated c string
cp_stringcp_string_cpy (cp_string *dst, cp_string *src)
 copies the content of a cp_string
cp_stringcp_string_dup (cp_string *src)
 creates a copy of src string.
cp_stringcp_string_cstrdup (char *src)
 creates a cp_string with src as its content
cp_stringcp_string_cat (cp_string *str, cp_string *appendum)
 concatenate cp_strings
cp_stringcp_string_cstrcat (cp_string *str, char *cstr)
 append data from a null terminated c string
cp_stringcp_string_append_char (cp_string *str, char ch)
 append a character to a string
cp_stringcp_string_cat_bin (cp_string *str, void *bin, int len)
 append data from a buffer
int cp_string_cmp (cp_string *s1, cp_string *s2)
 compare cp_strings
char * cp_string_tocstr (cp_string *str)
 return a pointer to the internal buffer
int cp_string_len (cp_string *s)
 return the length of the internal buffer
char * cp_string_data (cp_string *s)
 return the internal buffer
cp_stringcp_string_read (int fd, int len)
 read len bytes from an open file descriptor (blocking)
int cp_string_write (cp_string *str, int fd)
 write the content of a cp_string to a file descriptor (blocking)
cp_stringcp_string_read_file (char *filename)
 read the contents of a file into a cp_string
int cp_string_write_file (cp_string *str, char *filename)
 write the contents of a cp_string to a file
void cp_string_dump (cp_string *str)
 dump a cp_string to stdout
void cp_string_flip (cp_string *str)
 flip the contents of a cp_string
cp_stringcp_string_filter (cp_string *str, char *letters)
 remove all occurrences of letters from str

Variables

static char * print_char = "ðñòóôõö÷øùúûüýþÿ"

Function Documentation

cp_string* cp_string_dup ( cp_string src  ) 

creates a copy of src string.

internal buffer is duplicated.

References cp_string.