This is the mail archive of the
libc-alpha@sourceware.org
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: Paul Eggert <eggert at cs dot ucla dot edu>, libc-alpha at sourceware dot org, Andreas Schwab <schwab at suse dot de>
- Date: Mon, 17 Nov 2014 13:48:28 +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>
On 11/11/2014 12:16 PM, Paul Eggert wrote:
Rajalakshmi Srinivasaraghavan wrote:
The return code 0 and -1 can both be justified when n=0.
As a user of these functions, I'd far rather that mblen and mbtowc
returned -1 when given empty inputs. Having them return 0 implies
that they've gone past the boundaries of their input buffers, which
really ought to be a no-no.
To get clarified on previous comments,What should mblen (mblen() calls
__mbrtowc() internally) return for the above testcase?
The status variable is set as __GCONV_EMPTY_INPUT when n is zero in
mbrtowc.c after DL_CALL_FCT()
and returns zero.
Based on that I will revise the patches (rc=-1/ rc=-2) sent few days back.
--
Thanks
Rajalakshmi S