summaryrefslogtreecommitdiff
path: root/src/strings
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-06-26 18:18:01 -0700
committerBen Longbons <b.r.longbons@gmail.com>2014-06-26 20:45:30 -0700
commitec21450522e3c2124f3510eef5cfd88420483248 (patch)
tree2d3dbd342dccd34bc3545ae3ab7902042abe6815 /src/strings
parent296629e067563e82b4a08b2a785d1c2f13b5a285 (diff)
downloadtmwa-ec21450522e3c2124f3510eef5cfd88420483248.tar.gz
tmwa-ec21450522e3c2124f3510eef5cfd88420483248.tar.bz2
tmwa-ec21450522e3c2124f3510eef5cfd88420483248.tar.xz
tmwa-ec21450522e3c2124f3510eef5cfd88420483248.zip
Low hanging fruit
Diffstat (limited to 'src/strings')
-rw-r--r--src/strings/astring.cpp23
-rw-r--r--src/strings/astring.hpp15
-rw-r--r--src/strings/base_test.cpp3
-rw-r--r--src/strings/literal.cpp6
-rw-r--r--src/strings/literal.hpp3
-rw-r--r--src/strings/rstring.cpp2
-rw-r--r--src/strings/strings2_test.cpp3
-rw-r--r--src/strings/strings_test.cpp3
-rw-r--r--src/strings/zstring.cpp6
-rw-r--r--src/strings/zstring.hpp3
10 files changed, 10 insertions, 57 deletions
diff --git a/src/strings/astring.cpp b/src/strings/astring.cpp
index 15d172b..9811f17 100644
--- a/src/strings/astring.cpp
+++ b/src/strings/astring.cpp
@@ -219,27 +219,4 @@ namespace strings
out = AString(buffer, buffer + len);
return len;
}
-
- AStringConverter::AStringConverter(AString& s)
- : out(s), mid(nullptr)
- {}
-
- AStringConverter::~AStringConverter()
- {
- if (mid)
- {
- out = ZString(really_construct_from_a_pointer, mid, nullptr);
- free(mid);
- }
- }
-
- char **AStringConverter::operator &()
- {
- return &mid;
- }
-
- AStringConverter convert_for_scanf(AString& s)
- {
- return AStringConverter(s);
- }
} // namespace strings
diff --git a/src/strings/astring.hpp b/src/strings/astring.hpp
index e936c4c..9e9adc2 100644
--- a/src/strings/astring.hpp
+++ b/src/strings/astring.hpp
@@ -76,21 +76,6 @@ namespace strings
__attribute__((format(printf, 2, 0)))
int do_vprint(AString& out, const char *fmt, va_list ap);
-
- class AStringConverter
- {
- AString& out;
- char *mid;
- public:
- AStringConverter(AString& s);
- // this usually gets elided, but multi dtor calls are fine anyway
- AStringConverter(const AStringConverter&) = default;
- AStringConverter& operator = (const AStringConverter&) = delete;
- ~AStringConverter();
- char **operator &();
- };
-
- AStringConverter convert_for_scanf(AString& s);
} // namespace strings
# include "astring.tcc"
diff --git a/src/strings/base_test.cpp b/src/strings/base_test.cpp
index c630b5c..cab47be 100644
--- a/src/strings/base_test.cpp
+++ b/src/strings/base_test.cpp
@@ -27,6 +27,9 @@
#include "../poison.hpp"
+
+#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
+
using namespace strings;
struct _test : VString<1> {};
diff --git a/src/strings/literal.cpp b/src/strings/literal.cpp
index 65c00f6..506b79b 100644
--- a/src/strings/literal.cpp
+++ b/src/strings/literal.cpp
@@ -49,10 +49,4 @@ namespace strings
{
return zs.c_str();
}
-
- __attribute__((format(scanf, 2, 0)))
- int do_vscan(LString in, const char *fmt, va_list ap)
- {
- return vsscanf(in.c_str(), fmt, ap);
- }
} // namespace strings
diff --git a/src/strings/literal.hpp b/src/strings/literal.hpp
index 6d84ebd..001dc46 100644
--- a/src/strings/literal.hpp
+++ b/src/strings/literal.hpp
@@ -62,9 +62,6 @@ namespace strings
// Actually, it might now.
const char *decay_for_printf(const LString& zs);
- __attribute__((format(scanf, 2, 0)))
- int do_vscan(LString in, const char *fmt, va_list ap);
-
inline
LString operator "" _s(const char *s, size_t)
{
diff --git a/src/strings/rstring.cpp b/src/strings/rstring.cpp
index 6ffe79c..c2ca64b 100644
--- a/src/strings/rstring.cpp
+++ b/src/strings/rstring.cpp
@@ -58,7 +58,7 @@ namespace strings
{
// order important for self-assign
r.owned->count++;
- // owned can be NULL from ctors
+ // owned can be nullptr from ctors
// TODO do ctors *properly* (requires gcc 4.7 to stay sane)
if (owned && !owned->count--)
::operator delete(owned);
diff --git a/src/strings/strings2_test.cpp b/src/strings/strings2_test.cpp
index 8a7ee66..23f09fd 100644
--- a/src/strings/strings2_test.cpp
+++ b/src/strings/strings2_test.cpp
@@ -23,6 +23,9 @@
#include "../poison.hpp"
+
+#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
+
TEST(StringTests, traits2)
{
ZString print_non = "\t\e"_s;
diff --git a/src/strings/strings_test.cpp b/src/strings/strings_test.cpp
index b76bde5..df4c2c3 100644
--- a/src/strings/strings_test.cpp
+++ b/src/strings/strings_test.cpp
@@ -25,6 +25,9 @@
#include "../poison.hpp"
+
+#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
+
template<typename T>
class StringTest : public ::testing::Test
{
diff --git a/src/strings/zstring.cpp b/src/strings/zstring.cpp
index dd17e66..94535d0 100644
--- a/src/strings/zstring.cpp
+++ b/src/strings/zstring.cpp
@@ -74,10 +74,4 @@ namespace strings
{
return zs.c_str();
}
-
- __attribute__((format(scanf, 2, 0)))
- int do_vscan(ZString in, const char *fmt, va_list ap)
- {
- return vsscanf(in.c_str(), fmt, ap);
- }
} // namespace strings
diff --git a/src/strings/zstring.hpp b/src/strings/zstring.hpp
index e4cd1fd..a0dda2c 100644
--- a/src/strings/zstring.hpp
+++ b/src/strings/zstring.hpp
@@ -59,9 +59,6 @@ namespace strings
// Nope, it doesn't, since there's a template
// Actually, it might now.
const char *decay_for_printf(const ZString& zs);
-
- __attribute__((format(scanf, 2, 0)))
- int do_vscan(ZString in, const char *fmt, va_list ap);
} // namespace strings
# include "zstring.tcc"