Skip to content

Commit

Permalink
out_chronicle: remove redundant code (#8004)
Browse files Browse the repository at this point in the history
These initializations are redundant. The variables are already initialized with these values and there's no code that could change them until this point.

Signed-off-by: lecaros <[email protected]>
  • Loading branch information
lecaros authored Oct 17, 2023
1 parent fe0debf commit 8982e2d
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions plugins/out_chronicle/chronicle.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,6 @@ static flb_sds_t flb_pack_msgpack_extract_log_key(void *out_context, uint64_t by
int i;
int map_size;
int check = FLB_FALSE;
int found = FLB_FALSE;
int log_key_missing = 0;
int ret;
struct flb_chronicle *ctx = out_context;
Expand Down Expand Up @@ -550,10 +549,6 @@ static flb_sds_t flb_pack_msgpack_extract_log_key(void *out_context, uint64_t by

map_size = map.via.map.size;

/* Reset variables for found log_key and correct type */
found = FLB_FALSE;
check = FLB_FALSE;

/* Extract log_key from record and append to output buffer */
for (i = 0; i < map_size; i++) {
key = map.via.map.ptr[i].key;
Expand All @@ -572,7 +567,6 @@ static flb_sds_t flb_pack_msgpack_extract_log_key(void *out_context, uint64_t by

if (check == FLB_TRUE) {
if (strncmp(ctx->log_key, key_str, key_str_size) == 0) {
found = FLB_TRUE;

/*
* Copy contents of value into buffer. Necessary to copy
Expand Down Expand Up @@ -607,9 +601,7 @@ static flb_sds_t flb_pack_msgpack_extract_log_key(void *out_context, uint64_t by
}

/* If log_key was not found in the current record, mark log key as missing */
if (found == FLB_FALSE) {
log_key_missing++;
}
log_key_missing++;
}

if (log_key_missing > 0) {
Expand Down

0 comments on commit 8982e2d

Please sign in to comment.