This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2][BZ #13152] fmemopen does not honor append mode.
- From: Roland McGrath <roland at hack dot frob dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, libc-alpha at sourceware dot org
- Date: Wed, 29 May 2013 15:40:13 -0700 (PDT)
- Subject: Re: [PATCH v2][BZ #13152] fmemopen does not honor append mode.
- References: <20130509164726 dot GA32347 at domone dot kolej dot mff dot cuni dot cz> <Pine dot LNX dot 4 dot 64 dot 1305091653510 dot 25142 at digraph dot polyomino dot org dot uk> <20130514131101 dot GA3860 at domone dot kolej dot mff dot cuni dot cz> <20130517002937 dot 430692C084 at topped-with-meat dot com> <20130520084328 dot GC32195 at domone dot kolej dot mff dot cuni dot cz> <20130520113124 dot GA4656 at domone dot kolej dot mff dot cuni dot cz>
> New version. I added append flag and refactored fmemopen a bit.
ChangeLog entry missing.
The refactoring makes it a little harder to review. Perhaps first post a
pure refactoring change that doesn't affect the behavior at all. Once
we've reviewed that and it's been committed, it will be much easier to
review the functional change.
> +/* Test for binary mode see bug 13152.
Run-on sentence: add a ; before "see".
And rename the file something like "test-fmemopen-append.c".
> +int
> +do_test (int argc, char **argv)
The norm for a test that doesn't use the arguments is:
static int
do_test (void)
{
...
}
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
> + char expected[20] = "hello, worldX";
Make this:
static const char expected[] = "hello, worldX";
> + FILE *fp = fmemopen(buf, 20, "a+");
Space before paren, here and throughout.
> + for (int i = 0; i < strlen (expected); i++)
Use size_t. Use "sizeof expected - 1".
Thanks,
Roland