util_str: add talloc_asprintf_strlower_m().
authorGünther Deschner <gd@samba.org>
Tue, 3 Jun 2008 23:29:22 +0000 (01:29 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 3 Jun 2008 23:35:43 +0000 (01:35 +0200)
Guenther

source/include/proto.h
source/lib/util_str.c

index e8a2b697d78c0baaaf4c56e9b41f8148090aa428..582300b2a6e5ca9d4ec9cec70b38b7a8caf315b5 100644 (file)
@@ -1730,6 +1730,7 @@ void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len,
                    size_t *bufsize, const char *fmt, ...);
 int asprintf_strupper_m(char **strp, const char *fmt, ...);
 char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...);
+char *talloc_asprintf_strlower_m(TALLOC_CTX *t, const char *fmt, ...);
 char *sstring_sub(const char *src, char front, char back);
 bool validate_net_name( const char *name,
                const char *invalid_chars,
index 5a08f7bc2c8257b046286e08f2cc523b32f379af..1e1108132cdf37b1aca169733dda5e0b46712529 100644 (file)
@@ -2615,6 +2615,23 @@ char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...)
        return ret;
 }
 
+char *talloc_asprintf_strlower_m(TALLOC_CTX *t, const char *fmt, ...)
+{
+       va_list ap;
+       char *ret;
+
+       va_start(ap, fmt);
+       ret = talloc_vasprintf(t, fmt, ap);
+       va_end(ap);
+
+       if (ret == NULL) {
+               return NULL;
+       }
+       strlower_m(ret);
+       return ret;
+}
+
+
 /*
    Returns the substring from src between the first occurrence of
    the char "front" and the first occurence of the char "back".