Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: fix some compiler warnings #7730

Merged
merged 26 commits into from
Jul 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f054757
sp: remove unused variable
edsiper Jul 20, 2023
eda8fef
callback: fix function prototype
edsiper Jul 20, 2023
e5073cf
network: initialize result var for unix socket
edsiper Jul 20, 2023
0d8170e
utils: fix function prototype
edsiper Jul 20, 2023
a2e2c76
time: fix size_t formatter
edsiper Jul 20, 2023
4b2b97a
tp: fix function prototype
edsiper Jul 20, 2023
b5250ea
snappy: initialize variable
edsiper Jul 20, 2023
12c3226
input: remove unused variable
edsiper Jul 21, 2023
cec10d8
help: initialize variable
edsiper Jul 21, 2023
4700a48
reload: fix format and remove unused variable
edsiper Jul 21, 2023
d45da2a
storage: remove unused variable
edsiper Jul 21, 2023
62d994d
strptime: add variable cast to gmtime_r call
edsiper Jul 21, 2023
d2232e9
luajit: fix function prototype
edsiper Jul 21, 2023
af23024
filter_kubernetes: remove unused variabe
edsiper Jul 21, 2023
7af8c24
filter_multiline: remove unused variable
edsiper Jul 21, 2023
434bbc1
filter_modify: remove unused variab;e
edsiper Jul 21, 2023
d5e1095
filter_nightfall: initialize variable
edsiper Jul 21, 2023
67be8ba
in_forward: remove unused variable
edsiper Jul 21, 2023
6cf5eb2
out_azure_logs_ingestion: initialize variable
edsiper Jul 21, 2023
3c4140d
out_prometheus_remote_write: add cast to variable
edsiper Jul 21, 2023
129f4d8
out_splunk: remove unused variable
edsiper Jul 21, 2023
b4d3f37
in_mqtt: remove unused variable
edsiper Jul 21, 2023
1d9aa8d
in_event_type: fix cfl function prototype
edsiper Jul 21, 2023
0bc3f19
in_splunk: initialize variable
edsiper Jul 21, 2023
8240a7a
in_elasticsearch: remove unused variable
edsiper Jul 21, 2023
c3c07c2
in_head: remove unused variables
edsiper Jul 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/fluent-bit/flb_callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct flb_callback {
struct flb_config *config; /* Fluent Bit context */
};

struct flb_callback *flb_callback_create();
struct flb_callback *flb_callback_create(char *name);
void flb_callback_destroy(struct flb_callback *ctx);
int flb_callback_set(struct flb_callback *ctx, char *name,
void (*cb)(char *, void *, void *));
Expand Down
2 changes: 1 addition & 1 deletion include/fluent-bit/flb_luajit.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct flb_luajit {
struct mk_list _head; /* Link to flb_config->lua */
};

struct flb_luajit *flb_luajit_create();
struct flb_luajit *flb_luajit_create(struct flb_config *config);
int flb_luajit_load_script(struct flb_luajit *lj, char *script);
int flb_luajit_load_buffer(struct flb_luajit *lj, char *string, size_t len, char *name);

Expand Down
2 changes: 1 addition & 1 deletion include/fluent-bit/flb_thread_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct flb_tp_thread *flb_tp_thread_get_rr(struct flb_tp *tp);
int flb_tp_thread_start(struct flb_tp *tp, struct flb_tp_thread *th);
int flb_tp_thread_start_id(struct flb_tp *tp, int id);
int flb_tp_thread_start_all(struct flb_tp *tp);
int flb_tp_thread_stop();
int flb_tp_thread_stop(struct flb_tp *tp, struct flb_tp_thread *th);
int flb_tp_thread_stop_all(struct flb_tp *tp);
int flb_tp_thread_destroy();

Expand Down
2 changes: 1 addition & 1 deletion include/fluent-bit/flb_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void flb_utils_warn_c(const char *msg);
void flb_message(int type, const char *file, int line, const char *fmt, ...);

#ifdef FLB_HAVE_FORK
int flb_utils_set_daemon();
int flb_utils_set_daemon(struct flb_config *config);
#endif

void flb_utils_print_setup(struct flb_config *config);
Expand Down
19 changes: 0 additions & 19 deletions plugins/filter_kubernetes/kubernetes.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ static int pack_map_content(struct flb_log_event_encoder *log_encoder,
int i;
int map_size = 0;
int merge_status = -1;
int new_map_size = 0;
int log_index = -1;
int log_buf_entries = 0;
size_t off = 0;
Expand Down Expand Up @@ -295,9 +294,6 @@ static int pack_map_content(struct flb_log_event_encoder *log_encoder,
return -1;
}

/* Determinate the size of the new map */
new_map_size = map_size;

/* If a merged status exists, check the number of entries to merge */
if (log_index != -1) {
if (merge_status == MERGE_PARSED) {
Expand All @@ -316,23 +312,8 @@ static int pack_map_content(struct flb_log_event_encoder *log_encoder,
}
}

/* Kubernetes metadata */
if (kube_buf && kube_size > 0) {
new_map_size++;
}

if (log_buf_entries > 0) {
if (ctx->merge_log_key != NULL) {
new_map_size++;
}
else {
new_map_size += log_buf_entries;
}
}

if ((merge_status == MERGE_PARSED || merge_status == MERGE_MAP) &&
ctx->keep_log == FLB_FALSE) {
new_map_size--;
}

/* Original map */
Expand Down
6 changes: 0 additions & 6 deletions plugins/filter_modify/modify.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,12 +682,6 @@ static inline bool kv_key_matches_str(msgpack_object_kv * kv,
return helper_msgpack_object_matches_str(&kv->key, str, len);
}

static inline bool kv_val_matches_str(msgpack_object_kv * kv,
char *str, int len)
{
return helper_msgpack_object_matches_str(&kv->val, str, len);
}

static inline bool kv_key_matches_str_rule_key(msgpack_object_kv * kv,
struct modify_rule *rule)
{
Expand Down
3 changes: 0 additions & 3 deletions plugins/filter_multiline/ml.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ static int ml_filter_partial(const void *data, size_t bytes,
msgpack_sbuffer tmp_sbuf;
msgpack_packer tmp_pck;
int partial_records = 0;
int total_records = 0;
int return_records = 0;
int partial = FLB_FALSE;
int is_last_partial = FLB_FALSE;
Expand Down Expand Up @@ -619,8 +618,6 @@ static int ml_filter_partial(const void *data, size_t bytes,
while ((ret = flb_log_event_decoder_next(
&log_decoder,
&log_event)) == FLB_EVENT_DECODER_SUCCESS) {
total_records++;

partial = ml_is_partial(log_event.body);
if (partial == FLB_TRUE) {
partial_records++;
Expand Down
2 changes: 1 addition & 1 deletion plugins/filter_nightfall/nightfall.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ static int cb_nightfall_filter(const void *data, size_t bytes,
int ret;
char is_modified = FLB_FALSE;

struct flb_time tmp;
struct flb_time tmp = {0};

char *to_redact;
size_t to_redact_size;
Expand Down
2 changes: 0 additions & 2 deletions plugins/in_elasticsearch/in_elasticsearch_bulk_prot.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ static int process_ndpack(struct flb_in_elasticsearch *ctx, flb_sds_t tag, char
msgpack_object *obj;
flb_sds_t tag_from_record = NULL;
int idx = 0;
int cursor = 0;
flb_sds_t write_op;
size_t op_str_size = 0;
int op_ret = FLB_FALSE;
Expand Down Expand Up @@ -544,7 +543,6 @@ static int process_ndpack(struct flb_in_elasticsearch *ctx, flb_sds_t tag, char

proceed:
idx++;
cursor++;
}
else {
flb_plg_error(ctx->ins, "skip record from invalid type: %i",
Expand Down
2 changes: 1 addition & 1 deletion plugins/in_event_type/event_type.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ static int send_traces(struct flb_input_instance *ins)
ctr_span_event_set_attribute_string(event, "syscall 3", "write()");

/* add a key/value pair list */
kv = cfl_kvlist_create(1);
kv = cfl_kvlist_create();
cfl_kvlist_insert_string(kv, "language", "c");

ctr_span_set_attribute_kvlist(span_root, "my-list", kv);
Expand Down
3 changes: 0 additions & 3 deletions plugins/in_forward/fw_prot.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ int fw_prot_process(struct flb_input_instance *ins, struct fw_conn *conn)
{
int ret;
int stag_len;
int c = 0;
int event_type;
int contain_options = FLB_FALSE;
size_t index = 0;
Expand Down Expand Up @@ -705,8 +704,6 @@ int fw_prot_process(struct flb_input_instance *ins, struct fw_conn *conn)
out_tag, flb_sds_len(out_tag),
&root, &entry, &map, chunk_id,
metadata_id);

c++;
}
else if (entry.type == MSGPACK_OBJECT_STR ||
entry.type == MSGPACK_OBJECT_BIN) {
Expand Down
10 changes: 0 additions & 10 deletions plugins/in_head/in_head.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ static int single_value_per_record(struct flb_input_instance *i_ins,
struct flb_in_head_config *ctx)
{
int ret = -1;
int num_map = 1;

ctx->buf[0] = '\0'; /* clear buf */
ctx->buf_len = 0;
Expand All @@ -124,10 +123,6 @@ static int single_value_per_record(struct flb_input_instance *i_ins,
flb_plg_trace(ctx->ins, "%s read_len=%zd buf_size=%zu", __FUNCTION__,
ctx->buf_len, ctx->buf_size);

if (ctx->add_path == FLB_TRUE) {
num_map++;
}

ret = flb_log_event_encoder_begin_record(&ctx->log_encoder);

if (ret == FLB_EVENT_ENCODER_SUCCESS) {
Expand Down Expand Up @@ -183,7 +178,6 @@ static int split_lines_per_record(struct flb_input_instance *i_ins,
int ret;
size_t str_len;
size_t key_len;
int num_map = ctx->lines;
char *ret_buf;
char key_str[KEY_LEN_MAX] = {0};

Expand All @@ -193,10 +187,6 @@ static int split_lines_per_record(struct flb_input_instance *i_ins,
return -1;
}

if (ctx->add_path == FLB_TRUE) {
num_map++;
}

ret = flb_log_event_encoder_begin_record(&ctx->log_encoder);

if (ret == FLB_EVENT_ENCODER_SUCCESS) {
Expand Down
4 changes: 1 addition & 3 deletions plugins/in_mqtt/mqtt_prot.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ static int mqtt_handle_ping(struct mqtt_conn *conn)
int mqtt_prot_parser(struct mqtt_conn *conn)
{
int ret;
int bytes = 0;
int length = 0;
int pos = conn->buf_pos;
int mult;
Expand Down Expand Up @@ -370,7 +369,7 @@ int mqtt_prot_parser(struct mqtt_conn *conn)
/* Get the remaining length */
mult = 1;
length = 0;
bytes = 0;

do {
if (conn->buf_pos + 1 > conn->buf_len) {
conn->buf_pos = pos;
Expand All @@ -379,7 +378,6 @@ int mqtt_prot_parser(struct mqtt_conn *conn)
return MQTT_MORE;
}

bytes++;
length += (BUFC() & 127) * mult;
mult *= 128;
if (mult > 128*128*128) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/in_splunk/splunk_prot.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ static int validate_auth_header(struct flb_splunk *ctx, struct mk_http_request *
static int handle_hec_payload(struct flb_splunk *ctx, int content_type,
flb_sds_t tag, char *buf, size_t size)
{
int ret;
int ret = -1;

if (content_type == HTTP_CONTENT_JSON) {
ret = parse_hec_payload_json(ctx, tag, buf, size);
Expand Down
2 changes: 1 addition & 1 deletion plugins/out_azure_logs_ingestion/azure_logs_ingestion.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ static void cb_azure_logs_ingestion_flush(struct flb_event_chunk *event_chunk,
size_t final_payload_size;
flb_sds_t token;
struct flb_connection *u_conn;
struct flb_http_client *c;
struct flb_http_client *c = NULL;
int is_compressed = FLB_FALSE;
flb_sds_t json_payload = NULL;
struct flb_az_li *ctx = out_context;
Expand Down
2 changes: 1 addition & 1 deletion plugins/out_prometheus_remote_write/remote_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static int http_post(struct prometheus_remote_write_context *ctx,
&payload_buf, &payload_size);
}
else {
payload_buf = body;
payload_buf = (void *) body;
payload_size = body_len;

ret = 0;
Expand Down
8 changes: 0 additions & 8 deletions plugins/out_splunk/splunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ static int pack_map_meta(struct flb_splunk *ctx,
msgpack_object map,
char *tag, int tag_len)
{
int c = 0;
int index_key_set = FLB_FALSE;
int sourcetype_key_set = FLB_FALSE;
flb_sds_t str;
Expand All @@ -81,7 +80,6 @@ static int pack_map_meta(struct flb_splunk *ctx,
sizeof(FLB_SPLUNK_DEFAULT_EVENT_HOST) - 1);
msgpack_pack_str(mp_pck, flb_sds_len(str));
msgpack_pack_str_body(mp_pck, str, flb_sds_len(str));
c++;
}
flb_sds_destroy(str);
}
Expand All @@ -100,7 +98,6 @@ static int pack_map_meta(struct flb_splunk *ctx,
sizeof(FLB_SPLUNK_DEFAULT_EVENT_SOURCE) - 1);
msgpack_pack_str(mp_pck, flb_sds_len(str));
msgpack_pack_str_body(mp_pck, str, flb_sds_len(str));
c++;
}
flb_sds_destroy(str);
}
Expand All @@ -121,7 +118,6 @@ static int pack_map_meta(struct flb_splunk *ctx,
msgpack_pack_str(mp_pck, flb_sds_len(str));
msgpack_pack_str_body(mp_pck, str, flb_sds_len(str));
sourcetype_key_set = FLB_TRUE;
c++;
}
flb_sds_destroy(str);
}
Expand All @@ -137,7 +133,6 @@ static int pack_map_meta(struct flb_splunk *ctx,
msgpack_pack_str(mp_pck, flb_sds_len(ctx->event_sourcetype));
msgpack_pack_str_body(mp_pck,
ctx->event_sourcetype, flb_sds_len(ctx->event_sourcetype));
c++;
}

/* event index (key lookup) */
Expand All @@ -155,7 +150,6 @@ static int pack_map_meta(struct flb_splunk *ctx,
msgpack_pack_str(mp_pck, flb_sds_len(str));
msgpack_pack_str_body(mp_pck, str, flb_sds_len(str));
index_key_set = FLB_TRUE;
c++;
}
flb_sds_destroy(str);
}
Expand All @@ -171,7 +165,6 @@ static int pack_map_meta(struct flb_splunk *ctx,
msgpack_pack_str(mp_pck, flb_sds_len(ctx->event_index));
msgpack_pack_str_body(mp_pck,
ctx->event_index, flb_sds_len(ctx->event_index));
c++;
}

/* event 'fields' */
Expand Down Expand Up @@ -203,7 +196,6 @@ static int pack_map_meta(struct flb_splunk *ctx,
flb_ra_key_value_destroy(rval);
}
flb_mp_map_header_end(&mh_fields);
c++;
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/flb_help.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ int flb_help_output(struct flb_output_instance *ins, void **out_buf, size_t *out
static int build_plugin_help(struct flb_config *config, int type, char *name,
char **out_buf, size_t *out_size)
{
void *help_buf;
void *help_buf = NULL;
size_t help_size = 0;
struct flb_custom_instance *c = NULL;
struct flb_input_instance *i = NULL;
Expand Down
2 changes: 0 additions & 2 deletions src/flb_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,6 @@ static int collector_start(struct flb_input_collector *coll,
int flb_input_collector_start(int coll_id, struct flb_input_instance *in)
{
int ret;
int c = 0;
struct mk_list *head;
struct flb_input_collector *coll;

Expand All @@ -1542,7 +1541,6 @@ int flb_input_collector_start(int coll_id, struct flb_input_instance *in)
}
return ret;
}
c++;
}

return -1;
Expand Down
2 changes: 1 addition & 1 deletion src/flb_network.c
Original file line number Diff line number Diff line change
Expand Up @@ -1806,7 +1806,7 @@ static int net_address_unix_socket_peer_pid_raw(flb_sockfd_t fd,
struct ucred peer_credentials;
#endif
size_t required_buffer_size;
int result;
int result = 0;

if (address->ss_family != AF_UNIX) {
return -1;
Expand Down
3 changes: 1 addition & 2 deletions src/flb_reload.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ int flb_reload(flb_ctx_t *ctx, struct flb_cf *cf_opts)
struct flb_cf *new_cf;
struct flb_cf *original_cf;
int verbose;
int enable_reloading;

if (ctx == NULL) {
flb_error("[reload] given flb context is NULL");
Expand All @@ -394,7 +393,7 @@ int flb_reload(flb_ctx_t *ctx, struct flb_cf *cf_opts)
return -1;
}

flb_info("reloading instance pid=%lu tid=%u", getpid(), pthread_self());
flb_info("reloading instance pid=%lu tid=%p", (long unsigned) getpid(), pthread_self());

if (old_config->conf_path_file) {
file = flb_sds_create(old_config->conf_path_file);
Expand Down
2 changes: 1 addition & 1 deletion src/flb_snappy.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ int flb_snappy_uncompress_framed_data(char *in_data, size_t in_len,
size_t uncompressed_chunk_count;
int stream_identifier_found;
char *aggregated_data_buffer;
size_t aggregated_data_length;
size_t aggregated_data_length = 0;
size_t aggregated_data_offset;
size_t compressed_chunk_count;
struct cfl_list *iterator_backup;
Expand Down
5 changes: 0 additions & 5 deletions src/flb_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ static void metrics_append_input(msgpack_packer *mp_pck,
int up;
int down;
int busy;
int busy_size_err;
char *name;
ssize_t busy_size;
struct mk_list *head;
Expand Down Expand Up @@ -274,7 +273,6 @@ static void metrics_append_input(msgpack_packer *mp_pck,
*/
busy = 0;
busy_size = 0;
busy_size_err = 0;

/* up/down */
up = 0;
Expand All @@ -289,9 +287,6 @@ static void metrics_append_input(msgpack_packer *mp_pck,
if (size >= 0) {
busy_size += size;
}
else {
busy_size_err++;
}
}

if (cio_chunk_is_up(ic->chunk) == CIO_TRUE) {
Expand Down
Loading
Loading