[PATCH] Unused variables x and found_macro_x on process_macros_r()

Ricardo Maraschini ricardo.maraschini at opservices.com.br
Fri Jun 22 21:01:31 CEST 2012



----- Original Message -----
> hello,
> 
> i've removed two unused variables on found_macro_x() function.

^found_macro_x^process_macros_r




> Compiler errors:
> 
> ../common/macros.c: In function ‘process_macros_r’:
> ../common/macros.c:133:6: warning: variable ‘found_macro_x’ set but
> not used [-Wunused-but-set-variable]
> ../common/macros.c:128:6: warning: variable ‘x’ set but not used
> [-Wunused-but-set-variable]
> 
> 
> OK? Comments?
> 
> 
> 
> --- common/macros.c	(revision 1973)
> +++ common/macros.c	(working copy)
> @@ -125,12 +125,10 @@
>  	char *buf_ptr = NULL;
>  	char *delim_ptr = NULL;
>  	int in_macro = FALSE;
> -	int x = 0;
>  	char *selected_macro = NULL;
>  	char *original_macro = NULL;
>  	char *cleaned_macro = NULL;
>  	int clean_macro = FALSE;
> -	int found_macro_x = FALSE;
>  	int result = OK;
>  	int clean_options = 0;
>  	int free_macro = FALSE;
> @@ -171,7 +169,6 @@
>  		log_debug_info(DEBUGL_MACROS, 2, "  Processing part: '%s'\n",
>  		temp_buffer);
>  
>  		selected_macro = NULL;
> -		found_macro_x = FALSE;
>  		clean_macro = FALSE;
>  
>  		/* we're in plain text... */
> @@ -202,19 +199,16 @@
>  					my_free(selected_macro);
>  				}
>  
> -			/* we already have a macro... */
> -			if(result == OK)
> -				x = 0;
>  
>  			/* an escaped $ is done by specifying two $$ next to each other
>  			*/
> -			else if(!strcmp(temp_buffer, "")) {
> +			if(!strcmp(temp_buffer, "") && result != OK) {
>  				log_debug_info(DEBUGL_MACROS, 2, "  Escaped $.  Running output
>  				(%lu): '%s'\n", (unsigned long)strlen(*output_buffer),
>  				*output_buffer);
>  				*output_buffer = (char *)realloc(*output_buffer,
>  				strlen(*output_buffer) + 2);
>  				strcat(*output_buffer, "$");
>  				}
>  
>  			/* a non-macro, just some user-defined string between two $s */
> -			else {
> +			else if(result != OK){
>  				log_debug_info(DEBUGL_MACROS, 2, "  Non-macro.  Running output
>  				(%lu): '%s'\n", (unsigned long)strlen(*output_buffer),
>  				*output_buffer);
>  
>  				/* add the plain text to the end of the already processed buffer
>  				*/
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond.
> Discussions
> will include endpoint security, mobile security and the latest in
> malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Nagios-devel mailing list
> Nagios-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-devel
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list