13 char* chardest = NULL;
18 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest);
20 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest);
22 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest);
24 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest);
26 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest);
28 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest);
34 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest);
36 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest);
38 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest);
40 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest);
42 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest);
44 n_log(
LOG_INFO,
"charstr (%d/%d): %s\n", written, length, chardest);
52 nstrprintf(nstr,
"Hello, file is %s line %d date %s", __FILE__, __LINE__, __TIME__);
56 nstrprintf_cat(nstr,
" - This will be added at file %s line %d date %s", __FILE__, __LINE__, __TIME__);
66 nstrprintf(nstr,
"Hello, file is %s line %d date %s", __FILE__, __LINE__, __TIME__);
70 nstrprintf_cat(nstr,
" - This will be added at file %s line %d date %s", __FILE__, __LINE__, __TIME__);
101 char data[1048576] =
"";
103 for (
int it = 0; it < 1048575; it++) {
104 data[it] = 32 + rand() % 63;
106 data[1048574] =
'\0';
108 for (
int it = 0; it < 100; it++) {
#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
size_t written
size of the written data inside the string
size_t length
length of string (in case we wanna keep information after the 0 end of string value)
size_t NSTRBYTE
N_STR base unit.
#define free_nstr(__ptr)
free a N_STR structure and set the pointer to NULL
#define nstrcat(__nstr_dst, __nstr_src)
Macro to quickly concatenate two 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 ],...
#define nstrprintf_cat(__nstr_var, __format,...)
Macro to quickly allocate and sprintf and cat to a N_STR.
N_STR * new_nstr(NSTRBYTE size)
create a new N_STR string
#define nstrprintf(__nstr_var, __format,...)
Macro to quickly allocate and sprintf to N_STR.
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...
A box including a string and his lenght.
N_STR and string function declaration.