Skip to content

Commit c285c41

Browse files
authored
re-export ddcommon-ffi types correctly in ddsketch-ffi (#1185)
1 parent eeecfba commit c285c41

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

ddsketch-ffi/cbindgen.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ include = ["ddsketch-ffi"]
2323
prefix = "ddsketch_"
2424
renaming_overrides_prefixing = true
2525

26+
[export.rename]
27+
"VoidResult" = "ddog_VoidResult"
28+
"Error" = "ddog_Error"
29+
"Vec_u8" = "ddog_Vec_U8"
30+
2631

2732
[fn]
2833
must_use = "DDOG_CHECK_RETURN"

examples/ffi/ddsketch.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
#define TRY(expr) \
1010
{ \
11-
struct ddsketch_VoidResult result = expr; \
12-
if (result.tag == DDSKETCH_VOID_RESULT_ERR) { \
11+
struct ddog_VoidResult result = expr; \
12+
if (result.tag == DDOG_VOID_RESULT_ERR) { \
1313
ddog_CharSlice message = ddog_Error_message((struct ddog_Error*)&result.err); \
1414
fprintf(stderr, "ERROR: %.*s\n", (int)message.len, message.ptr); \
1515
ddog_Error_drop((struct ddog_Error*)&result.err); \
@@ -44,7 +44,7 @@ int main(void) {
4444

4545
// Encode the sketch to protobuf format
4646
printf("Encoding sketch to protobuf...\n");
47-
struct ddsketch_Vec_u8 encoded = ddog_ddsketch_encode(&sketch);
47+
struct ddog_Vec_U8 encoded = ddog_ddsketch_encode(&sketch);
4848

4949
printf("Encoded sketch size: %zu bytes\n", encoded.len);
5050

0 commit comments

Comments
 (0)