Skip to content

guri: Preallocate a buffer for building URIs

Philip Withnall requested to merge pwithnall/glib:uri-preallocation into main

Rather than reallocating the string buffer a few times as more components are added, use a default buffer size which should hopefully accommodate most average URIs.

The buffer size is a guess and can be tweaked in future.

This has the advantage of no longer passing a potentially-NULL scheme to g_string_new(), which should placate the static analysers, which think that g_string_new() shouldn’t accept NULL.

Signed-off-by: Philip Withnall pwithnall@endlessos.org

Coverity CID: #1474691

Merge request reports