[Github-comments] [geany/geany] Improve goto-symbols popup (#1445)

Colomban Wendling notifications at xxxxx
Fri Nov 16 20:25:09 UTC 2018


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.

The thing is that even in that case as said it's a problem for this function, as it'll pass on a NULL strv to `g_strv_len()`.

But although `malloc()` returning NULL on 0 length is perfectly normal, it's not my point; the thing is that 0 is a perfectly valid, and not that unlikely value for a meaningful length (see my other examples).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/1445#discussion_r234337331
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20181116/82ce35f1/attachment-0001.html>


More information about the Github-comments mailing list