patch [#29651] Add a __str__ Method to Matutils Matrices so print(matrix) Shows Colum...
[blender.git] / source / blender / blenlib / intern / BLI_dynstr.c
index 349bc3492e78df611f8657b2792207c245693d70..ad52de180aa08c6091dcbacf618382c20dda91c0 100644 (file)
@@ -226,11 +226,11 @@ int BLI_dynstr_get_len(DynStr *ds)
        return ds->curlen;
 }
 
        return ds->curlen;
 }
 
-char *BLI_dynstr_get_cstring(DynStr *ds)
+void BLI_dynstr_get_cstring_ex(DynStr *ds, char *rets)
 {
 {
-       char *s, *rets= MEM_mallocN(ds->curlen+1, "dynstr_cstring");
+       char *s;
        DynStrElem *dse;
        DynStrElem *dse;
-       
+
        for (s= rets, dse= ds->elems; dse; dse= dse->next) {
                int slen= strlen(dse->str);
 
        for (s= rets, dse= ds->elems; dse; dse= dse->next) {
                int slen= strlen(dse->str);
 
@@ -239,7 +239,12 @@ char *BLI_dynstr_get_cstring(DynStr *ds)
                s+= slen;
        }
        rets[ds->curlen]= '\0';
                s+= slen;
        }
        rets[ds->curlen]= '\0';
-       
+}
+
+char *BLI_dynstr_get_cstring(DynStr *ds)
+{
+       char *rets= MEM_mallocN(ds->curlen+1, "dynstr_cstring");
+       BLI_dynstr_get_cstring_ex(ds, rets);
        return rets;
 }
 
        return rets;
 }