/*
- * $Id: MemBuf.cc,v 1.41 2005/09/17 05:50:07 wessels Exp $
+ * $Id: MemBuf.cc,v 1.42 2006/09/20 08:13:38 adrian Exp $
*
* DEBUG: section 59 auto-growing Memory Buffer with printf
* AUTHOR: Alex Rousskov
assert(0 <= shiftSize && shiftSize <= cSize);
assert(!stolen); /* not frozen */
+ PROF_start(MemBuf_consume);
if (shiftSize > 0) {
if (shiftSize < cSize)
xmemmove(buf, buf + shiftSize, cSize - shiftSize);
terminate();
}
+ PROF_stop(MemBuf_consume);
}
// calls memcpy, appends exactly size bytes, extends buffer if needed
assert(buf);
assert(!stolen); /* not frozen */
+ PROF_start(MemBuf_append);
if (sz > 0) {
if (size + sz + 1 > capacity)
grow(size + sz + 1);
appended(sz);
}
+ PROF_stop(MemBuf_append);
}
// updates content size after external append
assert(!stolen);
assert(capacity < min_cap);
+ PROF_start(MemBuf_grow);
+
/* determine next capacity */
if (min_cap > 64 * 1024) {
/* done */
capacity = (mb_size_t) buf_cap;
+ PROF_stop(MemBuf_grow);
}