summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/manage.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/manage.c b/src/manage.c
index 5a9a9d8..f54c63a 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -57,25 +57,21 @@ char *
list_unmanaged_windows (void)
{
char *tmp = NULL;
+
if (unmanaged_window_list)
{
- char *tpos;
- int len = 0;
+ struct sbuf *buf;
int i;
- for (i = 0; i < num_unmanaged_windows; i++)
- len += (strlen(unmanaged_window_list[i]) + 1);
-
- tmp = xmalloc(len + 1);
- tpos = tmp;
+ buf = sbuf_new (0);
for (i = 0; i < num_unmanaged_windows; i++)
{
- sprintf(tpos, "%s\n", unmanaged_window_list[i]);
- tpos += strlen(unmanaged_window_list[i])+1;
+ sbuf_concat (buf, unmanaged_window_list[i]);
+ sbuf_concat (buf, "\n");
}
- tpos--;
- *tpos = '\0';
+ sbuf_chop (buf);
+ tmp = sbuf_free_struct (buf);
}
return tmp;
}