From bf44d0f6400bc51a5cddb7d920db150c1d818d5c Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 7 Feb 2009 22:53:37 +0000 Subject: Moved Curl_strntoupper() to the rawstr.c file where the other raw string functions are. --- lib/rawstr.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'lib/rawstr.c') diff --git a/lib/rawstr.c b/lib/rawstr.c index 795342338..25035b5b9 100644 --- a/lib/rawstr.c +++ b/lib/rawstr.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -92,7 +92,8 @@ char Curl_raw_toupper(char in) * this. See http://daniel.haxx.se/blog/2008/10/15/strcasecmp-in-turkish/ for * some further explanation to why this function is necessary. * - * The function is capable of comparing a-z case insensitively even for non-ascii. + * The function is capable of comparing a-z case insensitively even for + * non-ascii. */ int Curl_raw_equal(const char *first, const char *second) @@ -126,3 +127,17 @@ int Curl_raw_nequal(const char *first, const char *second, size_t max) return Curl_raw_toupper(*first) == Curl_raw_toupper(*second); } +/* Copy an upper case version of the string from src to dest. The + * strings may overlap. No more than n characters of the string are copied + * (including any NUL) and the destination string will NOT be + * NUL-terminated if that limit is reached. + */ +void Curl_strntoupper(char *dest, const char *src, size_t n) +{ + if (n < 1) + return; + + do { + *dest++ = Curl_raw_toupper(*src); + } while (*src++ && --n); +} -- cgit v1.2.3