diff options
author | Felix Buehler <account@buehler.rocks> | 2018-07-08 13:59:21 +0200 |
---|---|---|
committer | Felix Buehler <account@buehler.rocks> | 2018-07-13 15:11:43 +0200 |
commit | d099a907f6d8255a0d41e1e3fb476722f3ff2673 (patch) | |
tree | 5cc051a32a8397fa07e5b137fe63c60f98059070 /include | |
parent | a40d7d928f2a24dcb4b9eeae0997f143f4651191 (diff) |
fix clang errors
Diffstat (limited to 'include')
-rw-r--r-- | include/i3status.h | 152 | ||||
-rw-r--r-- | include/queue.h | 5 |
2 files changed, 80 insertions, 77 deletions
diff --git a/include/i3status.h b/include/i3status.h index e259987..3a8a793 100644 --- a/include/i3status.h +++ b/include/i3status.h @@ -81,82 +81,82 @@ extern char *pct_mark; /* Macro which any plugin can use to output the full_text part (when the output * format is JSON) or just output to stdout (any other output format). */ -#define OUTPUT_FULL_TEXT(text) \ - do { \ - /* Terminate the output buffer here in any case, so that it’s \ - * not forgotten in the module */ \ - *outwalk = '\0'; \ - if (output_format == O_I3BAR) { \ - char *_markup = cfg_getstr(cfg_general, "markup"); \ - yajl_gen_string(json_gen, (const unsigned char *) "markup", strlen("markup")); \ - yajl_gen_string(json_gen, (const unsigned char *)_markup, strlen(_markup)); \ - yajl_gen_string(json_gen, (const unsigned char *) "full_text", strlen("full_text")); \ - yajl_gen_string(json_gen, (const unsigned char *)text, strlen(text)); \ - } else { \ - printf("%s", text); \ - } \ +#define OUTPUT_FULL_TEXT(text) \ + do { \ + /* Terminate the output buffer here in any case, so that it’s \ + * not forgotten in the module */ \ + *outwalk = '\0'; \ + if (output_format == O_I3BAR) { \ + char *_markup = cfg_getstr(cfg_general, "markup"); \ + yajl_gen_string(json_gen, (const unsigned char *)"markup", strlen("markup")); \ + yajl_gen_string(json_gen, (const unsigned char *)_markup, strlen(_markup)); \ + yajl_gen_string(json_gen, (const unsigned char *)"full_text", strlen("full_text")); \ + yajl_gen_string(json_gen, (const unsigned char *)text, strlen(text)); \ + } else { \ + printf("%s", text); \ + } \ } while (0) -#define SEC_OPEN_MAP(name) \ - do { \ - if (output_format == O_I3BAR) { \ - yajl_gen_map_open(json_gen); \ - yajl_gen_string(json_gen, (const unsigned char *) "name", strlen("name")); \ - yajl_gen_string(json_gen, (const unsigned char *)name, strlen(name)); \ - } \ +#define SEC_OPEN_MAP(name) \ + do { \ + if (output_format == O_I3BAR) { \ + yajl_gen_map_open(json_gen); \ + yajl_gen_string(json_gen, (const unsigned char *)"name", strlen("name")); \ + yajl_gen_string(json_gen, (const unsigned char *)name, strlen(name)); \ + } \ } while (0) -#define SEC_CLOSE_MAP \ - do { \ - if (output_format == O_I3BAR) { \ - char *_align = cfg_getstr(sec, "align"); \ - if (_align) { \ - yajl_gen_string(json_gen, (const unsigned char *) "align", strlen("align")); \ - yajl_gen_string(json_gen, (const unsigned char *)_align, strlen(_align)); \ - } \ - struct min_width *_width = cfg_getptr(sec, "min_width"); \ - if (_width) { \ - /* if the value can be parsed as a number, we use the numerical value */ \ - if (_width->num > 0) { \ - yajl_gen_string(json_gen, (const unsigned char *) "min_width", strlen("min_width")); \ - yajl_gen_integer(json_gen, _width->num); \ - } else { \ - yajl_gen_string(json_gen, (const unsigned char *) "min_width", strlen("min_width")); \ - yajl_gen_string(json_gen, (const unsigned char *)_width->str, strlen(_width->str)); \ - } \ - } \ - if (cfg_size(sec, "separator") > 0) { \ - yajl_gen_string(json_gen, (const unsigned char *) "separator", strlen("separator")); \ - yajl_gen_bool(json_gen, cfg_getbool(sec, "separator")); \ - } \ - if (cfg_size(sec, "separator_block_width") > 0) { \ - yajl_gen_string(json_gen, (const unsigned char *) "separator_block_width", strlen("separator_block_width")); \ - yajl_gen_integer(json_gen, cfg_getint(sec, "separator_block_width")); \ - } \ - const char *_sep = cfg_getstr(cfg_general, "separator"); \ - if (strlen(_sep) == 0) { \ - yajl_gen_string(json_gen, (const unsigned char *) "separator", strlen("separator")); \ - yajl_gen_bool(json_gen, false); \ - } \ - yajl_gen_map_close(json_gen); \ - } \ +#define SEC_CLOSE_MAP \ + do { \ + if (output_format == O_I3BAR) { \ + char *_align = cfg_getstr(sec, "align"); \ + if (_align) { \ + yajl_gen_string(json_gen, (const unsigned char *)"align", strlen("align")); \ + yajl_gen_string(json_gen, (const unsigned char *)_align, strlen(_align)); \ + } \ + struct min_width *_width = cfg_getptr(sec, "min_width"); \ + if (_width) { \ + /* if the value can be parsed as a number, we use the numerical value */ \ + if (_width->num > 0) { \ + yajl_gen_string(json_gen, (const unsigned char *)"min_width", strlen("min_width")); \ + yajl_gen_integer(json_gen, _width->num); \ + } else { \ + yajl_gen_string(json_gen, (const unsigned char *)"min_width", strlen("min_width")); \ + yajl_gen_string(json_gen, (const unsigned char *)_width->str, strlen(_width->str)); \ + } \ + } \ + if (cfg_size(sec, "separator") > 0) { \ + yajl_gen_string(json_gen, (const unsigned char *)"separator", strlen("separator")); \ + yajl_gen_bool(json_gen, cfg_getbool(sec, "separator")); \ + } \ + if (cfg_size(sec, "separator_block_width") > 0) { \ + yajl_gen_string(json_gen, (const unsigned char *)"separator_block_width", strlen("separator_block_width")); \ + yajl_gen_integer(json_gen, cfg_getint(sec, "separator_block_width")); \ + } \ + const char *_sep = cfg_getstr(cfg_general, "separator"); \ + if (strlen(_sep) == 0) { \ + yajl_gen_string(json_gen, (const unsigned char *)"separator", strlen("separator")); \ + yajl_gen_bool(json_gen, false); \ + } \ + yajl_gen_map_close(json_gen); \ + } \ } while (0) -#define START_COLOR(colorstr) \ - do { \ - if (cfg_getbool(cfg_general, "colors")) { \ - const char *_val = NULL; \ - if (cfg_section) \ - _val = cfg_getstr(cfg_section, colorstr); \ - if (!_val) \ - _val = cfg_getstr(cfg_general, colorstr); \ - if (output_format == O_I3BAR) { \ - yajl_gen_string(json_gen, (const unsigned char *) "color", strlen("color")); \ - yajl_gen_string(json_gen, (const unsigned char *)_val, strlen(_val)); \ - } else { \ - outwalk += sprintf(outwalk, "%s", color(colorstr)); \ - } \ - } \ +#define START_COLOR(colorstr) \ + do { \ + if (cfg_getbool(cfg_general, "colors")) { \ + const char *_val = NULL; \ + if (cfg_section) \ + _val = cfg_getstr(cfg_section, colorstr); \ + if (!_val) \ + _val = cfg_getstr(cfg_general, colorstr); \ + if (output_format == O_I3BAR) { \ + yajl_gen_string(json_gen, (const unsigned char *)"color", strlen("color")); \ + yajl_gen_string(json_gen, (const unsigned char *)_val, strlen(_val)); \ + } else { \ + outwalk += sprintf(outwalk, "%s", color(colorstr)); \ + } \ + } \ } while (0) #define END_COLOR \ @@ -166,12 +166,12 @@ extern char *pct_mark; } \ } while (0) -#define INSTANCE(instance) \ - do { \ - if (output_format == O_I3BAR) { \ - yajl_gen_string(json_gen, (const unsigned char *) "instance", strlen("instance")); \ - yajl_gen_string(json_gen, (const unsigned char *)instance, strlen(instance)); \ - } \ +#define INSTANCE(instance) \ + do { \ + if (output_format == O_I3BAR) { \ + yajl_gen_string(json_gen, (const unsigned char *)"instance", strlen("instance")); \ + yajl_gen_string(json_gen, (const unsigned char *)instance, strlen(instance)); \ + } \ } while (0) /* diff --git a/include/queue.h b/include/queue.h index 3092aad..5b449ab 100644 --- a/include/queue.h +++ b/include/queue.h @@ -433,7 +433,10 @@ } #define CIRCLEQ_HEAD_INITIALIZER(head) \ - { CIRCLEQ_END(&head), CIRCLEQ_END(&head) } + { \ + CIRCLEQ_END(&head) \ + , CIRCLEQ_END(&head) \ + } #define CIRCLEQ_ENTRY(type) \ struct { \ |