wmppp.app: Reduce scope of several variables.
Fixes several "(style) The scope of the variable 'p' can be reduced" found by cppcheck.
This commit is contained in:
		
							parent
							
								
									6b8351219c
								
							
						
					
					
						commit
						8d3011886d
					
				
					 1 changed files with 10 additions and 6 deletions
				
			
		| 
						 | 
					@ -375,13 +375,12 @@ void wmppp_routine(int argc, char **argv) {
 | 
				
			||||||
		{ NULL, NULL }
 | 
							{ NULL, NULL }
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int				i,j;
 | 
						int			j;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int				but_stat;
 | 
						int				but_stat;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	long			starttime;
 | 
						long			starttime;
 | 
				
			||||||
	long			currenttime;
 | 
						long			currenttime;
 | 
				
			||||||
	long			lasttime;
 | 
					 | 
				
			||||||
	long			waittime;
 | 
						long			waittime;
 | 
				
			||||||
	long			ppptime;
 | 
						long			ppptime;
 | 
				
			||||||
	int				hour,minute;
 | 
						int				hour,minute;
 | 
				
			||||||
| 
						 | 
					@ -450,6 +449,9 @@ void wmppp_routine(int argc, char **argv) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* wmppp main loop */
 | 
					/* wmppp main loop */
 | 
				
			||||||
	while (1) {
 | 
						while (1) {
 | 
				
			||||||
 | 
							int i;
 | 
				
			||||||
 | 
							long lasttime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		lasttime = currenttime;
 | 
							lasttime = currenttime;
 | 
				
			||||||
		currenttime = time(0);
 | 
							currenttime = time(0);
 | 
				
			||||||
		/* Check if any child has left the playground */
 | 
							/* Check if any child has left the playground */
 | 
				
			||||||
| 
						 | 
					@ -688,12 +690,12 @@ int get_statistics(char *devname, long *ip, long *op, long *is, long *os) {
 | 
				
			||||||
int stillonline(char *ifs) {
 | 
					int stillonline(char *ifs) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	FILE	*fp;
 | 
						FILE	*fp;
 | 
				
			||||||
	char	temp[128];
 | 
					 | 
				
			||||||
	int		i;
 | 
						int		i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	i = 0;
 | 
						i = 0;
 | 
				
			||||||
	fp = fopen("/proc/net/route", "r");
 | 
						fp = fopen("/proc/net/route", "r");
 | 
				
			||||||
	if (fp) {
 | 
						if (fp) {
 | 
				
			||||||
 | 
							char temp[128];
 | 
				
			||||||
		while (fgets(temp, 128, fp)) {
 | 
							while (fgets(temp, 128, fp)) {
 | 
				
			||||||
			if (strstr(temp, ifs)) {
 | 
								if (strstr(temp, ifs)) {
 | 
				
			||||||
				i = 1; /* Line is alive */
 | 
									i = 1; /* Line is alive */
 | 
				
			||||||
| 
						 | 
					@ -793,14 +795,16 @@ void PrintLittle(int i, int *k) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void DrawSpeedInd(char *speed_action) {
 | 
					void DrawSpeedInd(char *speed_action) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int		linespeed, i, k;
 | 
						int	k;
 | 
				
			||||||
	FILE	*fp;
 | 
						FILE	*fp;
 | 
				
			||||||
	char	*p;
 | 
					 | 
				
			||||||
	char	temp[128];
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fp = popen(speed_action, "r");
 | 
						fp = popen(speed_action, "r");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (fp) {
 | 
						if (fp) {
 | 
				
			||||||
 | 
							char *p;
 | 
				
			||||||
 | 
							char temp[128];
 | 
				
			||||||
 | 
							int i, linespeed;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		linespeed = 0;
 | 
							linespeed = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		while (fgets(temp, 128, fp))
 | 
							while (fgets(temp, 128, fp))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue