b4n commented on this pull request.
- return lcs;
+} + + +/** Transform file names in a list to be shorter. + * + * This function takes a list of file names (probably with absolute paths), and + * transforms the paths such that they are short but still unique. This is intended + * for dialogs which present the file list to the user, where the base name may result + * in duplicates (showing the full path might be inappropriate). + * + * The algorthm strips the common prefix (e-g. the user's home directory) and + * replaces the longest common substring with an ellipsis ("..."). + * + * @param file_names @array{length=num} The list of strings to process. + * @param num The number of strings contained in @a file_names. Can be 0 if it's terminated by @c NULL.
IMO it should not be an error if you allow a non-`NULL`-terminated array, because as you said yourself, allocating a 0-length array will give you a `NULL` pointer -- which is fine as you shouldn't be accessing anything past its 0th element.