[PATCH 02/14] screen: split out screen init code.

Keith Packard keithp at keithp.com
Wed Jun 20 13:17:12 PDT 2012


Dave Airlie <airlied at gmail.com> writes:


> -int
> -AddScreen(Bool (*pfnInit) (ScreenPtr /*pScreen */ ,
> -                           int /*argc */ ,
> -                           char **      /*argv */
> -          ), int argc, char **argv)
> +static int init_screen(ScreenPtr pScreen, int i)
>  {
> -
> -    int i;
>      int scanlinepad, format, depth, bitsPerPixel, j, k;
> -    ScreenPtr pScreen;
> -
> -    i = screenInfo.numScreens;
> -    if (i == MAXSCREENS)
> -        return -1;
> -
> -    pScreen = (ScreenPtr) calloc(1, sizeof(ScreenRec));
> -    if (!pScreen)
> -        return -1;
>  
>      if (!dixAllocatePrivates(&pScreen->devPrivates, PRIVATE_SCREEN)) {
> -        free(pScreen);
>          return -1;
>      }
>      pScreen->myNum = i;
> @@ -3782,7 +3766,33 @@ AddScreen(Bool (*pfnInit) (ScreenPtr /*pScreen */ ,
>              PixmapWidthPaddingInfo[depth].notPower2 = 0;
>          }
>      }
> +    return 0;
> +}

This part seems fine.

> +
> +int
> +AddScreen(Bool (*pfnInit) (ScreenPtr /*pScreen */ ,
> +                           int /*argc */ ,
> +                           char **      /*argv */
> +          ), int argc, char **argv)
> +{
>  
> +    int i;
> +    ScreenPtr pScreen;
> +    Bool ret;
> +
> +    i = screenInfo.numScreens;
> +    if (i == MAXSCREENS)
> +        return -1;
> +
> +    pScreen = (ScreenPtr) calloc(1, sizeof(ScreenRec));
> +    if (!pScreen)
> +        return -1;
> +
> +    ret = init_screen(pScreen, i);
> +    if (ret) {
> +        free(pScreen);
> +        return ret;
> +    }

init_screen returns int, not Bool

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20120620/578c33d7/attachment.pgp>


More information about the xorg-devel mailing list