diff options
author | Edward O'Callaghan <[email protected]> | 2015-12-04 22:08:22 +1100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2015-12-06 17:10:23 +0100 |
commit | 13eb5f596bc8ece3d1805b388aa53917e6158d7b (patch) | |
tree | da4ab5c8fd897b317d7f66004fdd22cd02ebe84c /src/gallium/drivers/radeon | |
parent | 150c289f6067cb1ba4572f9124948a94ef94c839 (diff) |
gallium/drivers: Sanitize NULL checks into canonical form
Use NULL tests of the form `if (ptr)' or `if (!ptr)'.
They do not depend on the definition of the symbol NULL.
Further, they provide the opportunity for the accidental
assignment, are clear and succinct.
Signed-off-by: Edward O'Callaghan <[email protected]>
Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_query.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_texture.c | 8 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index f566a299f30..8899ba4d55b 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -318,7 +318,7 @@ void r600_context_add_resource_size(struct pipe_context *ctx, struct pipe_resour struct r600_common_context *rctx = (struct r600_common_context *)ctx; struct r600_resource *rr = (struct r600_resource *)r; - if (r == NULL) { + if (!r) { return; } diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c index 09eabab0e7d..06b5e501a50 100644 --- a/src/gallium/drivers/radeon/r600_query.c +++ b/src/gallium/drivers/radeon/r600_query.c @@ -202,7 +202,7 @@ static struct pipe_query *r600_query_sw_create(struct pipe_context *ctx, struct r600_query_sw *query; query = CALLOC_STRUCT(r600_query_sw); - if (query == NULL) + if (!query) return NULL; query->b.type = query_type; diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index 88b799d87ee..6515a829b5a 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -699,7 +699,7 @@ r600_texture_create_object(struct pipe_screen *screen, struct r600_common_screen *rscreen = (struct r600_common_screen*)screen; rtex = CALLOC_STRUCT(r600_texture); - if (rtex == NULL) + if (!rtex) return NULL; resource = &rtex->resource; @@ -1039,7 +1039,7 @@ static void *r600_texture_transfer_map(struct pipe_context *ctx, } trans = CALLOC_STRUCT(r600_transfer); - if (trans == NULL) + if (!trans) return NULL; trans->transfer.resource = texture; trans->transfer.level = level; @@ -1115,7 +1115,7 @@ static void *r600_texture_transfer_map(struct pipe_context *ctx, /* Create the temporary texture. */ staging = (struct r600_texture*)ctx->screen->resource_create(ctx->screen, &resource); - if (staging == NULL) { + if (!staging) { R600_ERR("failed to create temporary texture to hold untiled copy\n"); FREE(trans); return NULL; @@ -1192,7 +1192,7 @@ struct pipe_surface *r600_create_surface_custom(struct pipe_context *pipe, { struct r600_surface *surface = CALLOC_STRUCT(r600_surface); - if (surface == NULL) + if (!surface) return NULL; assert(templ->u.tex.first_layer <= util_max_layer(texture, templ->u.tex.level)); |