From 7fd29e4badce7348bb28f4ceb122b0d680d0cde0 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 7 Sep 2007 11:18:27 +0200 Subject: [PATCH] make prop saveprops() dynamicly allocated too --- client.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/client.c b/client.c index 1f5ce9b9..17196854 100644 --- a/client.c +++ b/client.c @@ -500,16 +500,22 @@ void saveprops(Client * c, int ntags) { int i; - char prop[128]; + char *prop; - for(i = 0; i < ntags && i < ssizeof(prop) - 1; i++) + prop = p_new(char, ntags + 2); + + for(i = 0; i < ntags; i++) prop[i] = c->tags[i] ? '1' : '0'; - if(i < ssizeof(prop) - 1) - prop[i++] = c->isfloating ? '1' : '0'; - prop[i] = '\0'; + if(i <= ntags) + prop[i] = c->isfloating ? '1' : '0'; + + prop[++i] = '\0'; + XChangeProperty(c->display, c->win, jdwmprops, XA_STRING, 8, PropModeReplace, (unsigned char *) prop, i); + + p_delete(&prop); } void