diff options
author | Bert Münnich <ber.t@posteo.de> | 2019-01-23 19:58:47 +0100 |
---|---|---|
committer | Bert Münnich <ber.t@posteo.de> | 2019-01-23 20:00:18 +0100 |
commit | e4fb084f26ea680852522e8b9e7769b5a1eee222 (patch) | |
tree | 5cadee56f573877e06d4c855f029c691b91cc9c5 | |
parent | 4853e17b831c4ce7021fb314eaa4dafded024d90 (diff) |
Fix code style of merged code
-rw-r--r-- | window.c | 24 |
1 files changed, 10 insertions, 14 deletions
@@ -100,23 +100,20 @@ void win_check_wm_support(Display *dpy, Window root) } } -void get_xresource(Display *dpy, const char* rsc, const void* dst) +void win_res(Display *dpy, const char *rsc, const char **dst) { char *type; XrmValue ret; XrmDatabase db; char fullname[256]; - char *resource_manager; + char *res_man; XrmInitialize(); - resource_manager = XResourceManagerString(dpy); - if (resource_manager == NULL) + if ((res_man = XResourceManagerString(dpy)) == NULL) return; - db = XrmGetStringDatabase(resource_manager); - - if (db == NULL) + if ((db = XrmGetStringDatabase(res_man)) == NULL) return; snprintf(fullname, sizeof(fullname), ".%s", rsc); @@ -124,9 +121,8 @@ void get_xresource(Display *dpy, const char* rsc, const void* dst) XrmGetResource(db, fullname, "String", &type, &ret); - if (ret.addr != NULL || !strncmp("String", type, 64)) { - *( (char **) dst ) = ret.addr; - } + if (ret.addr != NULL && STREQ(type, "String")) + *dst = ret.addr; } #define INIT_ATOM_(atom) \ @@ -152,10 +148,10 @@ void win_init(win_t *win) if (setlocale(LC_CTYPE, "") == NULL || XSupportsLocale() == 0) error(0, 0, "No locale support"); - get_xresource(e->dpy, "background", &WIN_BG_COLOR); - get_xresource(e->dpy, "background", &BAR_FG_COLOR); - get_xresource(e->dpy, "foreground", &BAR_BG_COLOR); - get_xresource(e->dpy, "foreground", &SEL_COLOR); + win_res(e->dpy, "background", &WIN_BG_COLOR); + win_res(e->dpy, "background", &BAR_FG_COLOR); + win_res(e->dpy, "foreground", &BAR_BG_COLOR); + win_res(e->dpy, "foreground", &SEL_COLOR); win_init_font(e, BAR_FONT); |