mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: remove membufferpp
This the C++ version of membuffer. Since everything is C++, it can just be made the default. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
db4b972897
commit
ead58cd039
13 changed files with 40 additions and 53 deletions
|
@ -4,10 +4,6 @@
|
|||
* 'membuffer' functions will manage memory allocation avoiding performance
|
||||
* issues related to superfluous re-allocation. See 'make_room' function
|
||||
*
|
||||
* Before using it membuffer struct should be properly initialized
|
||||
*
|
||||
* struct membuffer mb = { 0 };
|
||||
*
|
||||
* Internal membuffer buffer will not by default contain null terminator,
|
||||
* adding it should be done using 'mb_cstring' function
|
||||
*
|
||||
|
@ -28,10 +24,6 @@
|
|||
* ptr = detach_cstring();
|
||||
*
|
||||
* where the caller now has a C string and is supposed to free it.
|
||||
*
|
||||
* Otherwise allocated memory should be freed
|
||||
*
|
||||
* free_buffer(&mb);
|
||||
*/
|
||||
#ifndef MEMBUFFER_H
|
||||
#define MEMBUFFER_H
|
||||
|
@ -42,14 +34,10 @@
|
|||
#include "units.h"
|
||||
|
||||
struct membuffer {
|
||||
unsigned int len, alloc;
|
||||
char *buffer;
|
||||
};
|
||||
|
||||
// In C++ code use this - it automatically frees the buffer, when going out of scope.
|
||||
struct membufferpp : public membuffer {
|
||||
membufferpp();
|
||||
~membufferpp();
|
||||
unsigned int len = 0, alloc = 0;
|
||||
char *buffer = nullptr;
|
||||
membuffer();
|
||||
~membuffer();
|
||||
};
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue