end can be local to the strtok loop

This commit is contained in:
Daniel Micay 2012-09-28 13:58:12 -04:00
parent 4bd4bff004
commit a12645212c
1 changed files with 1 additions and 2 deletions

View File

@ -133,8 +133,6 @@ static void find_urls(VteTerminal *vte, search_panel_info *panel_info) {
}
static void launch_url(const char *text, search_panel_info *info) {
char *end;
std::unique_ptr<char, decltype(&free)> copy(strdup(text), free);
for (char *s_ptr = copy.get(), *saveptr; ; s_ptr = nullptr) {
const char *token = strtok_r(s_ptr, ",", &saveptr);
@ -142,6 +140,7 @@ static void launch_url(const char *text, search_panel_info *info) {
break;
}
char *end;
errno = 0;
unsigned long id = strtoul(token, &end, 10);
if (!errno && end != text && id && id <= info->url_list.size()) {