On Mon, May 2, 2011 at 2:47 PM, Greg Stein <gstein_at_gmail.com> wrote:
> On Mon, May 2, 2011 at 10:52, <hwright_at_apache.org> wrote:
>> Author: hwright
>> Date: Mon May 2 14:52:26 2011
>> New Revision: 1098605
>>
>> URL: http://svn.apache.org/viewvc?rev=1098605&view=rev
>> Log:
>> Followup to r1098594: apr_file_printf() doesn't return an error values, it
>> returns the number of bytes printed, so just ignore its return value (and
>> don't claim it's an error).
>>
>> * subversion/tests/libsvn_subr/translate-test.c
>> (create_file): Ignore return for apr_file_printf().
>>
>> Modified:
>> subversion/trunk/subversion/tests/libsvn_subr/translate-test.c
>>
>> Modified: subversion/trunk/subversion/tests/libsvn_subr/translate-test.c
>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/translate-test.c?rev=1098605&r1=1098604&r2=1098605&view=diff
>> ==============================================================================
>> --- subversion/trunk/subversion/tests/libsvn_subr/translate-test.c (original)
>> +++ subversion/trunk/subversion/tests/libsvn_subr/translate-test.c Mon May 2 14:52:26 2011
>> @@ -237,9 +237,7 @@ create_file(const char *fname, const cha
>> {
>> const char *this_eol_str = eol_str ? eol_str : random_eol_marker();
>>
>> - apr_err = apr_file_printf(f, "%s", lines[i]);
>> - if (apr_err)
>> - return svn_error_create(apr_err, NULL, fname);
>> + apr_file_printf(f, "%s", lines[i]);
>
> If there is an ignored return value, then I like the form:
> (void)apr_file_printf(...)
>
> It makes it very clear that you *intended* to ignore the return value,
> rather than accidentally ignoring it.
In general I agree, but in all my years of C programming, I've very
rarely seen that construct applied to printf() and its relatives.
Since this is part of those family of functions, I think we can safely
leave it as-is.
-Hyrum
Received on 2011-05-02 21:50:57 CEST