summaryrefslogtreecommitdiff
path: root/lib/strto.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-04-08 08:32:56 -0600
committerTom Rini <trini@konsulko.com>2020-04-24 16:40:09 -0400
commitfdc79a6b125d52b6ca0fd65df538db7810d88a8d (patch)
tree589dbab11527cbd95728f4d5c8b2990975687a28 /lib/strto.c
parent4f04d54981cd9d641e4ca958c551aeb00ee55484 (diff)
downloadu-boot-fdc79a6b125d52b6ca0fd65df538db7810d88a8d.tar.gz
u-boot-fdc79a6b125d52b6ca0fd65df538db7810d88a8d.tar.bz2
u-boot-fdc79a6b125d52b6ca0fd65df538db7810d88a8d.zip
lib: Add a function to convert a string to upper case
Add a helper function for this operation. Update the strtoul() tests to check upper case as well. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib/strto.c')
-rw-r--r--lib/strto.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/strto.c b/lib/strto.c
index 606701566f..3d77115d4d 100644
--- a/lib/strto.c
+++ b/lib/strto.c
@@ -179,3 +179,11 @@ long trailing_strtol(const char *str)
{
return trailing_strtoln(str, NULL);
}
+
+void str_to_upper(const char *in, char *out, size_t len)
+{
+ for (; len > 0 && *in; len--)
+ *out++ = toupper(*in++);
+ if (len)
+ *out = '\0';
+}