MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / my_multi_malloc

Function my_multi_malloc

mysys/mulalloc.c:35–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33*/
34
35void* my_multi_malloc(myf myFlags, ...)
36{
37 va_list args;
38 char **ptr,*start,*res;
39 size_t tot_length,length;
40 DBUG_ENTER("my_multi_malloc");
41
42 va_start(args,myFlags);
43 tot_length=0;
44 while ((ptr=va_arg(args, char **)))
45 {
46 length=va_arg(args,uint);
47 tot_length+=ALIGN_SIZE(length);
48 }
49 va_end(args);
50
51 if (!(start=(char *) my_malloc(tot_length,myFlags)))
52 DBUG_RETURN(0); /* purecov: inspected */
53
54 va_start(args,myFlags);
55 res=start;
56 while ((ptr=va_arg(args, char **)))
57 {
58 *ptr=res;
59 length=va_arg(args,uint);
60 res+=ALIGN_SIZE(length);
61 }
62 va_end(args);
63 DBUG_RETURN((void*) start);
64}

Callers 5

client.cFile · 0.85
mysql_options4Function · 0.85
push_ignored_db_dirFunction · 0.85
put_dboptFunction · 0.85
my_security_attr_createFunction · 0.85

Calls 1

my_mallocFunction · 0.85

Tested by

no test coverage detected