diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-08-21 10:56:56 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-08-21 10:56:56 -0400 |
commit | 034358dbfd07e013417bafcbcc819ddad90a2f21 (patch) | |
tree | f31d5042629c27a6fbba0cb73f2b93433dce247a /sway/log.c | |
parent | Minor style fix (diff) | |
parent | fixed #108 signed/unsigned comparison (diff) | |
download | sway-034358dbfd07e013417bafcbcc819ddad90a2f21.tar.gz sway-034358dbfd07e013417bafcbcc819ddad90a2f21.tar.zst sway-034358dbfd07e013417bafcbcc819ddad90a2f21.zip |
Merge pull request #110 from minus7/sign-comparsion-fix
fixed #108 signed/unsigned comparison
Diffstat (limited to 'sway/log.c')
-rw-r--r-- | sway/log.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -10,7 +10,7 @@ | |||
10 | #include <string.h> | 10 | #include <string.h> |
11 | 11 | ||
12 | int colored = 1; | 12 | int colored = 1; |
13 | int v = 0; | 13 | log_importance_t v = L_SILENT; |
14 | 14 | ||
15 | static const char *verbosity_colors[] = { | 15 | static const char *verbosity_colors[] = { |
16 | "", // L_SILENT | 16 | "", // L_SILENT |
@@ -19,7 +19,7 @@ static const char *verbosity_colors[] = { | |||
19 | "\x1B[1;30m", // L_DEBUG | 19 | "\x1B[1;30m", // L_DEBUG |
20 | }; | 20 | }; |
21 | 21 | ||
22 | void init_log(int verbosity) { | 22 | void init_log(log_importance_t verbosity) { |
23 | v = verbosity; | 23 | v = verbosity; |
24 | /* set FD_CLOEXEC flag to prevent programs called with exec to write into logs */ | 24 | /* set FD_CLOEXEC flag to prevent programs called with exec to write into logs */ |
25 | int i; | 25 | int i; |
@@ -46,9 +46,9 @@ void sway_abort(const char *format, ...) { | |||
46 | sway_terminate(); | 46 | sway_terminate(); |
47 | } | 47 | } |
48 | 48 | ||
49 | void sway_log(int verbosity, const char* format, ...) { | 49 | void sway_log(log_importance_t verbosity, const char* format, ...) { |
50 | if (verbosity <= v) { | 50 | if (verbosity <= v) { |
51 | int c = verbosity; | 51 | unsigned int c = verbosity; |
52 | if (c > sizeof(verbosity_colors) / sizeof(char *)) { | 52 | if (c > sizeof(verbosity_colors) / sizeof(char *)) { |
53 | c = sizeof(verbosity_colors) / sizeof(char *) - 1; | 53 | c = sizeof(verbosity_colors) / sizeof(char *) - 1; |
54 | } | 54 | } |
@@ -69,9 +69,9 @@ void sway_log(int verbosity, const char* format, ...) { | |||
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | void sway_log_errno(int verbosity, char* format, ...) { | 72 | void sway_log_errno(log_importance_t verbosity, char* format, ...) { |
73 | if (verbosity <= v) { | 73 | if (verbosity <= v) { |
74 | int c = verbosity; | 74 | unsigned int c = verbosity; |
75 | if (c > sizeof(verbosity_colors) / sizeof(char *)) { | 75 | if (c > sizeof(verbosity_colors) / sizeof(char *)) { |
76 | c = sizeof(verbosity_colors) / sizeof(char *) - 1; | 76 | c = sizeof(verbosity_colors) / sizeof(char *) - 1; |
77 | } | 77 | } |