Very minor simplification/cleanup of is_channel()

This commit is contained in:
Kevin Easton 2019-07-08 17:34:08 +10:00
parent b9803e69d1
commit e347375cb3
3 changed files with 8 additions and 10 deletions

View File

@ -321,7 +321,7 @@ extern int cpu_saver;
extern struct sockaddr_foobar local_ip_address;
int BX_is_channel (char *);
int BX_is_channel (const char *);
void BX_irc_exit (int, char *, char *, ...);
void BX_beep_em (int);
void got_initial_version (char *);

View File

@ -404,7 +404,7 @@ extern Function_ptr *global;
#define add_completion_type (*(int (*)(char *, int , enum completion ))global[ADD_COMPLETION_TYPE])
/* names.c */
#define is_channel (*(int (*)(char *))global[IS_CHANNEL])
#define is_channel (*(int (*)(const char *))global[IS_CHANNEL])
#define make_channel (*(char *(*)(char *))global[MAKE_CHANNEL])
#define is_chanop (*(int (*)(char *, char *))global[IS_CHANOP])
#define is_halfop (*(int (*)(char *, char *))global[IS_HALFOP])

View File

@ -285,15 +285,13 @@ int annoy_kicks(int list_type, char *to, char *from, char *ptr, NickList *nick)
* begins with MULTI_CHANNEL and has no '*', or STRING_CHANNEL, then its a
* channel
*/
int BX_is_channel(char *to)
int BX_is_channel(const char *to)
{
if (!to || !*to)
return 0;
return ( (to) && ((*to == MULTI_CHANNEL)
|| (*to == STRING_CHANNEL)
|| (*to == ID_CHANNEL)
|| (*to == LOCAL_CHANNEL)));
return to &&
(*to == MULTI_CHANNEL ||
*to == STRING_CHANNEL ||
*to == ID_CHANNEL ||
*to == LOCAL_CHANNEL);
}