From 613689d42274be12e4af4f98e8605933c1eba1ab Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Mon, 22 Apr 2024 16:47:29 +0900 Subject: [PATCH] decode_prometheus_write: Make source level private for cmt allocator definitions Signed-off-by: Hiroshi Hatake --- .../cmetrics/cmt_decode_prometheus_remote_write.h | 15 --------------- src/cmt_decode_prometheus_remote_write.c | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/cmetrics/cmt_decode_prometheus_remote_write.h b/include/cmetrics/cmt_decode_prometheus_remote_write.h index cd6f8c8..4eef2e4 100644 --- a/include/cmetrics/cmt_decode_prometheus_remote_write.h +++ b/include/cmetrics/cmt_decode_prometheus_remote_write.h @@ -33,21 +33,6 @@ #define CMT_DECODE_PROMETHEUS_REMOTE_WRITE_UNPACK_ERROR 6 #define CMT_DECODE_PROMETHEUS_REMOTE_WRITE_UNSUPPORTED_METRIC_TYPE 7 -static void *__cmt_allocator_alloc(void *data, size_t size) { - return malloc(size); -} -static void __cmt_allocator_free(void *data, void *ptr) { - free(ptr); -} - -static ProtobufCAllocator __cmt_allocator = { - .alloc = __cmt_allocator_alloc, - .free = __cmt_allocator_free, - .allocator_data = NULL -}; - -#define cmt_system_allocator __cmt_allocator - int cmt_decode_prometheus_remote_write_create(struct cmt **out_cmt, char *in_buf, size_t in_size); void cmt_decode_prometheus_remote_write_destroy(struct cmt *cmt); diff --git a/src/cmt_decode_prometheus_remote_write.c b/src/cmt_decode_prometheus_remote_write.c index 5486646..1724ff4 100644 --- a/src/cmt_decode_prometheus_remote_write.c +++ b/src/cmt_decode_prometheus_remote_write.c @@ -26,6 +26,21 @@ #include #include +static void *__cmt_allocator_alloc(void *data, size_t size) { + return malloc(size); +} +static void __cmt_allocator_free(void *data, void *ptr) { + free(ptr); +} + +static ProtobufCAllocator __cmt_allocator = { + .alloc = __cmt_allocator_alloc, + .free = __cmt_allocator_free, + .allocator_data = NULL +}; + +#define cmt_system_allocator __cmt_allocator + static char *cmt_metric_name_from_labels(Prometheus__TimeSeries *ts) { int i;