From 77859c704eb2a17c24bdea203906ac8c1acc33bd6f083e2880954b47af1df64a Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Sun, 7 Sep 2025 17:52:27 -0400 Subject: [PATCH] Track another URL by smart pointer. --- src/flenser.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/flenser.cc b/src/flenser.cc index 0c03a0f..41ce55e 100644 --- a/src/flenser.cc +++ b/src/flenser.cc @@ -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; } }