Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1437320
| From | Joe Perches <joe@perches.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 0/7] lib: string: add functions to case-convert strings |
| Date | 2016-07-06 00:20 +0200 |
| Message-ID | <rRGRb-ss-3@gated-at.bofh.it> (permalink) |
| References | <rRFs5-7Ol-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, 2016-07-05 at 13:47 -0700, Markus Mayer wrote: > This series introduces a family of generic string case conversion > functions. This kind of functionality is needed in several places in > the kernel. Right now, everybody seems to be implementing their own > copy of this functionality. > > Based on the discussion of the previous version of this series[1] and > the use cases found in the kernel, it does look like having several > flavours of case conversion functions is beneficial. The use cases fall > into three categories: > - copying a string and converting the case while specifying a > maximum length to mimic strncpy() > - copying a string and converting the case without specifying a > length to mimic strcpy() > - converting the case of a string in-place (i.e. modifying the > string that was passed in) > > Consequently, I am proposing these new functions: > char *strncpytoupper(char *dst, const char *src, size_t len); > char *strncpytolower(char *dst, const char *src, size_t len); > char *strcpytoupper(char *dst, const char *src); > char *strcpytolower(char *dst, const char *src); > char *strtoupper(char *s); > char *strtolower(char *s); I think there isn't much value in anything other than strto<upper|lower>. Using str[n]cpy followed by strto<upper|lower> is pretty obvious and rarely used anyway.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 0/7] lib: string: add functions to case-convert strings Markus Mayer <mmayer@broadcom.com> - 2016-07-05 22:50 +0200
Re: [PATCH v2 0/7] lib: string: add functions to case-convert strings Joe Perches <joe@perches.com> - 2016-07-06 00:20 +0200
Re: [PATCH v2 0/7] lib: string: add functions to case-convert strings Markus Mayer <markus.mayer@broadcom.com> - 2016-07-06 00:40 +0200
Re: [PATCH v2 0/7] lib: string: add functions to case-convert strings Joe Perches <joe@perches.com> - 2016-07-06 01:00 +0200
Re: [PATCH v2 0/7] lib: string: add functions to case-convert strings Markus Mayer <markus.mayer@broadcom.com> - 2016-07-06 06:40 +0200
Re: [Nouveau] [PATCH v2 0/7] lib: string: add functions to case-convert strings Alexandre Courbot <gnurou@gmail.com> - 2016-07-07 07:10 +0200
csiph-web