Thread (34 messages) 34 messages, 7 authors, 2025-11-18

Re: [PATCH v2 01/10] string: provide strends()

From: Bartosz Golaszewski <hidden>
Date: 2025-10-22 15:36:48
Also in: linux-arm-msm, linux-gpio, linux-hardening, linux-sound, lkml

On Wed, Oct 22, 2025 at 5:25 PM Andy Shevchenko
[off-list ref] wrote:
On Wed, Oct 22, 2025 at 03:10:40PM +0200, Bartosz Golaszewski wrote:
quoted
From: Bartosz Golaszewski <redacted>

Implement a function for checking if a string ends with a different
string and add its kunit test cases.
...
quoted
+static void string_test_strends(struct kunit *test)
+{
+     KUNIT_EXPECT_TRUE(test, strends("foo-bar", "bar"));
+     KUNIT_EXPECT_TRUE(test, strends("foo-bar", "-bar"));
+     KUNIT_EXPECT_TRUE(test, strends("foobar", "foobar"));
+     KUNIT_EXPECT_TRUE(test, strends("foobar", ""));
+     KUNIT_EXPECT_FALSE(test, strends("bar", "foobar"));
+     KUNIT_EXPECT_FALSE(test, strends("", "foo"));
+     KUNIT_EXPECT_FALSE(test, strends("foobar", "ba"));
+     KUNIT_EXPECT_TRUE(test, strends("", ""));
+}
Have you checked the binary file? If you want this to be properly implemented,
generate the suffix. (Actually making the function static inline makes my point
really visible)
Andy, this is bikeshedding. This is literally the least important
piece of this series. It doesn't matter for the big picture whether
this is inlined or not.

Bartosz
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help