[ltt-dev] [LTTV PATCH] Fix remaining warnings
Mathieu Desnoyers
compudj at krystal.dyndns.org
Tue Jan 25 20:11:37 EST 2011
* Alexandre Montplaisir (alexandre.montplaisir at polymtl.ca) wrote:
> On 11-01-25 07:59 PM, Mathieu Desnoyers wrote:
> > * Alexandre Montplaisir (alexandre.montplaisir at polymtl.ca) wrote:
> >> Add and check the return values of fscanf, fread and asprintf functions.
> >>
> >> That should be it! GCC 4.5 with -Wall doesn't report anything else.
> >>
> >> Signed-off-by: Alexandre Montplaisir <alexandre.montplaisir at polymtl.ca>
> >> ---
> >> lttv/lttv/attribute.c | 8 ++--
> >> lttv/lttv/state.c | 72 ++++++++++++++++++++++++---------------
> >> lttv/modules/text/depanalysis.c | 23 +++++++++----
> >> 3 files changed, 64 insertions(+), 39 deletions(-)
> >>
> >> diff --git a/lttv/lttv/attribute.c b/lttv/lttv/attribute.c
> >> index 243fe02..3b09468 100644
> >> --- a/lttv/lttv/attribute.c
> >> +++ b/lttv/lttv/attribute.c
> >> @@ -487,13 +487,13 @@ lttv_attribute_read_xml(LttvAttribute *self, FILE *fp)
> >>
> >> LttvAttribute *subtree;
> >>
> >> - fscanf(fp,"<ATTRS>");
> >> + res = fscanf(fp, "<ATTRS>");
> > Is it me or you forgot to check res here ?
>
> Yeah, I omitted it on purpose, since we're feeding it a literal anyway.
> The "res =", albeit useless, suppresses the warning.
> Would you rather have it check for res > 0 ?
Otherwise, the way to suppress that kind of warning, when you _know_ you
don't have to check them, is to do:
(void) fscanf(fp, "<ATTRS>");
Mathieu
>
> --
> Alexandre Montplaisir
> DORSAL lab,
> École Polytechnique de Montréal
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list