logic fixes, lf fixes and decl fixups

This commit is contained in:
Mark 2005-12-07 23:07:16 +00:00
parent 97c8baa979
commit 01eebbdd1c
29 changed files with 340 additions and 329 deletions

View file

@ -28,6 +28,6 @@ int InitDns( void );
void do_dns( int notused, short event, void *arg );
void FiniDns( void );
void canx_dns( Module *modptr );
void do_dns_stats_Z( Client * );
void do_dns_stats_Z( const Client *u );
#endif /* _DNS_H_ */

View file

@ -191,7 +191,8 @@ static int cmd_level( const CmdParams *cmdparams )
otheruser = FindUser( cmdparams->av[0] );
/* Force recalc user level */
otheruser->user->ulevel = -1;
if( !otheruser ) {
if( otheruser == NULL )
{
irc_prefmsg( ns_botptr, cmdparams->source, __( "User %s not found", cmdparams->source ), cmdparams->av[0] );
return NS_FAILURE;
}

View file

@ -121,7 +121,7 @@ void AddBan( const char *type, const char *user, const char *host, const char *m
SET_SEGV_LOCATION();
ban = new_ban( mask );
if( !ban )
if( ban == NULL )
return;
strlcpy( ban->type, type, 8 );
strlcpy( ban->user, user, MAXUSER );
@ -167,7 +167,7 @@ void DelBan( const char *mask )
SET_SEGV_LOCATION();
bansnode = hash_lookup( banhash, mask );
if( !bansnode )
if( bansnode == NULL )
{
nlog( LOG_WARNING, "DelBan: unknown ban %s", mask );
return;
@ -260,7 +260,7 @@ void FiniBans( void )
int InitBans( void )
{
banhash = hash_create( HASHCOUNT_T_MAX, 0, 0 );
if( !banhash )
if( banhash == NULL )
{
nlog( LOG_CRITICAL, "Unable to create bans hash" );
return NS_FAILURE;

View file

@ -53,7 +53,8 @@ int set_server_base64( const char *name, const char* base64name )
Client *s;
s = FindServer( name );
if( !s ) {
if( s == NULL )
{
dlog( DEBUG1, "set_server_base64: cannot find %s for %s", name, base64name );
return NS_FAILURE;
}
@ -76,9 +77,10 @@ char *server_to_base64( const char* name )
{
Client *s;
dlog( DEBUG1, "server_to_base64: scanning for %s", name );
dlog( DEBUG7, "server_to_base64: scanning for %s", name );
s = FindServer( name );
if( s ) {
if( s != NULL )
{
return s->name64;
}
dlog( DEBUG1, "server_to_base64: cannot find %s", name );
@ -99,9 +101,10 @@ char *base64_to_server( const char* base64name )
{
Client *s;
dlog( DEBUG1, "base64_to_server: scanning for %s", base64name );
dlog( DEBUG7, "base64_to_server: scanning for %s", base64name );
s = find_server_base64( base64name );
if( s ) {
if( s )
{
return s->name;
}
dlog( DEBUG1, "base64_to_server: cannot find %s", base64name );
@ -124,7 +127,8 @@ int set_nick_base64( const char *nick, const char* base64name )
Client *u;
u = FindUser( nick );
if( !u ) {
if( u == NULL )
{
dlog( DEBUG1, "set_nick_base64: cannot find %s for %s", nick, base64name );
return NS_FAILURE;
}
@ -149,7 +153,8 @@ char *nick_to_base64( const char* nick )
dlog( DEBUG1, "nick_to_base64: scanning for %s", nick );
u = FindUser( nick );
if( u ) {
if( u != NULL )
{
return u->name64;
}
dlog( DEBUG1, "nick_to_base64: cannot find %s", nick );
@ -172,7 +177,8 @@ char *base64_to_nick( const char* base64name )
dlog( DEBUG1, "base64_to_nick: scanning for %s", base64name );
u = find_user_base64( base64name );
if( u ) {
if( u != NULL )
{
return u->name;
}
dlog( DEBUG1, "base64_to_nick: cannot find %s", base64name );
@ -195,11 +201,15 @@ char *base64_to_name( const char* base64name )
dlog( DEBUG1, "base64_to_name: scanning for %s", base64name );
c = find_user_base64( base64name );
if( c )
if( c != NULL )
{
return c->name;
}
c = find_server_base64( base64name );
if( c )
if( c != NULL )
{
return c->name;
}
dlog( DEBUG1, "base64_to_name: cannot find %s", base64name );
return NULL;
}

View file

@ -411,7 +411,7 @@ void do_dns (int notused, short event, void *arg)
dns_check_queue();
}
void do_dns_stats_Z(Client *u)
void do_dns_stats_Z( const Client *u )
{
irc_numeric( RPL_MEMSTATS, u->name, "Active DNS queries: %d", ( int ) list_count( dnslist ) );
irc_numeric( RPL_MEMSTATS, u->name, "Queued DNS Queries: %d", ( int ) list_count( dnsqueue ) );

View file

@ -137,14 +137,14 @@ static int parse( void *notused, void *rline, int len )
char **av = NULL;
SET_SEGV_LOCATION();
if( !( *line ) )
if( *line == '\0' )
return NS_FAILURE;
dlog( DEBUG1, "------------------------BEGIN PARSE-------------------------" );
dlog( DEBUGRX, "%s", line );
if( *line == ':' )
{
coreLine = strpbrk( line, " " );
if( !coreLine )
if( coreLine == NULL )
return NS_FAILURE;
*coreLine = 0;
while( isspace( *++coreLine ) );
@ -157,7 +157,7 @@ static int parse( void *notused, void *rline, int len )
cmdptr = 0;
*origin = 0;
}
if( !*line )
if( *line == '\0' )
return NS_FAILURE;
coreLine = strpbrk( line, " " );
if( coreLine )
@ -203,7 +203,7 @@ static int parsep10( void *notused, void *rline, int len )
char **av = NULL;
SET_SEGV_LOCATION();
if( !( *line ) )
if( *line == '\0' )
return NS_FAILURE;
dlog( DEBUG1, "------------------------BEGIN PARSE-------------------------" );
dlog( DEBUGRX, "%s", line );
@ -272,7 +272,7 @@ static int parsep10( void *notused, void *rline, int len )
static int InitIrcdProtocol( void )
{
protocol_info = ns_dlsym( protocol_module_handle, "protocol_info" );
if( !protocol_info )
if( protocol_info == NULL )
{
nlog( LOG_CRITICAL, "Unable to find protocol_info in protocol module %s", protocol_path );
return NS_FAILURE;
@ -294,7 +294,7 @@ static int InitIrcdProtocol( void )
irc_parse = parse;
}
cmd_list = ns_dlsym( protocol_module_handle, "cmd_list" );
if( !cmd_list )
if( cmd_list == NULL )
{
nlog( LOG_CRITICAL, "Unable to find command list in selected IRCd module" );
return NS_FAILURE;
@ -347,7 +347,7 @@ int InitIrcd( void )
ircsnprintf( protocol_path, 255, "%s/%s%s", MOD_PATH, me.protocol,MOD_STDEXT );
nlog( LOG_NORMAL, "Using protocol module %s", protocol_path );
protocol_module_handle = ns_dlopen( protocol_path, RTLD_NOW || RTLD_GLOBAL );
if( !protocol_module_handle )
if( protocol_module_handle == NULL )
{
nlog( LOG_CRITICAL, "Unable to load protocol module %s", protocol_path );
return NS_FAILURE;

View file

@ -304,7 +304,7 @@ int InitIrcdSymbols( void )
dlog( DEBUG7, "InitIrcdSymbols: apply default handler for: %s %p", pprotocol_sym->sym ? pprotocol_sym->sym : "NONE", pprotocol_sym->defaulthandler );
}
/* If no default or IRCd handler but we require the function, quit with error */
if( pprotocol_sym->required && !*pprotocol_sym->handler )
if( pprotocol_sym->required && ( *pprotocol_sym->handler == NULL ) )
{
nlog( LOG_CRITICAL, "Unable to find %s in selected IRCd module", pprotocol_sym->sym );
return NS_FAILURE;
@ -977,7 +977,7 @@ int irc_join( const Bot *botptr, const char *chan, const char *mode )
Channel *c;
c = FindChannel( chan );
ts = ( !c ) ? me.now : c->creationtime;
ts = ( c == NULL ) ? me.now : c->creationtime;
/* Use sjoin if available */
if( ( ircd_srv.protocol & PROTOCOL_SJOIN ) && irc_send_sjoin )
{
@ -1204,7 +1204,7 @@ int irc_kick( const Bot *botptr, const char *chan, const char *target, const cha
return NS_FAILURE;
}
irc_send_kick( botptr->u->name, chan, target, reason );
PartChannel( FindUser( target ), ( char *) chan, reason[0] != 0 ?( char *)reason : NULL );
PartChannel( FindUser( target ), ( char *) chan, reason[0] != '\0' ?( char *)reason : NULL );
return NS_SUCCESS;
}