summaryrefslogtreecommitdiff
path: root/strbuf.c
diff options
context:
space:
mode:
authorLibravatar Lars Schneider <larsxschneider@gmail.com>2018-02-15 16:27:06 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-02-15 11:36:15 -0800
commit13ecb4638ed92a56e855d2e6d3a9b71c4125eb51 (patch)
treee41558dc45dea5b4dd1a61c9440edada8f351b37 /strbuf.c
parentstrbuf: remove unnecessary NUL assignment in xstrdup_tolower() (diff)
downloadtgif-13ecb4638ed92a56e855d2e6d3a9b71c4125eb51.tar.xz
strbuf: add xstrdup_toupper()
Create a copy of an existing string and make all characters upper case. Similar xstrdup_tolower(). This function is used in a subsequent commit. Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/strbuf.c b/strbuf.c
index 490f7850e9..a20af696bc 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -784,6 +784,18 @@ char *xstrdup_tolower(const char *string)
return result;
}
+char *xstrdup_toupper(const char *string)
+{
+ char *result;
+ size_t len, i;
+
+ len = strlen(string);
+ result = xmallocz(len);
+ for (i = 0; i < len; i++)
+ result[i] = toupper(string[i]);
+ return result;
+}
+
char *xstrvfmt(const char *fmt, va_list ap)
{
struct strbuf buf = STRBUF_INIT;