On Thu, May 6, 2021 at 10:09 PM David Gow davidgow@google.com wrote:
Currently, the KUNIT_EXPECT_STREQ() and related macros assign both string arguments to variables of their own type (via typeof()). This seems to be to prevent the macro argument from being evaluated multiple times.
However, yhis doesn't work if one of these is a fixed-length character array, rather than a character pointer, as (for example) char[16] will always allocate a new string.
By always using 'const char*' (the type strcmp expects), we're always just taking a pointer to the string, which works even with character arrays.
Signed-off-by: David Gow davidgow@google.com
Aside from the nit that Daniel pointed out, this looks good to me.
Reviewed-by: Brendan Higgins brendanhiggins@google.com