diff options
author | Edward O'Callaghan <[email protected]> | 2015-12-04 21:26:50 +1100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2015-12-06 17:10:23 +0100 |
commit | 150c289f6067cb1ba4572f9124948a94ef94c839 (patch) | |
tree | dd36e1c1546da77b4f539a2256b1f01b8c97936c /src/gallium/auxiliary/translate | |
parent | 147fd00bb36917f8463aacd49a26e95ca0926255 (diff) |
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 <[email protected]>
Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/translate')
-rw-r--r-- | src/gallium/auxiliary/translate/translate_cache.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/translate/translate_generic.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/translate/translate_sse.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/translate/translate_cache.c b/src/gallium/auxiliary/translate/translate_cache.c index 2bed02a454b..8aad7cdfb2b 100644 --- a/src/gallium/auxiliary/translate/translate_cache.c +++ b/src/gallium/auxiliary/translate/translate_cache.c @@ -40,7 +40,7 @@ struct translate_cache { struct translate_cache * translate_cache_create( void ) { struct translate_cache *cache = MALLOC_STRUCT(translate_cache); - if (cache == NULL) { + if (!cache) { return NULL; } diff --git a/src/gallium/auxiliary/translate/translate_generic.c b/src/gallium/auxiliary/translate/translate_generic.c index 45eb63231e3..3b460e11c34 100644 --- a/src/gallium/auxiliary/translate/translate_generic.c +++ b/src/gallium/auxiliary/translate/translate_generic.c @@ -772,7 +772,7 @@ struct translate *translate_generic_create( const struct translate_key *key ) struct translate_generic *tg = CALLOC_STRUCT(translate_generic); unsigned i; - if (tg == NULL) + if (!tg) return NULL; assert(key->nr_elements <= TRANSLATE_MAX_ATTRIBS); diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c index c7b6c36fcfa..b3c3b305962 100644 --- a/src/gallium/auxiliary/translate/translate_sse.c +++ b/src/gallium/auxiliary/translate/translate_sse.c @@ -1486,7 +1486,7 @@ translate_sse2_create(const struct translate_key *key) goto fail; p = os_malloc_aligned(sizeof(struct translate_sse), 16); - if (p == NULL) + if (!p) goto fail; memset(p, 0, sizeof(*p)); |