Skip to content

Commit

Permalink
Undo horrible new clang-format and extract keys to static globals
Browse files Browse the repository at this point in the history
  • Loading branch information
supervacuus committed May 7, 2024
1 parent d9bb808 commit c9aa26c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#ifdef SENTRY_PLATFORM_WINDOWS
# include <synchapi.h>
# define sleep_s(SECONDS) Sleep((SECONDS) * 1000)
# define sleep_s(SECONDS) Sleep((SECONDS)*1000)
#else

# include <signal.h>
Expand Down
29 changes: 14 additions & 15 deletions src/sentry_tracing.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,14 +533,16 @@ sentry_transaction_set_data(
}
}

static const char txn_data_key[] = "extra";
static const size_t txn_data_key_len = sizeof(txn_data_key) - 1;

void
sentry_transaction_set_data_n(sentry_transaction_t *tx, const char *key,
size_t key_len, sentry_value_t value)
{
if (tx) {
const char data_key[] = "extra";
const size_t data_key_len = sizeof(data_key) - 1;
set_data(tx->inner, data_key, data_key_len, key, key_len, value);
set_data(
tx->inner, txn_data_key, txn_data_key_len, key, key_len, value);
}
}

Expand All @@ -552,14 +554,16 @@ sentry_span_set_data(sentry_span_t *span, const char *key, sentry_value_t value)
}
}

static const char span_data_key[] = "data";
static const size_t span_data_key_len = sizeof(span_data_key) - 1;

void
sentry_span_set_data_n(
sentry_span_t *span, const char *key, size_t key_len, sentry_value_t value)
{
if (span) {
const char data_key[] = "data";
const size_t data_key_len = sizeof(data_key) - 1;
set_data(span->inner, data_key, data_key_len, key, key_len, value);
set_data(
span->inner, span_data_key, span_data_key_len, key, key_len, value);
}
}

Expand Down Expand Up @@ -587,10 +591,7 @@ sentry_transaction_remove_data_n(
sentry_transaction_t *tx, const char *key, size_t key_len)
{
if (tx) {
const char data_key[] = "extra";
const size_t data_key_len = sizeof(data_key) - 1;

remove_data(tx->inner, data_key, data_key_len, key, key_len);
remove_data(tx->inner, txn_data_key, txn_data_key_len, key, key_len);
}
}

Expand All @@ -606,10 +607,8 @@ void
sentry_span_remove_data_n(sentry_span_t *span, const char *key, size_t key_len)
{
if (span) {
const char data_key[] = "data";
const size_t data_key_len = sizeof(data_key) - 1;

remove_data(span->inner, data_key, data_key_len, key, key_len);
remove_data(
span->inner, span_data_key, span_data_key_len, key, key_len);
}
}

Expand Down Expand Up @@ -715,4 +714,4 @@ sentry_transaction_iter_headers(sentry_transaction_t *tx,
if (tx) {
sentry__span_iter_headers(tx->inner, callback, userdata);
}
}
}

0 comments on commit c9aa26c

Please sign in to comment.