@kugel- commented on this pull request.


In src/tagmanager/tm_workspace.c:

>  
-			if (*header == NULL && g_strcmp0(hdr_comps[0], src_comps[0]) == 0)
-				*header = hdr;
-			g_hash_table_add(includes, hdr);
-			g_strfreev(hdr_comps);
+			for (j = 0; j < tm_files->len; j++)
+			{
+				TMSourceFile *hdr = tm_files->pdata[j];
+				gchar **hdr_comps = g_strsplit(hdr->short_name, ".", 2);
+
+				if (g_strcmp0(hdr_comps[0], src_comps[0]) == 0)

I mean you can return the GPtrArray right after g_hash_table_lookup(theWorkspace->source_file_map, hdr_name), before the inner loop. The GPtrArray has all headers with the same basename already and the inner loop only compares the basename once more.

The inner loop still adds to the includes hash table but it doesn't need to deal with the header candidates.

Ah, g_ptr_array_find() was introduced in glib 2.54 which we don't have
All files in the GPtrArray have the same base name, so you just need to compare the basename against ->pdata[0]

FWIW, we will probably bump GTK dependency to 3.24 soon and then we also get glib 2.54+ (which is a bit older isn't it?).


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <geany/geany/pull/3269/review/1110528575@github.com>