[Github-comments] [geany/geany] Fix 1069 (#1445)

Matthew Brush notifications at xxxxx
Thu Mar 23 23:51:11 UTC 2017


codebrainz commented on this pull request.



> + */
+static gchar *utils_strv_find_common_prefix(gchar **strv, size_t num)
+{
+	gchar *prefix, **ptr;
+
+	if (!NZV(strv))
+		return NULL;
+
+	if (num == 0)
+		num = g_strv_length(strv);
+
+	prefix = g_strdup(strv[0]);
+
+	for (gint i = 0; prefix[i]; i++)
+	{
+		foreach_strv(ptr, &strv[1])

Guessing it's accidental since it's indented wrong and missing braces, and `strv` can be less than two elements long and not necessarily nul-terminated.

A bit off-topic but what does this weird macro do compared to the normal C code `for (GStrv ptr = strv+1; *ptr; ptr++)`?

-- 
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_r107810545
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20170323/ddc314a6/attachment.html>


More information about the Github-comments mailing list