Convert simple uses of alloca/strcpy to LOCAL_COPY.

git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@232 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Tim Cava
2013-02-24 07:32:59 +00:00
parent a7c93a3950
commit d7a0c781f8
13 changed files with 19 additions and 38 deletions

View File

@@ -1198,8 +1198,7 @@ BUILT_IN_COMMAND(kickban)
if (rest && !*rest)
rest = NULL;
}
tspec = alloca(strlen(spec)+1);
strcpy(tspec, spec);
tspec = LOCAL_COPY(spec);
while ((tnick = next_in_comma_list(tspec, &tspec)))
{
int exact = 1;

View File

@@ -1259,8 +1259,7 @@ static void add_files(char *args, char *rest)
struct dirent *dir;
struct stat statbuf;
path = alloca(strlen(rest)+1);
strcpy(path, rest);
path = LOCAL_COPY(rest);
temp = alloca(BIG_BUFFER_SIZE + 1);
*temp = 0;

View File

@@ -1049,8 +1049,7 @@ int server = -1;
char *buffer = NULL;
char *save_buffer = NULL;
int num = 0, count = 0;
m_buff = alloca(strlen(match)+1);
strcpy(m_buff, match);
m_buff = LOCAL_COPY(match);
bitchsay("Killing all matching %s.", pattern);
while ((nick = next_in_comma_list(m_buff, &m_buff)))
{

View File

@@ -230,8 +230,7 @@ static int find_cset_variable(CSetArray *array, char *org_name, int *cnt)
char *name = NULL;
len = strlen(org_name);
name = alloca(len + 1);
strcpy(name, org_name);
name = LOCAL_COPY(org_name);
upper(name);
var_index = 0;
@@ -708,8 +707,7 @@ static int find_wset_variable(WSetArray *array, char *org_name, int *cnt)
char *name = NULL;
len = strlen(org_name);
name = alloca(len + 1);
strcpy(name, org_name);
name = LOCAL_COPY(org_name);
upper(name);
var_index = 0;

View File

@@ -152,8 +152,7 @@ int parse_debug(char *value, int nvalue, char **rv)
if (!value)
return 0;
copy = alloca(strlen(value) + 1);
strcpy(copy, value);
copy = LOCAL_COPY(value);
while ((str1 = new_next_arg(copy, &copy)))
{

View File

@@ -467,8 +467,7 @@ ChannelList *chan = NULL;
if (!nick_isop(Nick) || get_cset_int_var(chan->csets, KICK_OPS_CSET))
{
char *ban, *u, *h;
u = alloca(strlen(Nick->host)+1);
strcpy(u, Nick->host);
u = LOCAL_COPY(Nick->host);
h = strchr(u, '@');
*h++ = 0;
ban = ban_it(Nick->nick, u, h, Nick->ip);

View File

@@ -895,8 +895,7 @@ IrcVariable *fget_var_address(char *var_name)
IrcVariable *var = NULL;
int cnt,
msv_index;
char *tmp_var = alloca(strlen(var_name)+1);
strcpy(tmp_var, var_name);
char *tmp_var = LOCAL_COPY(var_name);
upper(tmp_var);
if ((var = find_ext_fset_var(tmp_var)))
return var;

View File

@@ -798,8 +798,7 @@ BUILT_IN_KEYBINDING(input_add_character)
{
char *ptr = NULL;
ptr = alloca(strlen(&(THIS_CHAR)) + 1);
strcpy(ptr, &(THIS_CHAR));
ptr = LOCAL_COPY(&(THIS_CHAR));
THIS_CHAR = key;
NEXT_CHAR = 0;
ADD_TO_INPUT(ptr);

View File

@@ -723,16 +723,14 @@ void numbered_command(char *from, int comm, char **ArgList)
*/
if ((p = (char *)strchr(ArgList[2], '@'))) {
*p++ = '\0';
ident = (char *)alloca(strlen(ArgList[2])+1);
strcpy(ident, ArgList[2]);
ident = LOCAL_COPY(ArgList[2]);
for(;*p == ' ';)
p++;
host = p;
if ((p = (char *)strchr(p, '\n')))
*p = '\0';
p = host;
host = (char *)alloca(strlen(p)+1);
strcpy(host, p);
host = LOCAL_COPY(p);
}
put_it("%s", convert_output_format(fget_string_var(FORMAT_WHOIS_HEADER_FSET), NULL));

View File

@@ -138,8 +138,7 @@ char *p = NULL;
char *pat;
if (!str || !*str || !get_int_var(AUTO_RESPONSE_VAR))
return 0;
p = alloca(strlen(auto_str)+1);
strcpy(p, auto_str);
p = LOCAL_COPY(auto_str);
if (p && *p)
{
while ((pat = next_arg(p, &p)))
@@ -1090,8 +1089,7 @@ static void p_channel(char *from, char **ArgList)
#ifdef WANT_NSLOOKUP
char *host;
#endif
user = alloca(strlen(FromUserHost)+1);
strcpy(user, FromUserHost);
user = LOCAL_COPY(FromUserHost);
#ifdef WANT_NSLOOKUP
if ((host = strchr(user, '@')))

View File

@@ -196,8 +196,7 @@ char *new_path, *p;
int count = 0;
int doit = 0;
new_path = alloca(strlen(path)+1);
strcpy(new_path, path);
new_path = LOCAL_COPY(path);
if ((p = strrchr(new_path, '/')))
*p = 0;
if (!(dptr = opendir(new_path)))
@@ -247,8 +246,7 @@ struct dirent *dir;
struct stat st;
char *ret = NULL, *p;
int count = 0;
new_path = alloca(strlen(path)+1);
strcpy(new_path, path);
new_path = LOCAL_COPY(path);
if ((p = strrchr(new_path, '/')))
*p = 0;
else
@@ -274,8 +272,7 @@ int count = 0;
if (name)
{
char *pid, *n_tty, *h_name;
pid = alloca(strlen(p)+1);
strcpy(pid, p);
pid = LOCAL_COPY(p);
n_tty = strchr(pid, '.'); *n_tty++ = 0;
h_name = strchr(n_tty, '.'); *h_name++ = 0;
if (strcmp(name, pid))

View File

@@ -83,8 +83,7 @@ long hvalue;
if (!strchr(uptr->channels, '*'))
{
char *channel, *ptr;
channel = alloca(strlen(uptr->channels)+1);
strcpy(channel, uptr->channels);
channel = LOCAL_COPY(uptr->channels);
while ((ptr = next_in_comma_list(channel, &channel)))
{
if (!*ptr)

View File

@@ -1186,8 +1186,7 @@ char *ban;
ban = m_3dup(nicklist->nick, "!", nicklist->host);
if (nicklist->ip && nicklist->host)
{
char *user = alloca(strlen(nicklist->host)+1);
strcpy(user, nicklist->host);
char *user = LOCAL_COPY(nicklist->host);
if ((u = strchr(user, '@')))
*u = 0;
ipban = m_opendup(nicklist->nick, "!", user, "@", nicklist->ip, NULL);
@@ -1448,8 +1447,7 @@ int check_channel_match(char *tmp, char *channel)
return 0;
if (*channel == '*' && (strlen(channel)==1))
return 1;
q = chan = alloca(strlen(tmp)+1);
strcpy(chan, tmp);
q = chan = LOCAL_COPY(tmp);
while ((p = next_in_comma_list(chan, &chan)))
{