aboutsummaryrefslogtreecommitdiff
path: root/strbuf.h
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-02-19 02:31:35 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-19 10:18:31 +0100
commit6f3c772939463c97a4a8a8371db42b8f4b181c68 (patch)
treef8010e9e49696505e22cd0dff3bd84089392a240 /strbuf.h
parentI somehow got stuff to bulid, now it just doesn't link. (diff)
downloadcalp-6f3c772939463c97a4a8a8371db42b8f4b181c68.tar.gz
calp-6f3c772939463c97a4a8a8371db42b8f4b181c68.tar.xz
No idea, to tired.
Diffstat (limited to 'strbuf.h')
-rw-r--r--strbuf.h20
1 files changed, 8 insertions, 12 deletions
diff --git a/strbuf.h b/strbuf.h
index bf109daf..04457c0d 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -22,6 +22,9 @@ struct strbuf {
size_t len = 0;
strbuf () : strbuf (1) { };
+
+ strbuf (const strbuf& other);
+
strbuf (size_t alloc)
: alloc(alloc)
, mem(static_cast<char*>(malloc(alloc))) { };
@@ -61,10 +64,13 @@ struct strbuf {
{ return this->mem[this->len]; }
/* Resets the seek for strbuf to 0. */
- void reset();
+ void reset()
+ { this->ptr = 0; }
/* Sets the length and seek ptr to 0, but doesn't touch the memmory. */
- void soft_reset();
+ void soft_reset() {
+ this->ptr = 0; this->len = 0;
+ };
std::string to_string() {
return std::string (this->mem);
@@ -81,14 +87,4 @@ struct strbuf {
* Copies contents from src to dest, also allocating dest in the
* process. dest should not be initialized before self call.
*/
-#if 0
-int strbuf_init_copy(strbuf* dest, strbuf* src);
-
-strbuf* RESOLVE(strbuf)(strbuf*, strbuf*);
-
-FMT_F(strbuf);
-
-int SIZE(strbuf)(strbuf*);
-#endif
-
#endif /* STRBUF_H */