Beispiel #1
0
logdb_record* logdb_record_copy(logdb_record* b_rec)
{
    logdb_record* a_rec = logdb_record_new();
    cstr_append_cstr(a_rec->key, b_rec->key);
    cstr_append_cstr(a_rec->value, b_rec->value);
    a_rec->written = b_rec->written;
    a_rec->mode = b_rec->mode;
    return a_rec;
}
Beispiel #2
0
/**
 * @brief  Creates new cstring.
 * @param  cstr pointer to a cstring from which the data will be taken.
 * @return pointer to newly created cstring.
 *
 * Writes string from cstr parameter into newly created cstring.
 */
cstring *cstr_create_cstr(cstring const *cstr)
{
    cstring *s = gc_calloc("cstring", sizeof(*s), 1);

	if(!cstr)
	{
		debug("str not given. was created.\n");
		return s;
	}



    if (s)
        return cstr_append_cstr(s, cstr);

    debug("Memory allocation for cstrig has failed.\n");
    return NULL;
}