[Github-comments] [geany/geany] Remember search history (#1666) (#1745)

Colomban Wendling notifications at xxxxx
Wed Jan 24 19:56:57 UTC 2018


b4n commented on this pull request.



> +	if (count == 0)
+	{
+		*recent_terms = NULL;
+		return;
+	}
+
+	*recent_terms = g_new0(gchar*, count + 1);
+
+	if (gtk_tree_model_get_iter_first(model, &iter))
+	{
+		do
+		{
+			gtk_tree_model_get(model, &iter, 0, &combo_text, -1);
+			if (*combo_text != 0)
+			{
+				(*recent_terms)[i] = g_strdup(combo_text);

you could avoid having to duplicate the `combo_text` if you freed it conditionally:

```C
if (NZV(combo_text))
{
	(*recent_terms)[i] = combo_text;
}
else
{
	g_free(combo_text);
}
```

-- 
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/1745#pullrequestreview-91310148
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20180124/60b21738/attachment.html>


More information about the Github-comments mailing list