projects
/
oweals
/
dinit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Large refactoring of dinitctl.
[oweals/dinit.git]
/
src
/
cpbuffer.h
diff --git
a/src/cpbuffer.h
b/src/cpbuffer.h
index 978720430b47a0b51d8a8e11eb75b35c139fba04..eb77523dd78584d9f3058b5b1a3cdee0efeeaf7d 100644
(file)
--- a/
src/cpbuffer.h
+++ b/
src/cpbuffer.h
@@
-29,6
+29,11
@@
template <int SIZE> class CPBuffer
return &buf[cur_idx];
}
return &buf[cur_idx];
}
+ char * get_buf_base()
+ {
+ return buf;
+ }
+
int get_contiguous_length(char *ptr)
{
int eidx = cur_idx + length;
int get_contiguous_length(char *ptr)
{
int eidx = cur_idx + length;
@@
-66,6
+71,12
@@
template <int SIZE> class CPBuffer
return 1;
}
return 1;
}
+ // Trim the buffer to the specified length (must be less than current length)
+ void trim_to(int new_length)
+ {
+ length = new_length;
+ }
+
char operator[](int idx) noexcept
{
int dest_idx = cur_idx + idx;
char operator[](int idx) noexcept
{
int dest_idx = cur_idx + idx;