This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC] Consodilate file open mode logic
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: libc-alpha at sourceware dot org
- Date: Fri, 24 May 2013 13:25:21 -0400
- Subject: Re: [RFC] Consodilate file open mode logic
- References: <20130524071411 dot GA10208 at domone dot kolej dot mff dot cuni dot cz>
On 05/24/2013 03:14 AM, OndÅej BÃlka wrote:
> As I fixed fopen, fdopen, fmemopen bugs it come as afterthought that one
> of causes is duplicating parsing logic.
>
> A better way could be add function say
>
> int __fmode(char *mode)
>
> which returns bitmask with flags described by mode.
>
> Comments?
I like it, but we need a unit test or some kind of other
test to show __fmode() behaves as required by all the
code paths that use it.
Refactoring is something we haven't realy done in glibc
because without any test-drive approaches it was risky.
Cheers,
Carlos.