]> arthur.barton.de Git - netdata.git/blobdiff - src/inlined.h
dns_query_time plugin: replace "." with "_" in dimensions
[netdata.git] / src / inlined.h
index 01492b04451d23539f578d7cb02dfa94e87dcfe3..0dc11c950951b3d9dfcf4bda8a8fd615cc5be058 100644 (file)
@@ -5,11 +5,11 @@
 
 #ifdef KERNEL_32BIT
 typedef uint32_t kernel_uint_t;
-#define str2kernel_unit_t(string) str2uint32_t(string)
+#define str2kernel_uint_t(string) str2uint32_t(string)
 #define KERNEL_UINT_FORMAT "%u"
 #else
 typedef uint64_t kernel_uint_t;
-#define str2kernel_unit_t(string) str2uint64_t(string)
+#define str2kernel_uint_t(string) str2uint64_t(string)
 #define KERNEL_UINT_FORMAT "%" PRIu64
 #endif
 
@@ -128,12 +128,24 @@ static inline unsigned long long str2ull(const char *s) {
 #undef strcmp
 #endif
 #define strcmp(a, b) strsame(a, b)
+#endif // NETDATA_STRCMP_OVERRIDE
+
 static inline int strsame(const char *a, const char *b) {
     if(unlikely(a == b)) return 0;
     while(*a && *a == *b) { a++; b++; }
     return *a - *b;
 }
-#endif // NETDATA_STRSAME
+
+static inline char *strncpyz(char *dst, const char *src, size_t n) {
+    char *p = dst;
+
+    while (*src && n--)
+        *dst++ = *src++;
+
+    *dst = '\0';
+
+    return p;
+}
 
 static inline int read_single_number_file(const char *filename, unsigned long long *result) {
     char buffer[30 + 1];