strbuf: add xstrdup_toupper()
[gitweb.git] / strbuf.c
index 490f7850e963b8171032986ae18e7c3491115b40..a20af696bc8cf9ca0bf6730c7db1b1021d79e185 100644 (file)
--- 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;