> + newfile = g_malloc(sizeof(gchar) * (totalnumchars+1));
> + numlines = 0;
> + nfposn = 0;
> + k = 0;
> +
> + if(newfile && lines) // verify memory allocation
> + {
> + // copy *all* lines into **lines array
> + for(i = 0; i < totalnumlines; i++)
> + lines[numlines++] = sci_get_line(doc->editor->sci, i);
> +
> + qsort(lines, numlines, sizeof(gchar *), compareasc);
> +
> + if(numlines > 0) // copy the first line into *newfile
> + for(j = 0; lines[0][j] != '\0'; j++)
> + newfile[nfposn++] = lines[0][j];
you should probably rather use `memcpy()` (or even `strcpy()`)
---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/324/files#r49270656