mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: port errorhelper.c to C++
Use the C++-version of membuffer. This fixes two memory leaks: report_info() on every(!) invocation and report_error() before the error callback is set. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
ec0bc2d06c
commit
b097c0a44f
3 changed files with 4 additions and 5 deletions
|
@ -33,7 +33,7 @@ SOURCES += subsurface-mobile-main.cpp \
|
||||||
core/configuredivecomputer.cpp \
|
core/configuredivecomputer.cpp \
|
||||||
core/divelogexportlogic.cpp \
|
core/divelogexportlogic.cpp \
|
||||||
core/divesitehelpers.cpp \
|
core/divesitehelpers.cpp \
|
||||||
core/errorhelper.c \
|
core/errorhelper.cpp \
|
||||||
core/exif.cpp \
|
core/exif.cpp \
|
||||||
core/format.cpp \
|
core/format.cpp \
|
||||||
core/gettextfromc.cpp \
|
core/gettextfromc.cpp \
|
||||||
|
|
|
@ -85,7 +85,7 @@ set(SUBSURFACE_CORE_LIB_SRCS
|
||||||
eventtype.h
|
eventtype.h
|
||||||
equipment.c
|
equipment.c
|
||||||
equipment.h
|
equipment.h
|
||||||
errorhelper.c
|
errorhelper.cpp
|
||||||
exif.cpp
|
exif.cpp
|
||||||
exif.h
|
exif.h
|
||||||
extradata.h
|
extradata.h
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "errorhelper.h"
|
#include "errorhelper.h"
|
||||||
#include "membuffer.h"
|
#include "membuffer.h"
|
||||||
#include "qthelper.h"
|
|
||||||
|
|
||||||
#if !defined(Q_OS_ANDROID) && !defined(__ANDROID__)
|
#if !defined(Q_OS_ANDROID) && !defined(__ANDROID__)
|
||||||
#define LOG_MSG(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
|
#define LOG_MSG(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
|
||||||
|
@ -21,7 +20,7 @@ int verbose;
|
||||||
|
|
||||||
void report_info(const char *fmt, ...)
|
void report_info(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
struct membuffer buf = { 0 };
|
struct membufferpp buf;
|
||||||
|
|
||||||
VA_BUF(&buf, fmt);
|
VA_BUF(&buf, fmt);
|
||||||
strip_mb(&buf);
|
strip_mb(&buf);
|
||||||
|
@ -32,7 +31,7 @@ static void (*error_cb)(char *) = NULL;
|
||||||
|
|
||||||
int report_error(const char *fmt, ...)
|
int report_error(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
struct membuffer buf = { 0 };
|
struct membufferpp buf;
|
||||||
|
|
||||||
VA_BUF(&buf, fmt);
|
VA_BUF(&buf, fmt);
|
||||||
strip_mb(&buf);
|
strip_mb(&buf);
|
Loading…
Add table
Reference in a new issue