From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Marco Felsch <m.felsch@pengutronix.de>,
Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v2 5/5] pbl: string: add strncmp
Date: Wed, 14 Jan 2026 13:00:59 +0100 [thread overview]
Message-ID: <20260114120221.941836-5-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20260114120221.941836-1-a.fatoum@pengutronix.de>
From: Marco Felsch <m.felsch@pengutronix.de>
For use by PBL code, import the barebox proper definition of strncmp
into pbl/string.c.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 - > v2:
- split off preparatory patch from
https://lore.barebox.org/barebox/20251110-v2025-09-0-topic-optee-of-handling-v1-0-8f0625ac5471@pengutronix.de/T/#t
- add a commit message body
---
pbl/string.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/pbl/string.c b/pbl/string.c
index 528f62ef2055..89663fef3d6a 100644
--- a/pbl/string.c
+++ b/pbl/string.c
@@ -102,6 +102,21 @@ int strcmp(const char *cs, const char *ct)
return res;
}
+int strncmp(const char *cs, const char *ct, size_t count)
+{
+ register signed char __res = 0;
+
+ BUG_ON(!cs || !ct);
+
+ while (count) {
+ if ((__res = *cs - *ct++) != 0 || !*cs++)
+ break;
+ count--;
+ }
+
+ return __res;
+}
+
int strcasecmp(const char *s1, const char *s2)
{
int c1, c2;
--
2.47.3
prev parent reply other threads:[~2026-01-14 12:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-14 12:00 [PATCH v2 1/5] pbl: fdt: fix fdt_fixup_mem error handling Ahmad Fatoum
2026-01-14 12:00 ` [PATCH v2 2/5] pbl: compressed-dtb: add missing includes Ahmad Fatoum
2026-01-14 12:00 ` [PATCH v2 3/5] ARM: atf: add missing includes in atf_common.h Ahmad Fatoum
2026-01-14 12:00 ` [PATCH v2 4/5] ARM: i.MX8M: cosmetic cleanup Ahmad Fatoum
2026-01-14 12:00 ` Ahmad Fatoum [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260114120221.941836-5-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=m.felsch@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox