diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-05-13 11:34:49 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-05-13 11:37:46 +0200 |
commit | dcf1149af6f8a0c71271a44b9aa1b06a5b4b45c5 (patch) | |
tree | 52d28b110c66c601bc23dda09f1aa6cc53d820de | |
parent | command: refactoring (diff) | |
download | cimple-dcf1149af6f8a0c71271a44b9aa1b06a5b4b45c5.tar.gz cimple-dcf1149af6f8a0c71271a44b9aa1b06a5b4b45c5.zip |
use -std=c17 -Wpedantic
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/client_main.c | 4 | ||||
-rw-r--r-- | src/cmd_line.c | 10 | ||||
-rw-r--r-- | src/cmd_line.h | 4 | ||||
-rw-r--r-- | src/git.c | 4 | ||||
-rw-r--r-- | src/git.h | 4 | ||||
-rw-r--r-- | src/server_main.c | 4 | ||||
-rw-r--r-- | src/signal.c | 4 | ||||
-rw-r--r-- | src/signal.h | 4 | ||||
-rw-r--r-- | src/sqlite.c | 4 | ||||
-rw-r--r-- | src/sqlite.h | 4 | ||||
-rw-r--r-- | src/storage.c | 2 | ||||
-rw-r--r-- | src/worker_main.c | 4 |
13 files changed, 27 insertions, 27 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 545fd82..9758c2e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,7 @@ if(MSVC) add_compile_options(/W4 /WX) else() - add_compile_options(-Wall -Wextra -Werror) + add_compile_options(-std=c17 -Wpedantic -Wall -Wextra -Werror) endif() add_compile_definitions(_GNU_SOURCE) diff --git a/src/client_main.c b/src/client_main.c index c402b20..160bb7e 100644 --- a/src/client_main.c +++ b/src/client_main.c @@ -12,13 +12,13 @@ #include <getopt.h> #include <stdlib.h> -static struct settings default_settings() +static struct settings default_settings(void) { struct settings settings = {DEFAULT_HOST, DEFAULT_PORT}; return settings; } -const char *get_usage_string() +const char *get_usage_string(void) { return "[-h|--help] [-V|--version] [-H|--host HOST] [-p|--port PORT]"; } diff --git a/src/cmd_line.c b/src/cmd_line.c index 8651831..7f437d1 100644 --- a/src/cmd_line.c +++ b/src/cmd_line.c @@ -13,12 +13,12 @@ #include <stdlib.h> #include <string.h> -static char *get_current_binary_path() +static char *get_current_binary_path(void) { return my_readlink("/proc/self/exe"); } -static char *get_current_binary_name() +static char *get_current_binary_name(void) { char *path = get_current_binary_path(); if (!path) @@ -46,7 +46,7 @@ void exit_with_usage(int ec) char *binary = get_current_binary_name(); - fprintf(dest, "usage: %s %s\n", binary ?: "prog", get_usage_string()); + fprintf(dest, "usage: %s %s\n", binary ? binary : "prog", get_usage_string()); free(binary); exit(ec); } @@ -58,11 +58,11 @@ void exit_with_usage_err(const char *msg) exit_with_usage(1); } -void exit_with_version() +void exit_with_version(void) { char *binary = get_current_binary_name(); - printf("%s %s\n", binary ?: "prog", VERSION); + printf("%s %s\n", binary ? binary : "prog", VERSION); free(binary); exit(0); } diff --git a/src/cmd_line.h b/src/cmd_line.h index 58cdb9a..2037c73 100644 --- a/src/cmd_line.h +++ b/src/cmd_line.h @@ -8,10 +8,10 @@ #ifndef __CMD_LINE_H__ #define __CMD_LINE_H__ -const char *get_usage_string(); +const char *get_usage_string(void); void exit_with_usage(int ec); void exit_with_usage_err(const char *msg); -void exit_with_version(); +void exit_with_version(void); #endif @@ -19,7 +19,7 @@ log_err("%s: %s\n", fn, msg); \ } while (0) -int libgit_init() +int libgit_init(void) { int ret = 0; @@ -32,7 +32,7 @@ int libgit_init() return 0; } -void libgit_shutdown() +void libgit_shutdown(void) { git_libgit2_shutdown(); } @@ -10,8 +10,8 @@ #include <git2.h> -int libgit_init(); -void libgit_shutdown(); +int libgit_init(void); +void libgit_shutdown(void); /* These never check out any files (so that we don't have to do 2 checkouts). */ int libgit_clone(git_repository **, const char *url, const char *dir); diff --git a/src/server_main.c b/src/server_main.c index 0e06a67..7a407de 100644 --- a/src/server_main.c +++ b/src/server_main.c @@ -11,13 +11,13 @@ #include <getopt.h> -static struct settings default_settings() +static struct settings default_settings(void) { struct settings settings = {DEFAULT_PORT, DEFAULT_SQLITE_PATH}; return settings; } -const char *get_usage_string() +const char *get_usage_string(void) { return "[-h|--help] [-V|--version] [-p|--port PORT] [-s|--sqlite PATH]"; } diff --git a/src/signal.c b/src/signal.c index d721f67..ecf45ca 100644 --- a/src/signal.c +++ b/src/signal.c @@ -32,7 +32,7 @@ static int my_sigaction(int signo, const struct sigaction *act) return ret; } -int signal_install_global_handler() +int signal_install_global_handler(void) { int ret = 0; @@ -75,7 +75,7 @@ int signal_block_parent(sigset_t *old) return signal_set(&new, old); } -int signal_block_child() +int signal_block_child(void) { sigset_t set; sigemptyset(&set); diff --git a/src/signal.h b/src/signal.h index 3509a92..88c9734 100644 --- a/src/signal.h +++ b/src/signal.h @@ -11,11 +11,11 @@ #include <signal.h> extern volatile sig_atomic_t global_stop_flag; -int signal_install_global_handler(); +int signal_install_global_handler(void); int signal_set(const sigset_t *new, sigset_t *old); int signal_block_parent(sigset_t *old); -int signal_block_child(); +int signal_block_child(void); #endif diff --git a/src/sqlite.c b/src/sqlite.c index 9134528..344e98a 100644 --- a/src/sqlite.c +++ b/src/sqlite.c @@ -28,7 +28,7 @@ sqlite_errno(CONCAT(ret, __LINE__), fn); \ } while (0) -int sqlite_init() +int sqlite_init(void) { int ret = 0; @@ -41,7 +41,7 @@ int sqlite_init() return ret; } -void sqlite_destroy() +void sqlite_destroy(void) { sqlite_errno_if(sqlite3_shutdown(), "sqlite3_shutdown"); } diff --git a/src/sqlite.h b/src/sqlite.h index bb46288..5a6a548 100644 --- a/src/sqlite.h +++ b/src/sqlite.h @@ -10,8 +10,8 @@ #include <sqlite3.h> -int sqlite_init(); -void sqlite_destroy(); +int sqlite_init(void); +void sqlite_destroy(void); int sqlite_open(const char *path, sqlite3 **db, int flags); int sqlite_open_rw(const char *path, sqlite3 **db); diff --git a/src/storage.c b/src/storage.c index a9eced0..c60ddee 100644 --- a/src/storage.c +++ b/src/storage.c @@ -27,7 +27,7 @@ static const struct storage_api apis[] = { }, }; -static size_t numof_apis() +static size_t numof_apis(void) { return sizeof(apis) / sizeof(apis[0]); } diff --git a/src/worker_main.c b/src/worker_main.c index 01f87b6..eaaab4d 100644 --- a/src/worker_main.c +++ b/src/worker_main.c @@ -11,13 +11,13 @@ #include <getopt.h> -static struct settings default_settings() +static struct settings default_settings(void) { struct settings settings = {DEFAULT_HOST, DEFAULT_PORT}; return settings; } -const char *get_usage_string() +const char *get_usage_string(void) { return "[-h|--help] [-V|--version] [-H|--host HOST] [-p|--port PORT]"; } |