Parsers downstream will use empty new lines to detect where an entry
ends. Failure to have a newline would cause the entry to be either
discarded or (wrongly) concatenated with the next entry
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2752
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4970>
out:
if (ret) {
gchar *newfile;
+
+ /* Ensure file always ends with an empty newline by adding an empty
+ * line. This helps downstream parsers properly detect entries */
+ g_ptr_array_add (builder, g_strdup ("\n"));
/* Add NULL-terminator to string list */
g_ptr_array_add (builder, NULL);
newfile = g_strjoinv ("\n", (gchar **) builder->pdata);