aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/alloc/secmem.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/alloc/secmem.h b/src/alloc/secmem.h
index 13d2bfdce..f14e2a9db 100644
--- a/src/alloc/secmem.h
+++ b/src/alloc/secmem.h
@@ -162,6 +162,16 @@ class MemoryRegion
{ append(other.begin(), other.size()); }
/**
+ * Truncate the buffer to at most n elements
+ * @param n the length of the resulting buffer
+ */
+ void truncate(u32bit n)
+ {
+ if(n < used)
+ used = n;
+ }
+
+ /**
* Zeroise the bytes of this buffer. The length remains unchanged.
*/
void clear() { clear_mem(buf, allocated); }