summaryrefslogtreecommitdiff
path: root/src/utils/tostring.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/tostring.h')
-rw-r--r--src/utils/tostring.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/utils/tostring.h b/src/utils/tostring.h
index 5ac1d3aa..62eb44e4 100644
--- a/src/utils/tostring.h
+++ b/src/utils/tostring.h
@@ -32,4 +32,19 @@ std::string toString(const T &arg)
return ss.str();
}
+// TODO: Is there a good way to suppress warnings from classes which don't use
+// this function?
+inline char *iptostring(int address)
+{
+ static char asciiIP[16];
+
+ sprintf(asciiIP, "%i.%i.%i.%i",
+ (unsigned char)(address),
+ (unsigned char)(address >> 8),
+ (unsigned char)(address >> 16),
+ (unsigned char)(address >> 24));
+
+ return asciiIP;
+}
+
#endif