Ticket #4179: mc-4179-hex_translate_to_regex.c-fix-maybe-uninitialize-warning.patch

File mc-4179-hex_translate_to_regex.c-fix-maybe-uninitialize-warning.patch, 1.3 KB (added by and, 15 months ago)
  • tests/lib/search/hex_translate_to_regex.c

    From 84cf65aab34313b706dd3e03b2aef7ca665d3ad5 Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Mon, 28 Dec 2020 18:08:29 +0000
    Subject: [PATCH] (hex_translate_to_regex.c) fix maybe-uninitialized warning
    
    hex_translate_to_regex.c: In function 'test_hex_translate_to_regex_fn':
    hex_translate_to_regex.c:172:9: error: 'error' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      172 |         mctest_assert_int_eq (error, data->expected_error);
          |         ^
    hex_translate_to_regex.c:154:33: note: 'error' was declared here
      154 |     mc_search_hex_parse_error_t error;
          |                                 ^
    
    Found by gcc-9.3.0
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     tests/lib/search/hex_translate_to_regex.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/tests/lib/search/hex_translate_to_regex.c b/tests/lib/search/hex_translate_to_regex.c
    index c40ee3122..7e09630fa 100644
    a b START_PARAMETRIZED_TEST (test_hex_translate_to_regex, test_hex_translate_to_rege 
    151151/* *INDENT-ON* */ 
    152152{ 
    153153    GString *tmp, *dest_str; 
    154     mc_search_hex_parse_error_t error; 
     154    mc_search_hex_parse_error_t error = MC_SEARCH_HEX_E_OK; 
    155155 
    156156    /* given */ 
    157157    tmp = g_string_new (data->input_value);