aboutsummaryrefslogtreecommitdiffstats
path: root/group.c
diff options
context:
space:
mode:
authorokan2014-01-20 18:58:03 +0000
committerokan2014-01-20 18:58:03 +0000
commit749175e23624a43a35824edada4545a6115dd4d1 (patch)
tree36997c1c39ae9c0e0881ff9083394c29aa3a3e12 /group.c
parent7c3d7c7e009aba5952f235258aecebf4a42fcd3a (diff)
downloadcwm-749175e23624a43a35824edada4545a6115dd4d1.tar.gz
Add a function that adds an entry to a menuq, normalizing a common code
path; from Tiago Cunha.
Diffstat (limited to '')
-rw-r--r--group.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/group.c b/group.c
index f9c6a1d..7f8addd 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.
*
- * $OpenBSD: group.c,v 1.82 2013/12/11 14:09:21 okan Exp $
+ * $OpenBSD: group.c,v 1.83 2014/01/20 18:58:03 okan Exp $
*/
#include <sys/param.h>
@@ -324,15 +324,8 @@ group_menu(struct screen_ctx *sc)
if (TAILQ_EMPTY(&gc->clients))
continue;
- mi = xcalloc(1, sizeof(*mi));
- if (gc->hidden)
- (void)snprintf(mi->text, sizeof(mi->text), "%d: [%s]",
- gc->shortcut, sc->group_names[i]);
- else
- (void)snprintf(mi->text, sizeof(mi->text), "%d: %s",
- gc->shortcut, sc->group_names[i]);
- mi->ctx = gc;
- TAILQ_INSERT_TAIL(&menuq, mi, entry);
+ menuq_add(&menuq, gc, gc->hidden ? "%d: [%s]" : "%d: %s",
+ gc->shortcut, sc->group_names[i]);
}
if (TAILQ_EMPTY(&menuq))