Cleanup: Move *_loc formatting functions into new format.cpp file

qthelper.cpp is already quite voluminous. Move the recently
introduced localized versions of (v)snprintf() and put_format()
into their own translation unit.

Moreover, adopt C-style semantics for asprintf_loc(). This function
will be used to remove fixed-size buffers in core/plannernotes.c.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-03-14 20:37:19 +01:00 committed by Dirk Hohndel
parent 36249f2780
commit 5afe1a53d8
8 changed files with 448 additions and 405 deletions

View file

@ -6,13 +6,7 @@
#include "dive.h"
#include "divelist.h"
// 1) Types and macros
#ifdef __GNUC__
#define __printf(x, y) __attribute__((__format__(__printf__, x, y)))
#else
#define __printf(x, y)
#endif
// 1) Types
enum inertgas {N2, HE};
@ -56,8 +50,6 @@ QString getUUID();
QStringList imageExtensionFilters();
char *intdup(int index);
char *copy_qstring(const QString &);
__printf(1, 2) QString asprintf_loc(const char *cformat, ...);
__printf(1, 0) QString vasprintf_loc(const char *cformat, va_list ap);
#endif
// 3) Functions visible to C and C++
@ -93,8 +85,6 @@ void cache_insert(int tissue, int timestep, enum inertgas gas, double value);
void print_qt_versions();
void lock_planner();
void unlock_planner();
__printf(3, 4) int snprintf_loc(char *dst, size_t size, const char *cformat, ...);
__printf(3, 0) int vsnprintf_loc(char *dst, size_t size, const char *cformat, va_list ap);
#ifdef __cplusplus
}