- added Dyn2Cstring (convert to C string and free dyn string)

This commit is contained in:
zolliker
2012-06-19 06:53:08 +00:00
parent c8a492e2de
commit 23f539a449
2 changed files with 17 additions and 0 deletions

View File

@ -280,3 +280,16 @@ int DynStringBackspace(pDynString self)
} }
return 1; return 1;
} }
/*---------------------------------------------------------------------------*/
char *Dyn2Cstring(pDynString self) {
char *result;
assert(self);
assert(self->iMAGIC == DYNMAGIC);
result = self->pBuffer;
free(self);
return result;
}

View File

@ -96,4 +96,8 @@ int DynStringBackspace(pDynString self);
/* /*
removes one character at the end from the dynstring removes one character at the end from the dynstring
*/ */
char *Dyn2Cstring(pDynString self);
/*
convert to C string and delete dynstring. The result must be freed when no longer used.
*/
#endif #endif