diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-02-18 17:41:29 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-02-18 17:41:29 +0100 |
commit | 793f801a5ccc76645e569adb971eeced67e763be (patch) | |
tree | 3c095a73a0d16b890fe0e8fe6dfce86190501410 /src/qregisters.h | |
parent | 0674f295767f2e953baf2eec13cdd4be52468ca1 (diff) | |
download | sciteco-793f801a5ccc76645e569adb971eeced67e763be.tar.gz |
removed unreliable CHR2STR() macro
* referencing temporaries is unreliable/buggy in GNU C++, at least since v4.7
* in higher optimization levels it resulted in massive memory corruptions
* this is responsible for the build issues (PPA build issues)
* instead, always declare a buffer on the stack which guarantees that the
variable lives long enough
* the g_strdup(CHR2STR(x)) idiom has been replaced with String::chrdup(x)
Diffstat (limited to 'src/qregisters.h')
-rw-r--r-- | src/qregisters.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/qregisters.h b/src/qregisters.h index d548179..511d770 100644 --- a/src/qregisters.h +++ b/src/qregisters.h @@ -186,7 +186,8 @@ public: inline QRegister * insert(gchar name) { - return insert(CHR2STR(name)); + gchar buf[] = {name, '\0'}; + return insert(buf); } inline QRegister * @@ -198,7 +199,8 @@ public: inline QRegister * operator [](gchar chr) { - return operator [](CHR2STR(chr)); + gchar buf[] = {chr, '\0'}; + return operator [](buf); } void edit(QRegister *reg); |