| 33 | */ |
| 34 | |
| 35 | void* 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 | } |
no test coverage detected