Rename destroctor

This commit is contained in:
Alex Kotov 2021-11-21 11:11:11 +05:00
parent b6e198af18
commit 80eb0b3cce
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 12 additions and 3 deletions

View File

@ -28,7 +28,10 @@ Atoms atoms_create(Display *const dpy)
return atoms;
}
void atoms_destroy(Atoms atoms)
void atoms_delete(Atoms atoms)
{
// TODO: maybe we should assert
if (atoms == NULL) return;
free(atoms);
}

View File

@ -1,8 +1,14 @@
#ifndef _ATOMS_H
#define _ATOMS_H
#include <stddef.h>
#include <X11/Xutil.h>
#define ATOMS_DELETE(atoms) { \
atoms_delete(atoms); \
atoms = NULL; \
}
/* EWMH atoms */
enum {
NetSupported, NetWMName, NetWMState, NetWMCheck,
@ -18,6 +24,6 @@ typedef struct Atoms {
} *Atoms;
Atoms atoms_create(Display *dpy);
void atoms_destroy(Atoms atoms);
void atoms_delete(Atoms atoms);
#endif // _ATOMS_H

View File

@ -545,7 +545,7 @@ void cleanup()
free(scheme[i]);
}
atoms_destroy(atoms);
ATOMS_DELETE(atoms);
XDestroyWindow(dpy, wmcheckwin);
drw_free(drw);
XSync(dpy, False);