gbm: turn 0/-1 bool into true/false
authorEric Engestrom <eric@engestrom.ch>
Sun, 1 Sep 2019 16:30:32 +0000 (17:30 +0100)
committerEric Engestrom <eric.engestrom@intel.com>
Sun, 13 Oct 2019 17:10:47 +0000 (18:10 +0100)
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/gbm/backends/dri/gbm_dri.c

index 78a30287177fd87e5d2e1b31be4bd3fa04e1dfd2..19d2d2d01f50fbb93adba00a9b24ec26aae6fb7d 100644 (file)
@@ -279,12 +279,13 @@ static struct dri_extension_match gbm_swrast_device_extensions[] = {
    { NULL, 0, 0 }
 };
 
-static int
+static bool
 dri_bind_extensions(struct gbm_dri_device *dri,
                     struct dri_extension_match *matches,
                     const __DRIextension **extensions)
 {
-   int i, j, ret = 0;
+   int i, j;
+   bool ret = true;
    void *field;
 
    for (i = 0; extensions[i]; i++) {
@@ -300,7 +301,7 @@ dri_bind_extensions(struct gbm_dri_device *dri,
    for (j = 0; matches[j].name; j++) {
       field = ((char *) dri + matches[j].offset);
       if ((*(const __DRIextension **) field == NULL) && !matches[j].optional) {
-         ret = -1;
+         ret = false;
       }
    }
 
@@ -341,7 +342,7 @@ dri_load_driver(struct gbm_dri_device *dri)
    if (!extensions)
       return -1;
 
-   if (dri_bind_extensions(dri, gbm_dri_device_extensions, extensions) < 0) {
+   if (!dri_bind_extensions(dri, gbm_dri_device_extensions, extensions)) {
       dlclose(dri->driver);
       fprintf(stderr, "failed to bind extensions\n");
       return -1;
@@ -361,7 +362,7 @@ dri_load_driver_swrast(struct gbm_dri_device *dri)
    if (!extensions)
       return -1;
 
-   if (dri_bind_extensions(dri, gbm_swrast_device_extensions, extensions) < 0) {
+   if (!dri_bind_extensions(dri, gbm_swrast_device_extensions, extensions)) {
       dlclose(dri->driver);
       fprintf(stderr, "failed to bind extensions\n");
       return -1;
@@ -407,7 +408,7 @@ dri_screen_create_dri2(struct gbm_dri_device *dri, char *driver_name)
       return -1;
 
    extensions = dri->core->getExtensions(dri->screen);
-   if (dri_bind_extensions(dri, dri_core_extensions, extensions) < 0) {
+   if (!dri_bind_extensions(dri, dri_core_extensions, extensions)) {
       ret = -1;
       goto free_screen;
    }