common.h: general clean up

Remove unused functions and definitions. Move some macros into the files
they belong.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2019-05-06 01:24:38 +01:00
parent e330464126
commit 939f2fb602
7 changed files with 24 additions and 167 deletions

View File

@ -932,18 +932,14 @@ static bool register_cm(session_t *ps) {
// Acquire X Selection _NET_WM_CM_S?
if (!ps->o.no_x_selection) {
unsigned len = strlen(REGISTER_PROP) + 2;
int s = ps->scr;
const char register_prop[] = "_NET_WM_CM_S";
xcb_atom_t atom;
while (s >= 10) {
++len;
s /= 10;
char *buf = NULL;
if (asprintf(&buf, "%s%d", register_prop, ps->scr) < 0) {
log_fatal("Failed to allocate memory");
return false;
}
auto buf = ccalloc(len, char);
snprintf(buf, len, REGISTER_PROP "%d", ps->scr);
buf[len - 1] = '\0';
atom = get_atom(ps->atoms, buf);
free(buf);