Skip to content

Commit

Permalink
rever the changes and fix tests/internal/config_map.c
Browse files Browse the repository at this point in the history
  • Loading branch information
YingJie Fu committed Aug 14, 2024
1 parent f465c37 commit 4b37b62
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion plugins/in_head/in_head.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ static struct flb_config_map config_map[] = {
"Set the record key"
},
{
FLB_CONFIG_MAP_SIZE, "buf_size", DEFAULT_BUF_SIZE,
FLB_CONFIG_MAP_INT, "buf_size", DEFAULT_BUF_SIZE,
0, FLB_TRUE, offsetof(struct flb_in_head_config, buf_size),
"Set the read buffer size"
},
Expand Down
4 changes: 2 additions & 2 deletions plugins/in_tail/tail_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ struct flb_tail_config {
int refresh_interval_sec; /* seconds to re-scan */
long refresh_interval_nsec;/* nanoseconds to re-scan */
int read_from_head; /* read new files from head */
time_t rotate_wait; /* sec to wait on rotated files */
int rotate_wait; /* sec to wait on rotated files */
int watcher_interval; /* watcher interval */
time_t ignore_older; /* ignore fields older than X seconds */
int ignore_older; /* ignore fields older than X seconds */
time_t last_pending; /* last time a 'pending signal' was emitted' */
struct mk_list *path_list; /* list of paths to scan (glob) */
flb_sds_t path_key; /* key name of file path */
Expand Down
12 changes: 6 additions & 6 deletions src/flb_config_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ static int translate_default_value(struct flb_config_map *map, char *val)
entry->val.s_num = flb_utils_size_to_bytes(val);
}
else if (map->type == FLB_CONFIG_MAP_TIME) {
entry->val.s_num = flb_utils_time_to_seconds(val);
entry->val.i_num = flb_utils_time_to_seconds(val);
}
else if (map->type >= FLB_CONFIG_MAP_CLIST &&
map->type <= FLB_CONFIG_MAP_SLIST_4) {
Expand Down Expand Up @@ -650,8 +650,8 @@ int flb_config_map_set(struct mk_list *properties, struct mk_list *map, void *co
*m_s_num = m->value.val.s_num;
}
else if (m->type == FLB_CONFIG_MAP_TIME) {
m_s_num = (size_t *) (base + m->offset);
*m_s_num = m->value.val.s_num;
m_i_num = (int *) (base + m->offset);
*m_i_num = m->value.val.i_num;
}
else if (m->type == FLB_CONFIG_MAP_BOOL) {
m_bool = (int *) (base + m->offset);
Expand Down Expand Up @@ -717,7 +717,7 @@ int flb_config_map_set(struct mk_list *properties, struct mk_list *map, void *co
entry->val.s_num = flb_utils_size_to_bytes(kv->val);
}
else if (m->type == FLB_CONFIG_MAP_TIME) {
entry->val.s_num = flb_utils_time_to_seconds(kv->val);
entry->val.i_num = flb_utils_time_to_seconds(kv->val);
}
else if (m->type == FLB_CONFIG_MAP_BOOL) {
ret = flb_utils_bool(kv->val);
Expand Down Expand Up @@ -793,8 +793,8 @@ int flb_config_map_set(struct mk_list *properties, struct mk_list *map, void *co
*m_s_num = flb_utils_size_to_bytes(kv->val);
}
else if (m->type == FLB_CONFIG_MAP_TIME) {
m_s_num = (size_t *) (base + m->offset);
*m_s_num = flb_utils_time_to_seconds(kv->val);
m_i_num = (int *) (base + m->offset);
*m_i_num = flb_utils_time_to_seconds(kv->val);
}
else if (m->type == FLB_CONFIG_MAP_VARIANT) {
m_variant = (struct cfl_variant **) (base + m->offset);
Expand Down
2 changes: 1 addition & 1 deletion tests/internal/config_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct context {
/* Single values */
int num_int;
size_t size;
time_t time;
int time;
int boolean;
double num_double;
flb_sds_t string;
Expand Down

0 comments on commit 4b37b62

Please sign in to comment.