From 16d1d814fb686a78565e6be66f02de383fc039bd Mon Sep 17 00:00:00 2001 From: stderr64 Date: Sun, 25 Jan 2026 19:25:36 +0200 Subject: Better initialization of XTextProperty struct --- dwmtimestatus.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'dwmtimestatus.c') diff --git a/dwmtimestatus.c b/dwmtimestatus.c index cd5c879..044e9e7 100644 --- a/dwmtimestatus.c +++ b/dwmtimestatus.c @@ -23,7 +23,12 @@ struct status{ struct sigaction *s_act = NULL; struct status current_status = {0}; -XTextProperty status_props = {0}; +XTextProperty status_props = { + .value = (unsigned char*)¤t_status.status, + .encoding = XA_STRING, + .format = 8, + .nitems = 0 +}; void sighandler( int si_code, siginfo_t *si_info, void *si_adr ){ int exit_status = EXIT_SUCCESS; @@ -103,10 +108,6 @@ int main( int argc, char **args ){ assert( sigaction(SIGTERM, (const struct sigaction*)s_act, NULL) != -1 ); assert( sigaction(SIGPIPE, (const struct sigaction*)s_act, NULL) != -1 ); memset( (void*)¤t_status, 0, sizeof(struct status) ); - memset( (void*)&status_props, 0, sizeof(XTextProperty) ); - status_props.value = (unsigned char*)¤t_status.status; - status_props.encoding = XA_STRING; - status_props.format = 8; const char *optstring = "i:d:f:"; int opt_char = 0; while ( (opt_char = getopt(argc, args, optstring)) != -1 ){ -- cgit v1.2.3-95-g76ab