ACK: [PATCH 08/20] fwts_log_scan: move fwts_log_compare_mode_str_to_val
Alex Hung
alex.hung at canonical.com
Wed Jun 27 22:50:38 UTC 2018
On 2018-06-20 05:14 AM, Marcello Sylvester Bauer wrote:
> Signed-off-by: Marcello Sylvester Bauer <info at marcellobauer.com>
> ---
> src/lib/include/fwts_log_scan.h | 1 +
> src/lib/src/fwts_klog.c | 7 +------
> src/lib/src/fwts_log_scan.c | 14 ++++++++++++++
> 3 files changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/src/lib/include/fwts_log_scan.h b/src/lib/include/fwts_log_scan.h
> index 0f03d336..f4ebfc4c 100644
> --- a/src/lib/include/fwts_log_scan.h
> +++ b/src/lib/include/fwts_log_scan.h
> @@ -47,5 +47,6 @@ char *fwts_log_remove_timestamp(char *text);
> int fwts_log_scan(fwts_framework *fw, fwts_list *log, fwts_log_scan_func callback, fwts_log_progress_func progress, void *private, int *errors, bool remove_timestamp);
> char *fwts_log_unique_label(const char *str, const char *label);
> void fwts_log_scan_patterns(fwts_framework *fw, char *line, int repeated, char *prevline, void *private, int *errors, const char *name, const char *advice);
> +fwts_compare_mode fwts_log_compare_mode_str_to_val(const char *str);
>
> #endif
> diff --git a/src/lib/src/fwts_klog.c b/src/lib/src/fwts_klog.c
> index 48ebf13b..159b7541 100644
> --- a/src/lib/src/fwts_klog.c
> +++ b/src/lib/src/fwts_klog.c
> @@ -126,12 +126,7 @@ void fwts_klog_scan_patterns(fwts_framework *fw,
> */
> fwts_compare_mode fwts_klog_compare_mode_str_to_val(const char *str)
> {
> - if (strcmp(str, "regex") == 0)
> - return FWTS_COMPARE_REGEX;
> - else if (strcmp(str, "string") == 0)
> - return FWTS_COMPARE_STRING;
> - else
> - return FWTS_COMPARE_UNKNOWN;
> + return fwts_log_compare_mode_str_to_val(str);
> }
>
> /*
> diff --git a/src/lib/src/fwts_log_scan.c b/src/lib/src/fwts_log_scan.c
> index 40611a36..3146554a 100644
> --- a/src/lib/src/fwts_log_scan.c
> +++ b/src/lib/src/fwts_log_scan.c
> @@ -296,3 +296,17 @@ void fwts_log_scan_patterns(fwts_framework *fw,
> pattern++;
> }
> }
> +
> +/*
> + * fwts_log_compare_mode_str_to_val()
> + * convert compare mode strings (from json database) to compare_mode values
> + */
> +fwts_compare_mode fwts_log_compare_mode_str_to_val(const char *str)
> +{
> + if (strcmp(str, "regex") == 0)
> + return FWTS_COMPARE_REGEX;
> + else if (strcmp(str, "string") == 0)
> + return FWTS_COMPARE_STRING;
> + else
> + return FWTS_COMPARE_UNKNOWN;
> +}
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list