@b4n commented on this pull request.


>  
                if (main_status.main_window_realized)
-                       dialogs_show_msgbox(GTK_MESSAGE_WARNING, warn_msg, 
display_filename);
+                       dialogs_show_msgbox(GTK_MESSAGE_WARNING, "%s", 
warn_msg);
+
+               ui_set_statusbar(TRUE, "%s", warn_msg);

> which patch?

https://github.com/geany/geany/pull/3665/commits/14d4bb0e05b85024db18349e4b86112940c7eeeb#diff-d5920a54fc6fff9b49052b09ca50c0608cf55cc93b5a46713bf8a4de1132eed0R1891
 but that's irrelevant given I didn't understand what you meant, see below.

> My point was that `ui_set_statusbar` printfs the input then calls 
> `msgwin_status_add` with `%s` to re-printf the result string that it just 
> printfed ((mis)using printf as a verb), so maybe that should use 
> `msgwin_status_add_string()`?

Ooh, OK.  Indeed, `ui_set_statusbar()` should call `msgwin_status_add_string()` 
instead of `msgwin_status_add()`.  I can add (pun intended) it here, although 
it's kind of an unrelated optimization.

> > 12 out of 87 calls pass "%s"
> 
> Not inconsiderable. In this case you need to printf the string before sending 
> it to the status bar because it is used in the dialog, but since status bar 
> is always doing GTK with the result the cost of re-printfing possibly is 
> immaterial.

Well, I can do an "optimize printf usage" pass and introduce 
`ui_set_statusbar_string()`, but as you say I believe it's not gonna matter at 
the performance level (handling format `"%s"` is likely pretty trivial, as 
would be handling formats without placeholders).

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/3665#discussion_r1377227832
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/pull/3665/review/[email protected]>

Reply via email to