[mw-devel] MW3 r1134 - trunk/src

welshbyte at sucs.org welshbyte at sucs.org
Sat Dec 12 14:55:18 GMT 2009


Author: welshbyte
Date: 2009-12-12 14:55:18 +0000 (Sat, 12 Dec 2009)
New Revision: 1134

Modified:
   trunk/src/Parse.c
   trunk/src/alias.c
   trunk/src/files.c
   trunk/src/js.c
   trunk/src/main.c
   trunk/src/read.c
   trunk/src/script.c
Log:
Clean up some clang --analyze warnings and remove some redundant code, refs #50


Modified: trunk/src/Parse.c
===================================================================
--- trunk/src/Parse.c	2009-12-12 14:49:51 UTC (rev 1133)
+++ trunk/src/Parse.c	2009-12-12 14:55:18 UTC (rev 1134)
@@ -141,7 +141,6 @@
 		return 0;
 	}
 
-	inlen=strlen(argv[0]);
 	dowhat=argv[0];
 
 	/* check for aliases */

Modified: trunk/src/alias.c
===================================================================
--- trunk/src/alias.c	2009-12-12 14:49:51 UTC (rev 1133)
+++ trunk/src/alias.c	2009-12-12 14:55:18 UTC (rev 1134)
@@ -75,15 +75,12 @@
 /* adds the 'from/to' node to the given list, or redefines if in existance */
 int AddLink(Alias *list, char *from, char *to)
 {
-	Alias new, prev;
+	Alias new;
 	int redefine = 0;
 
 	new=*list;
 	while (new!=NULL && strcasecmp(new->from, from))
-	{
-	 	prev = new;
 	 	new=new->next;
-	}
 
 	if (new!=NULL)
 	{

Modified: trunk/src/files.c
===================================================================
--- trunk/src/files.c	2009-12-12 14:49:51 UTC (rev 1133)
+++ trunk/src/files.c	2009-12-12 14:55:18 UTC (rev 1134)
@@ -208,13 +208,12 @@
 int get_folder_number(struct folder *fol, int num)
 {
 	int file;
-	int no;
-	
+
 	if (nofolders())
 		{printf("There are no folders !\n");return 0;}
 	if ((file=openfolderfile(O_RDONLY)) < 0) return 0;
 	lseek(file,sizeof(*fol)*num,0);
-	if ((no=read(file,fol,sizeof(*fol)))<0)
+	if (read(file,fol,sizeof(*fol))<0)
 	{
 		perror("get_folder_number");
 		return 0;

Modified: trunk/src/js.c
===================================================================
--- trunk/src/js.c	2009-12-12 14:49:51 UTC (rev 1133)
+++ trunk/src/js.c	2009-12-12 14:55:18 UTC (rev 1134)
@@ -1227,15 +1227,8 @@
 // starts the javascript engine.
 int setup_js(void)
 {
-	JSBool builtins;
-	struct passwd *pw;
 	int is_local=1;
 
-	if ((pw=getpwuid(getuid()))==NULL) {
-		fprintf(stderr, "Error getting user information\n");
-		return -1;
-	}
-
 	if (getmylogin()==NULL) {
 		is_local=0;
 	}
@@ -1258,7 +1251,7 @@
 	jsroot = JS_NewObject(jscx, &globclass, NULL, NULL);
 
 	/* initiate builtin classes */
-	builtins = JS_InitStandardClasses(jscx, jsroot);
+	JS_InitStandardClasses(jscx, jsroot);
 	
 	/* create a callback function that is run when javascript branches backwards */
 	/* allows us to interupt looping scripts */

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2009-12-12 14:49:51 UTC (rev 1133)
+++ trunk/src/main.c	2009-12-12 14:55:18 UTC (rev 1134)
@@ -810,7 +810,6 @@
 
 void accept_command(char *comm)
 {
-	int c;
 	char history_comm[MAXTEXTLENGTH];
 	int conversion_result;
 	
@@ -828,13 +827,13 @@
 		if (comm[0]==CMD_BOARD_CHAR)
 		{
 			set_rights();
-			c=DoCommand(&comm[1], table);
+			DoCommand(&comm[1], table);
 			set_talk_rights();
 		}else
 		if (comm[0]==CMD_TALK_CHAR)
 		{
 			set_talk_rights();
-			c=DoCommand(&comm[1], chattable);
+			DoCommand(&comm[1], chattable);
 		}else
 		if (comm[0]==CMD_SCRIPT_CHAR && cp_flags(user->chatprivs,CP_SCRIPT,CM_MODE_ANY))
 		{
@@ -859,9 +858,9 @@
 	{
 		set_rights();
 		if (comm[0]==CMD_BOARD_CHAR)
-			c=DoCommand(&comm[1], table);
+			DoCommand(&comm[1], table);
 		else
-			c=DoCommand(comm, table);
+			DoCommand(comm, table);
 	}
 }
 
@@ -1500,7 +1499,6 @@
 {
 	char **matches;
 	int wc;
-	int rl_attempted_completion_over;
 	char *line;
 	int mode=0;
 	int oldrights;

Modified: trunk/src/read.c
===================================================================
--- trunk/src/read.c	2009-12-12 14:49:51 UTC (rev 1133)
+++ trunk/src/read.c	2009-12-12 14:55:18 UTC (rev 1134)
@@ -101,7 +101,7 @@
 		{printf("There are no folders to read.\n");return(FALSE);}
 
 	file=openfolderfile(O_RDONLY);
-
+	memset(&data, 0, sizeof(struct folder));
 	for (i=0;i<=folnum;i++) get_folder_entry(file,&data);
 
 	close(file);
@@ -295,9 +295,6 @@
 	/* cant open file */
 	if ((headfile=err_open(x,O_RDONLY,0))<0) return(FALSE);
 
-	/* locate file position */
-	posn = (msgnum - (data->first)) * sizeof(struct Header);
-
 	/* no message - file too small */
 	tmppos = lseek(headfile, 0, 2);
 

Modified: trunk/src/script.c
===================================================================
--- trunk/src/script.c	2009-12-12 14:49:51 UTC (rev 1133)
+++ trunk/src/script.c	2009-12-12 14:55:18 UTC (rev 1134)
@@ -364,7 +364,6 @@
 		newcode->parent=new;
 		newcode->next=NULL;
 		codeend->next=newcode;
-		codeend=newcode;
 
 		label=new->jump;
 		while (label!=NULL) {




More information about the mw-devel mailing list