MCPcopy Create free account
hub / github.com/MariaDB/server / init_dynamic_string

Function init_dynamic_string

mysys/string.c:25–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23#include <m_string.h>
24
25my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
26 size_t init_alloc, size_t alloc_increment)
27{
28 size_t length;
29 DBUG_ENTER("init_dynamic_string");
30
31 if (!alloc_increment)
32 alloc_increment=128;
33 length=1;
34 if (init_str && (length= strlen(init_str)+1) < init_alloc)
35 init_alloc=((length+alloc_increment-1)/alloc_increment)*alloc_increment;
36 if (!init_alloc)
37 init_alloc=alloc_increment;
38
39 if (!(str->str=(char*) my_malloc(key_memory_DYNAMIC_STRING,
40 init_alloc, MYF(MY_WME))))
41 DBUG_RETURN(TRUE);
42 str->length=length-1;
43 if (init_str)
44 memcpy(str->str,init_str,length);
45 str->max_length=init_alloc;
46 str->alloc_increment=alloc_increment;
47 DBUG_RETURN(FALSE);
48}
49
50
51my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str)

Callers 15

json_norm_parseFunction · 0.85
do_evalFunction · 0.85
check_command_argsFunction · 0.85
run_toolFunction · 0.85
show_diffFunction · 0.85
compare_files2Function · 0.85
var_query_setFunction · 0.85
replaceFunction · 0.85
do_execFunction · 0.85
do_systemFunction · 0.85
do_remove_files_wildcardFunction · 0.85

Calls 1

my_mallocFunction · 0.85

Tested by 15

do_evalFunction · 0.68
check_command_argsFunction · 0.68
run_toolFunction · 0.68
show_diffFunction · 0.68
compare_files2Function · 0.68
var_query_setFunction · 0.68
replaceFunction · 0.68
do_execFunction · 0.68
do_systemFunction · 0.68
do_remove_files_wildcardFunction · 0.68
do_write_file_commandFunction · 0.68