- added DynStringShorten
This commit is contained in:
13
dynstring.c
13
dynstring.c
@ -281,6 +281,19 @@ int DynStringBackspace(pDynString self)
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int DynStringShorten(pDynString self, int length)
|
||||
{
|
||||
assert(self);
|
||||
assert(self->iMAGIC == DYNMAGIC);
|
||||
|
||||
if (length >= self->iTextLen || length < 0) {
|
||||
return 0;
|
||||
}
|
||||
self->iTextLen = length;
|
||||
self->pBuffer[length] = '\0';
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
char *Dyn2Cstring(pDynString self) {
|
||||
char *result;
|
||||
|
||||
|
Reference in New Issue
Block a user