typedef struct StrBuf StrBuf;
StrBuf* NewStrBuf(void);
+StrBuf* NewStrBufDup(const StrBuf *CopyMe);
StrBuf* NewStrBufPlain(const char* ptr, int nChars);
int StrBufPlain(StrBuf *Buf, const char* ptr, int nChars);
StrBuf* _NewConstStrBuf(const char* StringConstant, size_t SizeOfStrConstant);
return NewBuf;
}
+StrBuf* NewStrBufDup(const StrBuf *CopyMe)
+{
+ StrBuf *NewBuf;
+
+ if (CopyMe == NULL)
+ return NewStrBuf();
+
+ NewBuf = (StrBuf*) malloc(sizeof(StrBuf));
+ NewBuf->buf = (char*) malloc(CopyMe->BufSize);
+ memcpy(NewBuf->buf, CopyMe->buf, CopyMe->BufUsed + 1);
+ return NewBuf;
+}
StrBuf* NewStrBufPlain(const char* ptr, int nChars)
{