From 41ae1a0f0d86d2fc19f333ee23889c11beb0a4dd Mon Sep 17 00:00:00 2001 From: gramanas Date: Fri, 26 Oct 2018 16:00:29 +0300 Subject: Confort to pedantic std-c99 and update readme --- src/ckerrlog.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'src/ckerrlog.c') diff --git a/src/ckerrlog.c b/src/ckerrlog.c index a023521..cfafb39 100644 --- a/src/ckerrlog.c +++ b/src/ckerrlog.c @@ -31,7 +31,7 @@ char *get_time() { return buf; } -void log_command(int argc, char* argv[]) { +void log_command(int argc,const char* argv[]) { char tmp[STR_L] = ""; for(int i = 0; i < argc; i++) { strcat(tmp, argv[i]); @@ -41,7 +41,8 @@ void log_command(int argc, char* argv[]) { } #define X(stream) \ - void add_ ## stream ## _with_delim(char *delim, char *txt, \ + void add_ ## stream ## _with_delim(const char *delim, \ + const char *txt, \ va_list args) { \ char tmp[STR_L]; \ vsprintf(tmp, txt, args); \ @@ -56,22 +57,22 @@ void log_command(int argc, char* argv[]) { CK_STREAMS #undef X -#define X(stream) \ - void ck## stream(char *txt, ...) { \ - va_list args; \ - va_start(args, txt); \ - add_## stream ##_with_delim("\n", txt, args); \ - va_end(args); \ +#define X(stream) \ + void ck## stream(const char *txt, ...) { \ + va_list args; \ + va_start(args, txt); \ + add_## stream ##_with_delim("\n", txt, args); \ + va_end(args); \ } CK_STREAMS #undef X -#define X(stream) \ - void ck## stream ##_with_delim(char *d, char *txt, ...) { \ - va_list args; \ - va_start(args, txt); \ - add_## stream ##_with_delim(d, txt, args); \ - va_end(args); \ +#define X(stream) \ + void ck## stream ##_with_delim(const char *d, const char *txt, ...) { \ + va_list args; \ + va_start(args, txt); \ + add_## stream ##_with_delim(d, txt, args); \ + va_end(args); \ } CK_STREAMS #undef X @@ -123,7 +124,7 @@ extern void errlog_set_verbose(int level) { } -void initialize_errlog(int argc, char* argv[]) { +void initialize_errlog(int argc, const char** argv) { #define X(stream) stream = NULL; CK_STREAMS #undef X -- cgit v1.2.3