Removed the temp variable declarations in the latest check in. I'm sure there's 
a better way to do the repetitive parseInts.

Looks like this now:
    
    
    proc net_io_counters*(): TableRef[string, NetIO] =
        ## Return network I/O statistics for every network interface
        ## installed on the system as a dict of raw tuples.
        result = newTable[string, NetIO]()
        for line in lines( PROCFS_PATH / "net/dev" ):
            if not( ":" in line ): continue
            let colon = line.rfind(':')
            let name = line[..colon].strip()
            let fields = line[(colon + 1)..len(line)].splitWhitespace()
            
            result[name] = NetIO( bytes_sent: parseInt( fields[8] ),
                                  bytes_recv: parseInt( fields[0] ),
                                  packets_sent: parseInt( fields[9] ),
                                  packets_recv: parseInt( fields[1] ),
                                  errin: parseInt( fields[2] ),
                                  errout: parseInt( fields[10] ),
                                  dropin: parseInt( fields[3] ),
                                  dropout: parseInt( fields[11] ) )
    
    

Reply via email to