Simplify unnecessary tests in CDCC

!password || (password && x) can be simplified to !password || x.

There's no need to check if a string is equal to the destination before
copying it there: might as well just copy it.
This commit is contained in:
Kevin Easton
2016-10-14 00:34:26 +11:00
parent eb4b2a29d6
commit 6948d91f6b

View File

@@ -545,7 +545,7 @@ static int do_dcc_sends(char *command, char *from, char *args)
break; break;
if (ptr) if (ptr)
{ {
if (ptr->password && (!password || (password && strcmp(ptr->password, password)))) if (ptr->password && (!password || strcmp(ptr->password, password)))
{ {
put_it("%s: Attempted get of secure pack %d from %s failed. [%s]", cparse(get_string_var(CDCC_PROMPT_VAR)), ptr->num, from, !password? "No Password": "Invalid Password"); put_it("%s: Attempted get of secure pack %d from %s failed. [%s]", cparse(get_string_var(CDCC_PROMPT_VAR)), ptr->num, from, !password? "No Password": "Invalid Password");
queue_send_to_server(from_server, "NOTICE %s :\002CDCC\002: Failed attempt to get secure pack %d", from, ptr->num); queue_send_to_server(from_server, "NOTICE %s :\002CDCC\002: Failed attempt to get secure pack %d", from, ptr->num);
@@ -1494,7 +1494,7 @@ int BX_add_to_queue(char *nick, char *command, pack *sendpack)
queuelist = new; queuelist = new;
numqueue++; numqueue++;
put_it("%s: Queue position %d queuing %d files for %s", cparse(get_string_var(CDCC_PROMPT_VAR)), numqueue, sendpack->numfiles, nick); put_it("%s: Queue position %d queuing %d files for %s", cparse(get_string_var(CDCC_PROMPT_VAR)), numqueue, sendpack->numfiles, nick);
if (!lastnick || (lastnick && my_stricmp(lastnick, nick)))
malloc_strcpy(&lastnick, nick); malloc_strcpy(&lastnick, nick);
return 1; return 1;
} }