aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sdtui.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/sdtui.c b/src/sdtui.c
index a3285fe..54faa7c 100644
--- a/src/sdtui.c
+++ b/src/sdtui.c
@@ -244,11 +244,12 @@ struct application
static void
view_entry_split_add (GPtrArray *out, const gchar *text)
{
- gchar **it, **tmp = g_strsplit (text, "\n", -1);
- for (it = tmp; *it; it++)
- if (**it)
- g_ptr_array_add (out, g_strdup (*it));
- g_strfreev (tmp);
+ const gchar *p = text, *nl;
+ for (; (nl = strchr (p, '\n')); p = nl + 1)
+ if (nl != p)
+ g_ptr_array_add (out, g_strndup (p, nl - p));
+ if (*p)
+ g_ptr_array_add (out, g_strdup (p));
}
/// Decomposes a dictionary entry into the format we want.