Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-12-20 21:24:20 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-12-20 21:24:20 +0400
commit921b2ee2d44ed87363198d7bfa89bb7116b0818b (patch)
tree3e04fd777b5c32f4814357ff9d18289ee072c962 /source/blender/blenlib
parent1dc74acc123721d366e3628663ed029db5761e4d (diff)
parent738fdc7b6f43c3e1e838bd4239b36340fa4c2e0f (diff)
Merging r42723 through r42769 from trunk into soc-2011-tomato
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_dynstr.h11
-rw-r--r--source/blender/blenlib/intern/BLI_dynstr.c13
2 files changed, 20 insertions, 4 deletions
diff --git a/source/blender/blenlib/BLI_dynstr.h b/source/blender/blenlib/BLI_dynstr.h
index e27a315a023..32c4e012d1d 100644
--- a/source/blender/blenlib/BLI_dynstr.h
+++ b/source/blender/blenlib/BLI_dynstr.h
@@ -100,6 +100,17 @@ int BLI_dynstr_get_len (DynStr *ds);
*/
char* BLI_dynstr_get_cstring (DynStr *ds);
+/**
+ * Get a DynStr's contents as a c-string.
+ * <i> The str argument must be allocated to be at
+ * least the size of BLI_dynstr_get_len(ds) + 1. </i>
+ *
+ * @param ds The DynStr of interest.
+ * @param str The string to fill.
+ * @return The contents of @a ds as a c-string.
+ */
+void BLI_dynstr_get_cstring_ex (DynStr *ds, char *str);
+
/**
* Free the DynStr
*
diff --git a/source/blender/blenlib/intern/BLI_dynstr.c b/source/blender/blenlib/intern/BLI_dynstr.c
index 349bc3492e7..ad52de180aa 100644
--- a/source/blender/blenlib/intern/BLI_dynstr.c
+++ b/source/blender/blenlib/intern/BLI_dynstr.c
@@ -226,11 +226,11 @@ int BLI_dynstr_get_len(DynStr *ds)
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;
-
+
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';
-
+}
+
+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;
}