return Buf->BufSize;
}
+/**
+ * \brief shrink an _EMPTY_ buffer if its Buffer superseeds threshhold to NewSize. Buffercontent is thoroughly ignored and flushed.
+ * \param Buf Buffer to shrink (has to be empty)
+ * \param ThreshHold if the buffer is bigger then this, its readjusted
+ * \param NewSize if we Shrink it, how big are we going to be afterwards?
+ */
+void ReAdjustEmptyBuf(StrBuf *Buf, long ThreshHold, long NewSize)
+{
+ if (Buf->BufUsed > ThreshHold) {
+ free(Buf->buf);
+ Buf->buf = (char*) malloc(NewSize);
+ Buf->BufUsed = 0;
+ Buf->BufSize = NewSize;
+ }
+}
+
/**
* \brief shrink long term buffers to their real size so they don't waste memory
* \param Buf buffer to shrink