From df716ecc8fadc9ffd6b8c9ee33d062b58895a47b Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 3 Oct 2007 21:31:07 +0000 Subject: Rewrite command handling to be more generic. Not finished! --- session.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'session.c') diff --git a/session.c b/session.c index a12f715e..69b528ed 100644 --- a/session.c +++ b/session.c @@ -1,4 +1,4 @@ -/* $Id: session.c,v 1.19 2007-09-29 21:02:26 nicm Exp $ */ +/* $Id: session.c,v 1.20 2007-10-03 21:31:07 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -64,11 +64,10 @@ session_create(const char *name, const char *cmd, u_int sx, u_int sy) if (i == ARRAY_LENGTH(&sessions)) ARRAY_ADD(&sessions, s); - if (*name != '\0') - strlcpy(s->name, name, sizeof s->name); + if (name != NULL) + s->name = xstrdup(name); else - xsnprintf(s->name, sizeof s->name, "%u", i); - + xasprintf(&s->name, "%u", i); if (session_new(s, cmd, sx, sy) != 0) { session_destroy(s); return (NULL); @@ -92,6 +91,7 @@ session_destroy(struct session *s) while (!ARRAY_EMPTY(&s->windows)) window_remove(&s->windows, ARRAY_FIRST(&s->windows)); + xfree(s->name); xfree(s); } -- cgit