Page 1 of 1

Re: [Nagios-devel] [PATCH] Unused variables x and found_macro_x

Posted: Fri Jun 22, 2012 6:01 pm
by Guest


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

^found_macro_x^process_macros_r




> Compiler errors:
>=20
> ../common/macros.c: In function =E2=80=98process_macros_r=E2=80=99:
> ../common/macros.c:133:6: warning: variable =E2=80=98found_macro_x=E2=80=
=99 set but
> not used [-Wunused-but-set-variable]
> ../common/macros.c:128:6: warning: variable =E2=80=98x=E2=80=99 set but n=
ot used
> [-Wunused-but-set-variable]
>=20
>=20
> OK? Comments?
>=20
>=20
>=20
> --- common/macros.c=09(revision 1973)
> +++ common/macros.c=09(working copy)
> @@ -125,12 +125,10 @@
> =09char *buf_ptr =3D NULL;
> =09char *delim_ptr =3D NULL;
> =09int in_macro =3D FALSE;
> -=09int x =3D 0;
> =09char *selected_macro =3D NULL;
> =09char *original_macro =3D NULL;
> =09char *cleaned_macro =3D NULL;
> =09int clean_macro =3D FALSE;
> -=09int found_macro_x =3D FALSE;
> =09int result =3D OK;
> =09int clean_options =3D 0;
> =09int free_macro =3D FALSE;
> @@ -171,7 +169,6 @@
> =09=09log_debug_info(DEBUGL_MACROS, 2, " Processing part: '%s'\n",
> =09=09temp_buffer);
> =20
> =09=09selected_macro =3D NULL;
> -=09=09found_macro_x =3D FALSE;
> =09=09clean_macro =3D FALSE;
> =20
> =09=09/* we're in plain text... */
> @@ -202,19 +199,16 @@
> =09=09=09=09=09my_free(selected_macro);
> =09=09=09=09}
> =20
> -=09=09=09/* we already have a macro... */
> -=09=09=09if(result =3D=3D OK)
> -=09=09=09=09x =3D 0;
> =20
> =09=09=09/* an escaped $ is done by specifying two $$ next to each other
> =09=09=09*/
> -=09=09=09else if(!strcmp(temp_buffer, "")) {
> +=09=09=09if(!strcmp(temp_buffer, "") && result !=3D OK) {
> =09=09=09=09log_debug_info(DEBUGL_MACROS, 2, " Escaped $. Running outp=
ut
> =09=09=09=09(%lu): '%s'\n", (unsigned long)strlen(*output_buffer),
> =09=09=09=09*output_buffer);
> =09=09=09=09*output_buffer =3D (char *)realloc(*output_buffer,
> =09=09=09=09strlen(*output_buffer) + 2);
> =09=09=09=09strcat(*output_buffer, "$");
> =09=09=09=09}
> =20
> =09=09=09/* a non-macro, just some user-defined string between two $s */
> -=09=09=09else {
> +=09=09=09else if(result !=3D OK){
> =09=09=09=09log_debug_info(DEBUGL_MACROS, 2, " Non-macro. Running outp=
ut
> =09=09=09=09(%lu): '%s'\n", (unsigned long)strlen(*output_buffer),
> =09=09=09=09*output_buffer);
> =20
> =09=09=09=09/* add the plain text to the end of the already processed bu=
ffer
> =09=09=09=09*/
>=20
> -------------------------------------------------------------------------=
-----
> 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/sfrnl0424 ... /50122263/
> _______________________________________________
> Nagios-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/lis ... gios-devel
>





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]