mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Cleanup: add some calls to dupstr.
I just happened to spot a couple of cases where I'd apparently open-coded the dupstr() logic before writing dupstr() itself, and never got round to replacing the long-winded version with a call to the standard helper function.
This commit is contained in:
parent
c6ff548ae0
commit
fb130bf6da
@ -4748,8 +4748,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
|
|||||||
static void wintw_set_title(TermWin *tw, const char *title)
|
static void wintw_set_title(TermWin *tw, const char *title)
|
||||||
{
|
{
|
||||||
sfree(window_name);
|
sfree(window_name);
|
||||||
window_name = snewn(1 + strlen(title), char);
|
window_name = dupstr(title);
|
||||||
strcpy(window_name, title);
|
|
||||||
if (conf_get_bool(conf, CONF_win_name_always) || !IsIconic(wgs.term_hwnd))
|
if (conf_get_bool(conf, CONF_win_name_always) || !IsIconic(wgs.term_hwnd))
|
||||||
SetWindowText(wgs.term_hwnd, title);
|
SetWindowText(wgs.term_hwnd, title);
|
||||||
}
|
}
|
||||||
@ -4757,8 +4756,7 @@ static void wintw_set_title(TermWin *tw, const char *title)
|
|||||||
static void wintw_set_icon_title(TermWin *tw, const char *title)
|
static void wintw_set_icon_title(TermWin *tw, const char *title)
|
||||||
{
|
{
|
||||||
sfree(icon_name);
|
sfree(icon_name);
|
||||||
icon_name = snewn(1 + strlen(title), char);
|
icon_name = dupstr(title);
|
||||||
strcpy(icon_name, title);
|
|
||||||
if (!conf_get_bool(conf, CONF_win_name_always) && IsIconic(wgs.term_hwnd))
|
if (!conf_get_bool(conf, CONF_win_name_always) && IsIconic(wgs.term_hwnd))
|
||||||
SetWindowText(wgs.term_hwnd, title);
|
SetWindowText(wgs.term_hwnd, title);
|
||||||
}
|
}
|
||||||
|
@ -550,8 +550,7 @@ SockAddr *sk_namelookup(const char *host, char **canonicalname,
|
|||||||
strncpy(realhost, host, sizeof(realhost));
|
strncpy(realhost, host, sizeof(realhost));
|
||||||
}
|
}
|
||||||
realhost[lenof(realhost)-1] = '\0';
|
realhost[lenof(realhost)-1] = '\0';
|
||||||
*canonicalname = snewn(1+strlen(realhost), char);
|
*canonicalname = dupstr(realhost);
|
||||||
strcpy(*canonicalname, realhost);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user