nsxive4fb084
Fix code style of merged code
+10 −14
1 file changed
- M window.c +10 −14
| @@ -100,23 +100,20 @@ void win_check_wm_support(Display *dpy, Window root) | |||
| 100 | 100 | } | |
| 101 | 101 | } | |
| 102 | 102 | ||
| 103 | − | void get_xresource(Display *dpy, const char* rsc, const void* dst) | |
| 103 | + | void win_res(Display *dpy, const char *rsc, const char **dst) | |
| 104 | 104 | { | |
| 105 | 105 | char *type; | |
| 106 | 106 | XrmValue ret; | |
| 107 | 107 | XrmDatabase db; | |
| 108 | 108 | char fullname[256]; | |
| 109 | − | char *resource_manager; | |
| 109 | + | char *res_man; | |
| 110 | 110 | ||
| 111 | 111 | XrmInitialize(); | |
| 112 | − | resource_manager = XResourceManagerString(dpy); | |
| 113 | 112 | ||
| 114 | − | if (resource_manager == NULL) | |
| 113 | + | if ((res_man = XResourceManagerString(dpy)) == NULL) | |
| 115 | 114 | return; | |
| 116 | 115 | ||
| 117 | − | db = XrmGetStringDatabase(resource_manager); | |
| 118 | − | ||
| 119 | − | if (db == NULL) | |
| 116 | + | if ((db = XrmGetStringDatabase(res_man)) == NULL) | |
| 120 | 117 | return; | |
| 121 | 118 | ||
| 122 | 119 | snprintf(fullname, sizeof(fullname), ".%s", rsc); | |
| @@ -124,9 +121,8 @@ void get_xresource(Display *dpy, const char* rsc, const void* dst) | |||
| 124 | 121 | ||
| 125 | 122 | XrmGetResource(db, fullname, "String", &type, &ret); | |
| 126 | 123 | ||
| 127 | − | if (ret.addr != NULL || !strncmp("String", type, 64)) { | |
| 128 | − | *( (char **) dst ) = ret.addr; | |
| 129 | − | } | |
| 124 | + | if (ret.addr != NULL && STREQ(type, "String")) | |
| 125 | + | *dst = ret.addr; | |
| 130 | 126 | } | |
| 131 | 127 | ||
| 132 | 128 | #define INIT_ATOM_(atom) \ | |
| @@ -152,10 +148,10 @@ void win_init(win_t *win) | |||
| 152 | 148 | if (setlocale(LC_CTYPE, "") == NULL || XSupportsLocale() == 0) | |
| 153 | 149 | error(0, 0, "No locale support"); | |
| 154 | 150 | ||
| 155 | − | get_xresource(e->dpy, "background", &WIN_BG_COLOR); | |
| 156 | − | get_xresource(e->dpy, "background", &BAR_FG_COLOR); | |
| 157 | − | get_xresource(e->dpy, "foreground", &BAR_BG_COLOR); | |
| 158 | − | get_xresource(e->dpy, "foreground", &SEL_COLOR); | |
| 151 | + | win_res(e->dpy, "background", &WIN_BG_COLOR); | |
| 152 | + | win_res(e->dpy, "background", &BAR_FG_COLOR); | |
| 153 | + | win_res(e->dpy, "foreground", &BAR_BG_COLOR); | |
| 154 | + | win_res(e->dpy, "foreground", &SEL_COLOR); | |
| 159 | 155 | ||
| 160 | 156 | win_init_font(e, BAR_FONT); | |
| 161 | 157 | ||