All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Torsten Bögershausen" <tboegi@web.de>
To: lars.schneider@autodesk.com
Cc: git@vger.kernel.org, gitster@pobox.com, j6t@kdbg.org,
	sunshine@sunshineco.com, peff@peff.net,
	Lars Schneider <larsxschneider@gmail.com>
Subject: Re: [PATCH v2 1/5] strbuf: add xstrdup_toupper()
Date: Fri, 29 Dec 2017 16:56:42 +0100	[thread overview]
Message-ID: <20171229155642.GA23935@tor.lan> (raw)
In-Reply-To: <20171229152222.39680-2-lars.schneider@autodesk.com>

On Fri, Dec 29, 2017 at 04:22:18PM +0100, lars.schneider@autodesk.com wrote:
> From: Lars Schneider <larsxschneider@gmail.com>
> 
> 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>
> ---
>  strbuf.c | 13 +++++++++++++
>  strbuf.h |  1 +
>  2 files changed, 14 insertions(+)
> 
> diff --git a/strbuf.c b/strbuf.c
> index 323c49ceb3..54276e96e7 100644
> --- a/strbuf.c
> +++ b/strbuf.c
> @@ -760,6 +760,19 @@ 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]);
> +	result[i] = '\0';
        ^^^^^^^^^^^^^^^^
	Isn't this already done by xmallocz()

> +	return result;
> +}
> +
>  char *xstrvfmt(const char *fmt, va_list ap)
>  {
>  	struct strbuf buf = STRBUF_INIT;
> diff --git a/strbuf.h b/strbuf.h
> index 0a74acb236..2bc148526f 100644
> --- a/strbuf.h
> +++ b/strbuf.h
> @@ -616,6 +616,7 @@ __attribute__((format (printf,2,3)))
>  extern int fprintf_ln(FILE *fp, const char *fmt, ...);
>  
>  char *xstrdup_tolower(const char *);
> +char *xstrdup_toupper(const char *);
>  
>  /**
>   * Create a newly allocated string using printf format. You can do this easily
> -- 
> 2.15.1
> 

  reply	other threads:[~2017-12-29 15:57 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-29 15:22 [PATCH v2 0/5] convert: add support for different encodings lars.schneider
2017-12-29 15:22 ` [PATCH v2 1/5] strbuf: add xstrdup_toupper() lars.schneider
2017-12-29 15:56   ` Torsten Bögershausen [this message]
2017-12-29 16:55     ` Lars Schneider
2017-12-29 15:22 ` [PATCH v2 2/5] utf8: add function to detect prohibited UTF-16/32 BOM lars.schneider
2017-12-29 15:22 ` [PATCH v2 3/5] utf8: add function to detect a missing " lars.schneider
2017-12-29 15:22 ` [PATCH v2 4/5] convert: add support for 'checkout-encoding' attribute lars.schneider
2017-12-29 17:28   ` Torsten Bögershausen
2017-12-30 19:58     ` Lars Schneider
2017-12-29 15:22 ` [PATCH v2 5/5] convert: add tracing for checkout-encoding lars.schneider
2017-12-31  8:05 ` [PATCH 0/5] V2B: simplify convert.c/h tboegi
2017-12-31  8:05 ` [PATCH 1/5] convert_to_git(): checksafe becomes an integer tboegi
2017-12-31 12:23   ` Lars Schneider
2018-01-01 21:59     ` [PATCH v3 1/1] convert_to_git(): checksafe becomes int conv_flags tboegi
2018-01-02 19:11       ` Lars Schneider
2018-01-03  5:36         ` Torsten Bögershausen
2018-01-03  9:37           ` Lars Schneider
2018-01-05 19:00       ` Lars Schneider
2018-01-05 19:33         ` Torsten Bögershausen
2018-01-05 23:22     ` [PATCH 1/5] convert_to_git(): checksafe becomes an integer Junio C Hamano
2018-01-06  0:55       ` Lars Schneider
2017-12-31  8:05 ` [PATCH 2/5] strbuf: add xstrdup_toupper() tboegi
2017-12-31  8:05 ` [PATCH 3/5] utf8: add function to detect prohibited UTF-16/32 BOM tboegi
2017-12-31  8:05 ` [PATCH 4/5] utf8: add function to detect a missing " tboegi
2017-12-31  8:06 ` [PATCH 5/5] convert: add support for 'checkout-encoding' attribute tboegi
2018-01-05 14:45   ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171229155642.GA23935@tor.lan \
    --to=tboegi@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=lars.schneider@autodesk.com \
    --cc=larsxschneider@gmail.com \
    --cc=peff@peff.net \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.