| 48 | |
| 49 | |
| 50 | my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str) |
| 51 | { |
| 52 | uint length=0; |
| 53 | DBUG_ENTER("dynstr_set"); |
| 54 | |
| 55 | if (init_str && (length= (uint) strlen(init_str)+1) > str->max_length) |
| 56 | { |
| 57 | str->max_length=((length+str->alloc_increment-1)/str->alloc_increment)* |
| 58 | str->alloc_increment; |
| 59 | if (!str->max_length) |
| 60 | str->max_length=str->alloc_increment; |
| 61 | if (!(str->str=(char*) my_realloc(str->str,str->max_length,MYF(MY_WME)))) |
| 62 | DBUG_RETURN(TRUE); |
| 63 | } |
| 64 | if (init_str) |
| 65 | { |
| 66 | str->length=length-1; |
| 67 | memcpy(str->str,init_str,length); |
| 68 | } |
| 69 | else |
| 70 | str->length=0; |
| 71 | DBUG_RETURN(FALSE); |
| 72 | } |
| 73 | |
| 74 | |
| 75 | my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size) |
nothing calls this directly
no test coverage detected