diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2019-02-19 02:31:35 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-19 10:18:31 +0100 |
commit | 6f3c772939463c97a4a8a8371db42b8f4b181c68 (patch) | |
tree | f8010e9e49696505e22cd0dff3bd84089392a240 /strbuf.h | |
parent | I somehow got stuff to bulid, now it just doesn't link. (diff) | |
download | calp-6f3c772939463c97a4a8a8371db42b8f4b181c68.tar.gz calp-6f3c772939463c97a4a8a8371db42b8f4b181c68.tar.xz |
No idea, to tired.
Diffstat (limited to 'strbuf.h')
-rw-r--r-- | strbuf.h | 20 |
1 files changed, 8 insertions, 12 deletions
@@ -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 */ |