[PATCH 1/7] randr: fix "set but unused" warnings

walter harms wharms at bfs.de
Thu Feb 14 02:19:06 PST 2013



Am 14.02.2013 01:24, schrieb Peter Hutterer:
> rrcrtc.c: In function 'RRCrtcDetachScanoutPixmap':
> rrcrtc.c:366:9: warning: variable 'ret' set but not used
> [-Wunused-but-set-variable]
> rrcrtc.c: In function 'rrCheckPixmapBounding':
> rrcrtc.c:505:13: warning: variable 'ret' set but not used
> [-Wunused-but-set-variable]
> rrcrtc.c:445:9: warning: unused variable 'i' [-Wunused-variable]
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  randr/rrcrtc.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
> index 6e2eca5..721b05a 100644
> --- a/randr/rrcrtc.c
> +++ b/randr/rrcrtc.c
> @@ -363,13 +363,12 @@ void
>  RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc)
>  {
>      ScreenPtr master = crtc->pScreen->current_master;
> -    int ret;
>      PixmapPtr mscreenpix;
>      rrScrPriv(crtc->pScreen);
>  
>      mscreenpix = master->GetScreenPixmap(master);
>  
> -    ret = pScrPriv->rrCrtcSetScanoutPixmap(crtc, NULL);

What is this function suppost to return ?
If it is an error code it should be evaluatet,
if its useless why not declare the function void ?

It you really want to ignore the return value you could
cast the function void, that is usual the way to tell others:
"I know that this returns something but i really do not care"
(may this is not in Xorg styleguide but i find it handy).

re,
 wh


> +    pScrPriv->rrCrtcSetScanoutPixmap(crtc, NULL);
>      if (crtc->scanout_pixmap) {
>          master->StopPixmapTracking(mscreenpix, crtc->scanout_pixmap);
>          /*
> @@ -442,7 +441,7 @@ rrCheckPixmapBounding(ScreenPtr pScreen,
>                        RRCrtcPtr rr_crtc, int x, int y, int w, int h)
>  {
>      RegionRec root_pixmap_region, total_region, new_crtc_region;
> -    int i, c;
> +    int c;
>      BoxRec newbox;
>      BoxPtr newsize;
>      ScreenPtr slave;
> @@ -502,10 +501,8 @@ rrCheckPixmapBounding(ScreenPtr pScreen,
>          new_height == screen_pixmap->drawable.height) {
>          ErrorF("adjust shatters %d %d\n", newsize->x1, newsize->x2);
>      } else {
> -        int ret;
>          rrScrPriv(pScreen);
> -        ret = pScrPriv->rrScreenSetSize(pScreen,
> -                                           new_width, new_height, 0, 0);
> +        pScrPriv->rrScreenSetSize(pScreen, new_width, new_height, 0, 0);
>      }
>  
>      /* set shatters TODO */


More information about the xorg-devel mailing list