[PATCH 05/32] [libx11] Pointer "pBuf" returned from "fgets(buf, 256, stream)" is never used

Matt Turner mattst88 at gmail.com
Thu Jan 27 08:32:34 PST 2011


2011/1/27 Erkki Seppälä <erkki.seppala at vincit.fi>:
> Removed unused assignment
>
> Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira at nokia.com>
> Signed-off-by: Erkki Seppälä <erkki.seppala at vincit.fi>
> ---
>  src/xcms/cmsColNm.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/xcms/cmsColNm.c b/src/xcms/cmsColNm.c
> index 4164370..c7ad4fd 100644
> --- a/src/xcms/cmsColNm.c
> +++ b/src/xcms/cmsColNm.c
> @@ -567,7 +567,7 @@ stringSectionSize(
>        return(XcmsFailure);
>     }
>
> -    while((pBuf = fgets(buf, XCMSDB_MAXLINELEN, stream)) != NULL) {
> +    while((fgets(buf, XCMSDB_MAXLINELEN, stream)) != NULL) {
>        if ((sscanf(buf, "%s", token)) && (strcmp(token, END_TOKEN) == 0)) {
>            break;
>        }
> --
> 1.7.0.4

I'd think the reason the code is like this is to avoid warning messages like

warning: ignoring return value of ‘fgets’, declared with attribute
warn_unused_result

So, this may not be what you want to do.

Matt


More information about the xorg-devel mailing list