repo: ngircd
action: commit
revision: 
path_from: 
revision_from: 27c96632f1771c061d225b88c34344bb2cf1a743:
path_to: 
revision_to: 
git.thebackupbox.net
ngircd
git clone git://git.thebackupbox.net/ngircd
commit 27c96632f1771c061d225b88c34344bb2cf1a743
Author: Florian Westphal 
Date:   Fri Oct 6 19:57:56 2006 +0000

    Client_IsValidNick: no need to strcpy.

diff --git a/src/ngircd/client.c b/src/ngircd/client.c
index 01ef091668ba9ae73f3fdd1d05ae05c27bf59fd9..
index ..ec3c6ce7c44d78e1c0b9c0b8336ef91915db5acc 100644
--- a/src/ngircd/client.c
+++ b/src/ngircd/client.c
@@ -17,7 +17,7 @@

 #include "portab.h"

-static char UNUSED id[] = "$Id: client.c,v 1.91 2006/04/23 10:37:27 fw Exp $";
+static char UNUSED id[] = "$Id: client.c,v 1.92 2006/10/06 19:57:56 fw Exp $";

 #include "imp.h"
 #include 
@@ -979,16 +979,13 @@ Client_MyMaxUserCount( void )


 GLOBAL bool
-Client_IsValidNick( char *Nick )
+Client_IsValidNick( const char *Nick )
 {
-	/* Ist der Nick gueltig? */
+	const char *ptr;
+	static const char goodchars[] = ";0123456789-";

-	char *ptr, goodchars[20];
-	
 	assert( Nick != NULL );

-	strcpy( goodchars, ";0123456789-" );
-
 	if( Nick[0] == '#' ) return false;
 	if( strchr( goodchars, Nick[0] )) return false;
 	if( strlen( Nick ) >= CLIENT_NICK_LEN ) return false;
@@ -996,11 +993,11 @@ Client_IsValidNick( char *Nick )
 	ptr = Nick;
 	while( *ptr )
 	{
-		if(( *ptr < 'A' ) && ( ! strchr( goodchars, *ptr ))) return false;
-		if(( *ptr > '}' ) && ( ! strchr( goodchars, *ptr ))) return false;
+		if (( *ptr < 'A' ) && ( ! strchr( goodchars, *ptr ))) return false;
+		if ( *ptr > '}' ) return false;
 		ptr++;
 	}
-	
+
 	return true;
 } /* Client_IsValidNick */

diff --git a/src/ngircd/client.h b/src/ngircd/client.h
index a7f81664f8a0632a80b2b6a01123670b0dbb3dd2..
index ..b48f804f3b32a3089864d4245ab90ff45e6bb735 100644
--- a/src/ngircd/client.h
+++ b/src/ngircd/client.h
@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: client.h,v 1.43 2006/10/01 19:05:02 alex Exp $
+ * $Id: client.h,v 1.44 2006/10/06 19:57:56 fw Exp $
  *
  * Client management (header)
  */
@@ -145,7 +145,7 @@ GLOBAL long Client_MyServerCount PARAMS(( void ));
 GLOBAL long Client_MaxUserCount PARAMS((  void ));
 GLOBAL long Client_MyMaxUserCount PARAMS((  void ));

-GLOBAL bool Client_IsValidNick PARAMS(( char *Nick ));
+GLOBAL bool Client_IsValidNick PARAMS(( const char *Nick ));

 GLOBAL WHOWAS *Client_GetWhowas PARAMS(( void ));
 GLOBAL int Client_GetLastWhowasIndex PARAMS(( void ));

-----END OF PAGE-----