Skip to content

Commit

Permalink
decode_prometheus_write: Make source level private for cmt allocator …
Browse files Browse the repository at this point in the history
…definitions

Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Apr 22, 2024
1 parent 6adc832 commit 613689d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
15 changes: 0 additions & 15 deletions include/cmetrics/cmt_decode_prometheus_remote_write.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
15 changes: 15 additions & 0 deletions src/cmt_decode_prometheus_remote_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@
#include <cmetrics/cmt_untyped.h>
#include <cmetrics/cmt_decode_prometheus_remote_write.h>

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;
Expand Down

0 comments on commit 613689d

Please sign in to comment.