}
static void pakfire_package_dump_add_long_line(char** str, const char* key, const char* val) {
- char** lines = pakfire_string_split(val, '\n');
- if (!lines)
+ char* p = NULL;
+
+ // Copy the string onto the heap
+ char* buffer = strdupa(val);
+ if (!buffer)
return;
- pakfire_package_dump_add_lines(str, key, lines);
- pakfire_strings_free(lines);
+ const char* line = strtok_r(buffer, "\n", &p);
+
+ while (line) {
+ pakfire_package_dump_add_line(str, key, line);
+
+ // Reset the key
+ key = NULL;
+
+ // Go to the next line
+ line = strtok_r(NULL, "\n", &p);
+ }
}
static void pakfire_package_dump_add_line_date(char** str, const char* key, time_t date) {