egl: drop _eglInitImage() return type
authorEmil Velikov <emil.velikov@collabora.com>
Tue, 20 Jun 2017 14:22:39 +0000 (15:22 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Mon, 26 Jun 2017 11:40:22 +0000 (12:40 +0100)
Function cannot fail and always returns true.

v2: Inline the one line function in the header

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/dri2/platform_android.c
src/egl/drivers/dri2/platform_drm.c
src/egl/drivers/dri2/platform_x11.c
src/egl/drivers/dri2/platform_x11_dri3.c
src/egl/main/eglimage.c
src/egl/main/eglimage.h

index c6af57fbc53e62210863c1cf7506d4f5421def33..a022a5d94326c0737c6c2fbde473a7c8f4e0c00a 100644 (file)
@@ -1669,10 +1669,7 @@ dri2_create_image_from_dri(_EGLDisplay *disp, __DRIimage *dri_image)
       return NULL;
    }
 
-   if (!_eglInitImage(&dri2_img->base, disp)) {
-      free(dri2_img);
-      return NULL;
-   }
+   _eglInitImage(&dri2_img->base, disp);
 
    dri2_img->dri_image = dri_image;
 
@@ -1869,11 +1866,7 @@ dri2_create_image_khr_texture(_EGLDisplay *disp, _EGLContext *ctx,
       return EGL_NO_IMAGE_KHR;
    }
 
-   if (!_eglInitImage(&dri2_img->base, disp)) {
-      _eglError(EGL_BAD_ALLOC, "dri2_create_image_khr");
-      free(dri2_img);
-      return EGL_NO_IMAGE_KHR;
-   }
+   _eglInitImage(&dri2_img->base, disp);
 
    dri2_img->dri_image =
       dri2_dpy->image->createImageFromTexture(dri2_ctx->dri_context,
@@ -2345,10 +2338,7 @@ dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp,
       goto cleanup_img;
    }
 
-   if (!_eglInitImage(&dri2_img->base, disp)) {
-      err = EGL_BAD_PARAMETER;
-      goto cleanup_img;
-   }
+   _eglInitImage(&dri2_img->base, disp);
 
    err = _eglParseImageAttribList(&attrs, disp, attr_list);
    if (err != EGL_SUCCESS)
index acd45dab4d70a2c51a65ab1807212884f37f278e..aef8a105f86022b7b73dfb8c1543f8c231b1e64a 100644 (file)
@@ -843,10 +843,7 @@ droid_create_image_from_name(_EGLDisplay *disp, _EGLContext *ctx,
       return NULL;
    }
 
-   if (!_eglInitImage(&dri2_img->base, disp)) {
-      free(dri2_img);
-      return NULL;
-   }
+   _eglInitImage(&dri2_img->base, disp);
 
    dri2_img->dri_image =
       dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen,
index 9b4a942b60f816c94f1db78c2df3834a18f145ff..c5ae49e9fdd2b5cb3558fddb85cca7eef7c42ea2 100644 (file)
@@ -478,10 +478,7 @@ dri2_drm_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
       return NULL;
    }
 
-   if (!_eglInitImage(&dri2_img->base, disp)) {
-      free(dri2_img);
-      return NULL;
-   }
+   _eglInitImage(&dri2_img->base, disp);
 
    dri2_img->dri_image = dri2_dpy->image->dupImage(dri_bo->image, dri2_img);
    if (dri2_img->dri_image == NULL) {
index 35612300768594c6abc37d1331b67df50dbea789..324128d12ae0314bc1f5645a571b3ff4dacb1b24 100644 (file)
@@ -1070,12 +1070,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
       return EGL_NO_IMAGE_KHR;
    }
 
-   if (!_eglInitImage(&dri2_img->base, disp)) {
-      free(buffers_reply);
-      free(geometry_reply);
-      free(dri2_img);
-      return EGL_NO_IMAGE_KHR;
-   }
+   _eglInitImage(&dri2_img->base, disp);
 
    stride = buffers[0].pitch / buffers[0].cpp;
    dri2_img->dri_image =
index 3148f4904e50c6e2e03aaeaf6d191ccf00565467..515be27e20050a5ebe8fec79b437da7cdcc8086e 100644 (file)
@@ -327,10 +327,7 @@ dri3_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
       return EGL_NO_IMAGE_KHR;
    }
 
-   if (!_eglInitImage(&dri2_img->base, disp)) {
-      free(dri2_img);
-      return EGL_NO_IMAGE_KHR;
-   }
+   _eglInitImage(&dri2_img->base, disp);
 
    dri2_img->dri_image = loader_dri3_create_image(dri2_dpy->conn,
                                                   bp_reply,
index c558f2f02b07a45387094b8c4f17943a368766a6..7587a4be4a3a0a0e4810abb87fce7cf8bfd8e537 100644 (file)
@@ -245,12 +245,3 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy,
 
    return err;
 }
-
-
-EGLBoolean
-_eglInitImage(_EGLImage *img, _EGLDisplay *dpy)
-{
-   _eglInitResource(&img->Resource, sizeof(*img), dpy);
-
-   return EGL_TRUE;
-}
index eb66280ff964529e363456d2c922dfeea9eaf75b..eef98604e7a4e98e428ecab7d3d776e01faa993a 100644 (file)
@@ -96,8 +96,11 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy,
                          const EGLint *attrib_list);
 
 
-extern EGLBoolean
-_eglInitImage(_EGLImage *img, _EGLDisplay *dpy);
+static inline void
+_eglInitImage(_EGLImage *img, _EGLDisplay *dpy)
+{
+   _eglInitResource(&img->Resource, sizeof(*img), dpy);
+}
 
 
 /**