Use (void) instead of () for functions without args (Thanks fernandotcl)

See also:
http://article.gmane.org/gmane.linux.kernel/1268792

The C compiler will handle (void) as "no arguments" and () as "variadic
function" (equivalent to (...)) which might lead to subtle errors.
This commit is contained in:
Michael Stapelberg 2012-05-07 08:27:28 +02:00
parent 6b447f7f1b
commit 4ddd115af8
4 changed files with 5 additions and 5 deletions

View File

@ -121,7 +121,7 @@ static char *resolve_tilde(const char *path) {
return result; return result;
} }
static char *get_config_path() { static char *get_config_path(void) {
char *xdg_config_home, *xdg_config_dirs, *config_path; char *xdg_config_home, *xdg_config_dirs, *config_path;
/* 1: check the traditional path under the home directory */ /* 1: check the traditional path under the home directory */

View File

@ -29,7 +29,7 @@
* We then check whether the pipe targets name is known and chose the format. * We then check whether the pipe targets name is known and chose the format.
* *
*/ */
char *auto_detect_format() { char *auto_detect_format(void) {
pid_t myppid = getppid(); pid_t myppid = getppid();
pid_t mypid = getpid(); pid_t mypid = getpid();

View File

@ -32,13 +32,13 @@ char *color(const char *colorstr) {
* Some color formats (xmobar) require to terminate colors again * Some color formats (xmobar) require to terminate colors again
* *
*/ */
char *endcolor() { char *endcolor(void) {
if (output_format == O_XMOBAR) if (output_format == O_XMOBAR)
return "</fc>"; return "</fc>";
else return ""; else return "";
} }
void print_seperator() { void print_seperator(void) {
if (output_format == O_DZEN2) if (output_format == O_DZEN2)
printf("^fg(%s)^p(5;-2)^ro(2)^p()^fg()^p(5)", cfg_getstr(cfg_general, "color_separator")); printf("^fg(%s)^p(5;-2)^ro(2)^p()^fg()^p(5)", cfg_getstr(cfg_general, "color_separator"));
else if (output_format == O_XMOBAR) else if (output_format == O_XMOBAR)

View File

@ -64,7 +64,7 @@ static char *get_sockname(struct addrinfo *addr) {
* Returns the IPv6 address with which you have connectivity at the moment. * Returns the IPv6 address with which you have connectivity at the moment.
* The char * is statically allocated and mustn't be freed * The char * is statically allocated and mustn't be freed
*/ */
static char *get_ipv6_addr() { static char *get_ipv6_addr(void) {
struct addrinfo hints; struct addrinfo hints;
struct addrinfo *result, *resp; struct addrinfo *result, *resp;
static struct addrinfo *cached = NULL; static struct addrinfo *cached = NULL;