[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Coding style fixes: space after function names.
From: |
Eric Blake |
Subject: |
Re: [PATCH] Coding style fixes: space after function names. |
Date: |
Wed, 31 Mar 2010 17:22:04 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b1 Thunderbird/3.0.3 |
On 03/31/2010 05:17 PM, James Youngman wrote:
> #include <ctype.h>
>
> -#if !defined (isascii) || defined (STDC_HEADERS)
> +#if !defined(isascii) || defined(STDC_HEADERS)
The gnulib style for this line is:
#if !defined isascii || defined STDC_HEADERS
even fewer characters. The maintainer-makefile module has a rule under
'make syntax-check' that can help enforce that style of no parenthesis
inside #if defined.
> -#define memcpy(dest, source, count) (bcopy((source), (dest), (count)))
> +#define memcpy (dest, source, count) (bcopy ((source), (dest), (count)))
Bug. C99 requires that a function-like macro be declared without a
space (but it can be called with a space). Then, parenthesis inside a
macro expansion are redundant inside a function call (they are required
for most other types of operators, but not as function arguments).
#define memcpy(dest, source, count) (bcopy (source, dest, count))
But why even bother? C89 and gnulib guarantee memcpy - it is an even
better cleanup to delete all this cruft, as it is no longer necessary on
modern porting platforms, and just blindly use memcpy rather than
worrying about the obsolete bcopy.
> #ifdef gettext_noop
> -# define N_(String) gettext_noop (String)
> +# define N_(String) gettext_noop(String)
I don't see anything wrong with the original line.
> - error(1, 0,
> - _("Invalid escape sequence %s in input delimiter specification."),
> - s);
> + error (1, 0,
> + _("Invalid escape sequence %s in input delimiter specification."),
> + s);
Not part of this cleanup (that is, make this commit be just whitespace
changes), but another 'make syntax-check' rule states that you should
use error (EXIT_FAILURE, ...) rather than error (1, ...).
> - exit(1);
> + exit (1);
In the same boat, that same 'make syntax-check' rule recommends exit
(EXIT_FAILURE) over exit (1), but not for this commit.
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature