Usermode - Cleanups courtesey of scan-build
authorJohn Hodge <[email protected]>
Tue, 7 Feb 2012 08:36:42 +0000 (16:36 +0800)
committerJohn Hodge <[email protected]>
Tue, 7 Feb 2012 08:36:42 +0000 (16:36 +0800)
Usermode/Applications/CLIShell_src/main.c
Usermode/Applications/dhcpclient_src/main.c
Usermode/Applications/irc_src/main.c

index 7f4ba01..7abed27 100644 (file)
@@ -49,7 +49,6 @@ int main(int argc, char *argv[], char **envp)
 {\r
        char    *sCommandStr;\r
        char    *saArgs[32] = {0};\r
-        int    length = 0;\r
         int    i;\r
         int    iArgCount = 0;\r
        tReadline       *readline_state = Readline_Init(1);\r
@@ -80,7 +79,6 @@ int main(int argc, char *argv[], char **envp)
                // Read Command line\r
                sCommandStr = Readline( readline_state );\r
                printf("\n");\r
-               length = strlen(sCommandStr);\r
                \r
                // Parse Command Line into arguments\r
                iArgCount = Parse_Args(sCommandStr, saArgs);\r
index 1bd7f1f..643624a 100644 (file)
@@ -109,6 +109,7 @@ int main(int argc, char *argv[])
        {
                 int    maxfd;
                fd_set  fds;
+               tInterface      *p;
        
                maxfd = 0;
                FD_ZERO(&fds);
@@ -123,8 +124,7 @@ int main(int argc, char *argv[])
                        return -1;
                }
 
-               _SysDebug("select returned");   
-               tInterface      *p;
+               // Check for changes (with magic to allow inline deletion)
                for( p = (void*)&ifaces, i = ifaces; i; p=i,i = i->Next )
                {
                        if( FD_ISSET(i->SocketFD, &fds) )
@@ -158,17 +158,20 @@ void Scan_Dir(tInterface **IfaceList, const char *Directory)
                sprintf(path, "%s/%s", Directory, filename);
                fd = open(path, 0);
 
+               // Check if the device type is 9 (Network)
                if( ioctl(fd, 0, NULL) != 9 )
                        continue ;
 
+               // Check if it's a directory
                finfo(fd, &info, 0);
-
                if( info.flags & FILEFLAG_DIRECTORY )
                {
+                       // If so, recurse
                        Scan_Dir(IfaceList, path);
                }
                else
                {
+                       // Otherwise, add it to the list
                        tInterface      *new = malloc(sizeof(tInterface) + pathlen);
                        new->Adapter = (void*)(new + 1);
                        strcpy(new->Adapter, path);
index cf01d60..2bc0ee2 100644 (file)
@@ -357,8 +357,7 @@ tMessage *Message_Append(tServer *Server, int Type, const char *Source, const ch
        // Determine if it's a channel or PM message\r
        else if( Dest[0] == '#' || Dest[0] == '&' )     // TODO: Better determining here\r
        {\r
-               tWindow *prev = NULL;\r
-               for(win = gpWindows; win; prev = win, win = win->Next)\r
+               for(win = gpWindows; win; win = win->Next)\r
                {\r
                        if( win->Server == Server && strcmp(win->Name, Dest) == 0 )\r
                        {\r
@@ -575,6 +574,7 @@ void ParseServerLine(tServer *Server, char *Line)
                        char    *class, *message;\r
                        \r
                        class = GetValue(Line, &pos);\r
+                       _SysDebug("NOTICE class='%s'", class);\r
                        \r
                        if( Line[pos] == ':' ) {\r
                                message = Line + pos + 1;\r

UCC git Repository :: git.ucc.asn.au