Iterate through null-termianted buffer line by line.
gchar *b, *e, *ln, *n=buf; while(iter_lines(&b, &e, &n, &ln)) { g_free(ln); }