summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2018-05-25 14:26:44 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2018-07-10 23:41:15 +0200
commit19146b415251f2ded693e12812683dbe7af8f146 (patch)
treeac69dfbf59158a77b3896c1aeca36fe34abacab6
parent673300920c0f4182bdf449e789d13aeb525ac3ea (diff)
Improved perf (define concatenate as inline function).
Change-Id: If682e464346078b7254fbc10123e82787e089011 Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
-rw-r--r--.vscode/settings.json41
-rw-r--r--src/plugins/influxdb.c7
-rw-r--r--src/plugins/influxdb.h8
3 files changed, 31 insertions, 25 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 85c0a34..c3366cb 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,21 +1,28 @@
{
- "files.associations": {
- "harvester-apidef.h": "c",
- "typeinfo": "c",
- "curl-wrap.h": "c",
- "wrap-json.h": "c",
- "array": "c",
- "initializer_list": "c",
- "string_view": "c",
- "utility": "c",
- "valarray": "c",
- "string.h": "c",
- "stdio.h": "c",
- "ratio": "c",
- "system_error": "c",
- "type_traits": "c",
- "influxdb.h": "c"
- },
+ "files.associations": {
+ "*.bb": "bat",
+ "*.inc": "bat",
+ "*.bbclass": "bat",
+ "*.rules": "shellscript",
+ "Jenkinsfile": "declarative",
+ "harvester-apidef.h": "c",
+ "typeinfo": "c",
+ "curl-wrap.h": "c",
+ "wrap-json.h": "c",
+ "array": "c",
+ "initializer_list": "c",
+ "string_view": "c",
+ "utility": "c",
+ "valarray": "c",
+ "string.h": "c",
+ "stdio.h": "c",
+ "ratio": "c",
+ "system_error": "c",
+ "type_traits": "c",
+ "influxdb.h": "c",
+ "tsdb.h": "c",
+ "ctl-plugin.h": "c"
+ },
"C_Cpp.intelliSenseEngineFallback": "Disabled",
"C_Cpp.errorSquiggles": "Disabled",
"cSpell.words": [
diff --git a/src/plugins/influxdb.c b/src/plugins/influxdb.c
index c2fe118..ae39a2a 100644
--- a/src/plugins/influxdb.c
+++ b/src/plugins/influxdb.c
@@ -19,7 +19,6 @@
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
-#include <string.h>
#include "influxdb.h"
#include "tsdb.h"
@@ -72,12 +71,6 @@ CTLP_CAPI(influxdb_ping, source, argsJ, eventJ)
return ret;
}
-void concatenate(char* dest, const char* source, const char *sep)
-{
- strncat(dest, sep, strlen(sep));
- strncat(dest, source, strlen(source));
-}
-
size_t make_url(char *url, size_t l_url, const char *host, const char *port, const char *endpoint)
{
bzero(url, l_url);
diff --git a/src/plugins/influxdb.h b/src/plugins/influxdb.h
index ed05f97..0f06dda 100644
--- a/src/plugins/influxdb.h
+++ b/src/plugins/influxdb.h
@@ -19,6 +19,8 @@
#define _INFLUXDB_H_
#define _GNU_SOURCE
+#include <string.h>
+
#include "ctl-plugin.h"
#include "wrap-json.h"
#include "tsdb.h"
@@ -39,7 +41,11 @@ int create_database(AFB_ReqT request);
int unpack_metric_from_api(json_object *m, struct series_t *serie);
-void concatenate(char* dest, const char* source, const char *sep);
+static inline void concatenate(char* dest, const char* source, const char *sep)
+{
+ strncat(dest, sep, strlen(sep));
+ strncat(dest, source, strlen(source));
+}
size_t make_url(char *url, size_t l_url, const char *host, const char *port, const char *endpoint);