diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-07-20 07:24:07 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-07-23 11:22:43 -0700 |
commit | f142e9a9c6ba493c09a282544da8715b3656648e (patch) | |
tree | 8b419cad550f086022acdc175a7cc7dd65e7f1e2 /Subsurface-mobile.pro | |
parent | 0c84f369c35bf416071b9ef6d5a401b457fd4a38 (diff) | |
download | subsurface-f142e9a9c6ba493c09a282544da8715b3656648e.tar.gz |
core: C++-ify membuffer
C-style memory management is a pain and nearly nobody seems to get
it right. Add a C++-version of membuffer that frees the buffer
when it gets out-of-scope. Originally, I was thinking about
conditionally adding a constructor/destructor pair when compiling
with C++. But then decided to create a derived class membufferpp,
because it would be extremely confusing to have behavioral change
when changing a source from from C to C++ or vice-versa.
Also add a comment about the dangers of returned pointer: They
become dangling on changes to the membuffer.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'Subsurface-mobile.pro')
-rw-r--r-- | Subsurface-mobile.pro | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Subsurface-mobile.pro b/Subsurface-mobile.pro index 598e94e4c..2e1b6a959 100644 --- a/Subsurface-mobile.pro +++ b/Subsurface-mobile.pro @@ -86,7 +86,7 @@ SOURCES += subsurface-mobile-main.cpp \ core/divesite.c \ core/equipment.c \ core/gas.c \ - core/membuffer.c \ + core/membuffer.cpp \ core/selection.cpp \ core/sha1.c \ core/string-format.cpp \ |