14 char *chardest = NULL ;
19 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest );
21 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest );
23 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest );
25 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest );
27 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest );
29 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest );
32 written = length = 0 ;
35 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest );
37 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest );
39 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest );
41 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest );
43 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest );
45 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest );
53 nstrprintf( nstr,
"Hello, file is %s line %d date %s", __FILE__, __LINE__, __TIME__ );
57 nstrprintf_cat( nstr,
" - This will be added at file %s line %d date %s", __FILE__, __LINE__, __TIME__ );
67 nstrprintf( nstr,
"Hello, file is %s line %d date %s", __FILE__, __LINE__, __TIME__ );
71 nstrprintf_cat( nstr,
" - This will be added at file %s line %d date %s", __FILE__, __LINE__, __TIME__ );
100 char data[1048576]=
"";
102 for(
int it = 0 ; it < 1048575 ; it ++ )
104 data[ it ] = 32 + rand()%63 ;
108 for(
int it = 0 ; it < 100 ; it ++ )
110 write_and_fit( &nstr -> data , &nstr -> length , &nstr -> written , data );
#define Free(__ptr)
Free Handler to get errors.
#define _nstr(__PTR)
N_STR or "NULL" string for logging purposes.
#define n_log(__LEVEL__,...)
Logging function wrapper to get line and func.
#define LOG_DEBUG
debug-level messages
void set_log_level(const int log_level)
Set the global log level value ( static int LOG_LEVEL )
#define LOG_INFO
informational
int nstrcat(N_STR *dst, N_STR *src)
Add N_STR *src content to N_STR *dst, resizing it if needed.
size_t NSTRBYTE
N_STR base unit.
#define free_nstr(__ptr)
free a N_STR structure and set the pointer to NULL
#define nstrprintf(__nstr_var,...)
Macro to quickly allocate and sprintf to N_STR *.
N_STR * nstrdup(N_STR *str)
Duplicate a N_STR.
int write_and_fit(char **dest, NSTRBYTE *size, NSTRBYTE *written, const char *src)
concatenate a copy of src of size strlen( src ) to dest, starting at dest[ written ],...
N_STR * new_nstr(NSTRBYTE size)
create a new N_STR string
int write_and_fit_ex(char **dest, NSTRBYTE *size, NSTRBYTE *written, const char *src, NSTRBYTE src_size, NSTRBYTE additional_padding)
concatenate a copy of src of size src_size to dest, starting at dest[ written ], updating written and...
#define nstrprintf_cat(__nstr_var,...)
Macro to quickly allocate and sprintf and cat to a N_STR *.
A box including a string and his lenght.
N_STR and string function declaration.