Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Documentation: kunit: Clean up some string casts in examples

As the type checking is no longer excessively strict, get rid of the
unsightly (char*) casts -- and comment discussing them -- from the KUnit
usage page.

Signed-off-by: David Gow <davidgow@google.com>
Reviewed-by: Daniel Latypov <dlatypov@google.com>
Acked-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

David Gow and committed by
Shuah Khan
99a8e899 3747b5c0

+3 -4
+3 -4
Documentation/dev-tools/kunit/usage.rst
··· 465 465 466 466 .. code-block:: c 467 467 468 - /* Note: the cast is to satisfy overly strict type-checking. */ 469 468 #define TEST_SHA1(in, want) \ 470 469 sha1sum(in, out); \ 471 - KUNIT_EXPECT_STREQ_MSG(test, (char *)out, want, "sha1sum(%s)", in); 470 + KUNIT_EXPECT_STREQ_MSG(test, out, want, "sha1sum(%s)", in); 472 471 473 472 char out[40]; 474 473 TEST_SHA1("hello world", "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"); ··· 506 507 }; 507 508 for (i = 0; i < ARRAY_SIZE(cases); ++i) { 508 509 sha1sum(cases[i].str, out); 509 - KUNIT_EXPECT_STREQ_MSG(test, (char *)out, cases[i].sha1, 510 + KUNIT_EXPECT_STREQ_MSG(test, out, cases[i].sha1, 510 511 "sha1sum(%s)", cases[i].str); 511 512 } 512 513 ··· 567 568 struct sha1_test_case *test_param = (struct sha1_test_case *)(test->param_value); 568 569 569 570 sha1sum(test_param->str, out); 570 - KUNIT_EXPECT_STREQ_MSG(test, (char *)out, test_param->sha1, 571 + KUNIT_EXPECT_STREQ_MSG(test, out, test_param->sha1, 571 572 "sha1sum(%s)", test_param->str); 572 573 } 573 574