Track another URL by smart pointer.

This commit is contained in:
2025-09-07 17:52:27 -04:00
parent dea296a063
commit 77859c704e

View File

@ -368,7 +368,7 @@ static void setColors()
/**
* Given a command line argument, build a DilloUrl for it.
*/
static DilloUrl *makeStartUrl(char *str, bool local)
static std::unique_ptr< DilloUrl > makeStartUrl(char *str, bool local)
{
using namespace std::literals::string_literals;
std::string url_str;
@ -392,7 +392,7 @@ static DilloUrl *makeStartUrl(char *str, bool local)
if (local)
a_Url_set_flags(start_url.get(), URL_FLAGS(start_url) | URL_SpamSafe);
return start_url.release();
return start_url;
}
/*
@ -578,21 +578,20 @@ int main(int argc, char **argv)
}
} else {
for (int i = idx; i < argc; i++) {
DilloUrl *start_url = makeStartUrl(argv[i], local);
auto start_url = makeStartUrl(argv[i], local);
if (i > idx) {
if (prefs.middle_click_opens_new_tab) {
/* user must prefer tabs */
const int focus = 1;
a_UIcmd_open_url_nt(bw, start_url, focus);
a_UIcmd_open_url_nt(bw, start_url.get(), focus);
} else {
a_UIcmd_open_url_nw(bw, start_url);
a_UIcmd_open_url_nw(bw, start_url.get());
}
} else {
a_UIcmd_open_url(bw, start_url);
a_UIcmd_set_location_text(bw, URL_STR(start_url));
a_UIcmd_open_url(bw, start_url.get());
a_UIcmd_set_location_text(bw, URL_STR(start_url.get()));
}
delete start_url;
}
}