summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/cso_cache
diff options
context:
space:
mode:
authorEdward O'Callaghan <eocallaghan@alterapraxis.com>2015-12-04 21:26:50 +1100
committerMarek Olšák <marek.olsak@amd.com>2015-12-06 17:10:23 +0100
commit150c289f6067cb1ba4572f9124948a94ef94c839 (patch)
treedd36e1c1546da77b4f539a2256b1f01b8c97936c /src/gallium/auxiliary/cso_cache
parent147fd00bb36917f8463aacd49a26e95ca0926255 (diff)
downloadexternal_mesa3d-150c289f6067cb1ba4572f9124948a94ef94c839.zip
external_mesa3d-150c289f6067cb1ba4572f9124948a94ef94c839.tar.gz
external_mesa3d-150c289f6067cb1ba4572f9124948a94ef94c839.tar.bz2
gallium/auxiliary: 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 <eocallaghan@alterapraxis.com> Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Diffstat (limited to 'src/gallium/auxiliary/cso_cache')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_cache.c2
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_cache.c b/src/gallium/auxiliary/cso_cache/cso_cache.c
index d36f1fb..b240c93 100644
--- a/src/gallium/auxiliary/cso_cache/cso_cache.c
+++ b/src/gallium/auxiliary/cso_cache/cso_cache.c
@@ -247,7 +247,7 @@ struct cso_cache *cso_cache_create(void)
{
struct cso_cache *sc = MALLOC_STRUCT(cso_cache);
int i;
- if (sc == NULL)
+ if (!sc)
return NULL;
sc->max_size = 4096;
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 00686d2..6b29b20 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -244,7 +244,7 @@ static void cso_init_vbuf(struct cso_context *cso)
struct cso_context *cso_create_context( struct pipe_context *pipe )
{
struct cso_context *ctx = CALLOC_STRUCT(cso_context);
- if (ctx == NULL)
+ if (!ctx)
goto out;
ctx->cache = cso_cache_create();
@@ -1075,7 +1075,7 @@ cso_single_sampler(struct cso_context *ctx, unsigned shader_stage,
{
void *handle = NULL;
- if (templ != NULL) {
+ if (templ) {
unsigned key_size = sizeof(struct pipe_sampler_state);
unsigned hash_key = cso_construct_key((void*)templ, key_size);
struct cso_hash_iter iter =