From e3cff8cb8136b71de61854cd658d22ee25d7e24a Mon Sep 17 00:00:00 2001 From: oga Date: Sun, 18 May 2008 19:38:18 +0000 Subject: group_ctx->name is only used in this one function, and for now it corresponds directly to the static list of group names. Just use the static list and stop strdup()ing a new version for the context struct. Since that never got freed this also fixes a small memleak. Kill some unused variables while i'm here. ok okan@ --- calmwm.h | 3 +-- group.c | 11 +++-------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/calmwm.h b/calmwm.h index 0d90bde..302daa1 100644 --- a/calmwm.h +++ b/calmwm.h @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: calmwm.h,v 1.39 2008/05/17 03:59:54 okan Exp $ + * $Id: calmwm.h,v 1.40 2008/05/18 19:38:18 oga Exp $ */ #ifndef _CALMWM_H_ @@ -171,7 +171,6 @@ static char *shortcut_to_name[] = { struct group_ctx { TAILQ_ENTRY(group_ctx) entry; struct client_ctx_q clients; - char *name; int shortcut; int hidden; int nhidden; diff --git a/group.c b/group.c index ba0bd36..bf4abac 100644 --- a/group.c +++ b/group.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: group.c,v 1.12 2008/05/15 22:18:00 oga Exp $ + * $Id: group.c,v 1.13 2008/05/18 19:38:18 oga Exp $ */ #include "headers.h" @@ -24,10 +24,8 @@ #define CALMWM_NGROUPS 9 -int Groupnamemode = 0; struct group_ctx *Group_active = NULL; struct group_ctx Groups[CALMWM_NGROUPS]; -char Group_name[256]; int Grouphideall = 0; struct group_ctx_q Groupq; @@ -266,16 +264,13 @@ group_menu(XButtonEvent *e) if (TAILQ_EMPTY(&gc->clients)) continue; - if (gc->name == NULL) - gc->name = xstrdup(shortcut_to_name[gc->shortcut]); - XCALLOC(mi, struct menu); if (gc->hidden) snprintf(mi->text, sizeof(mi->text), "%d: [%s]", - gc->shortcut, gc->name); + gc->shortcut, shortcut_to_name[gc->shortcut]); else snprintf(mi->text, sizeof(mi->text), "%d: %s", - gc->shortcut, gc->name); + gc->shortcut, shortcut_to_name[gc->shortcut]); mi->ctx = gc; TAILQ_INSERT_TAIL(&menuq, mi, entry); } -- cgit v1.2.3-2-gb3c3