- added Dyn2Cstring (convert to C string and free dyn string)
This commit is contained in:
13
dynstring.c
13
dynstring.c
@ -280,3 +280,16 @@ int DynStringBackspace(pDynString self)
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
char *Dyn2Cstring(pDynString self) {
|
||||
char *result;
|
||||
|
||||
assert(self);
|
||||
assert(self->iMAGIC == DYNMAGIC);
|
||||
|
||||
result = self->pBuffer;
|
||||
|
||||
free(self);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -96,4 +96,8 @@ int DynStringBackspace(pDynString self);
|
||||
/*
|
||||
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
|
||||
|
Reference in New Issue
Block a user