This is the mail archive of the
mailing list for the glibc project.
Re: RFC: mblen() return code when n is zero
- From: Rajalakshmi Srinivasaraghavan <raji at linux dot vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org, "egg >> Paul Eggert" <eggert at cs dot ucla dot edu>, Andreas Schwab <schwab at suse dot de>
- Date: Wed, 19 Nov 2014 12:17:44 +0530
- Subject: Re: RFC: mblen() return code when n is zero
- Authentication-results: sourceware.org; auth=none
- References: <5461A2B7 dot 5070402 at linux dot vnet dot ibm dot com> <5461B0B8 dot 4010406 at cs dot ucla dot edu> <5469AF54 dot 3000003 at linux dot vnet dot ibm dot com> <546A20F4 dot 8050404 at cs dot ucla dot edu> <546A2201 dot 3090705 at linux dot vnet dot ibm dot com>
On 11/17/2014 09:57 PM, Rajalakshmi Srinivasaraghavan wrote:
Some of the functions to calculate the length like
strnlen,wcsnlen,wcswidth return zero when input size n is passed as 0.
Considering that, mblen(str, 0) returning 0 seems to be valid. Hence I
am dropping this patch.
On 11/17/2014 09:53 PM, Paul Eggert wrote:
Rajalakshmi Srinivasaraghavan wrote:
To get clarified on previous comments,What should mblen (mblen() calls
__mbrtowc() internally) return for the above testcase?
There was no "above testcase" in your email, but I suppose mblen and
mbtowc should return -1 when given empty inputs, as in this case the
leading bytes of the input buffer do not form a valid multibyte
character. Although POSIX doesn't say what errno value to use,
EILSEQ doesn't seem appropriate here. What errno values do other C
libraries use? I'd be guided by that.
For testcase please refer: