From 147fd00bb36917f8463aacd49a26e95ca0926255 Mon Sep 17 00:00:00 2001 From: Edward O'Callaghan Date: Fri, 4 Dec 2015 17:12:30 +1100 Subject: [PATCH] gallium/auxiliary: Trivial code style cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Edward O'Callaghan Signed-off-by: Marek Olšák --- src/gallium/auxiliary/draw/draw_llvm_sample.c | 2 +- src/gallium/auxiliary/draw/draw_pt.c | 2 +- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 16 ++++----- .../auxiliary/gallivm/lp_bld_tgsi_soa.c | 6 ++-- src/gallium/auxiliary/pipebuffer/pb_buffer.h | 12 +++---- .../auxiliary/pipebuffer/pb_buffer_fenced.c | 12 +++---- .../auxiliary/pipebuffer/pb_buffer_malloc.c | 2 +- .../auxiliary/pipebuffer/pb_bufmgr_alt.c | 2 +- .../auxiliary/pipebuffer/pb_bufmgr_cache.c | 6 ++-- .../auxiliary/pipebuffer/pb_bufmgr_debug.c | 12 +++---- .../auxiliary/pipebuffer/pb_bufmgr_mm.c | 4 +-- .../auxiliary/pipebuffer/pb_bufmgr_ondemand.c | 8 ++--- .../auxiliary/pipebuffer/pb_bufmgr_pool.c | 2 +- .../auxiliary/pipebuffer/pb_bufmgr_slab.c | 2 +- .../auxiliary/pipebuffer/pb_validate.c | 6 ++-- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 4 +-- src/gallium/auxiliary/util/u_bitmask.c | 4 +-- src/gallium/auxiliary/util/u_cache.c | 2 +- src/gallium/auxiliary/util/u_debug.c | 10 +++--- src/gallium/auxiliary/util/u_debug_memory.c | 10 +++--- src/gallium/auxiliary/util/u_debug_refcnt.c | 2 +- src/gallium/auxiliary/util/u_dump_state.c | 34 +++++++++---------- src/gallium/auxiliary/util/u_handle_table.c | 10 +++--- src/gallium/auxiliary/util/u_hash_table.c | 8 ++--- src/gallium/auxiliary/util/u_surfaces.c | 4 +-- 25 files changed, 91 insertions(+), 91 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_llvm_sample.c b/src/gallium/auxiliary/draw/draw_llvm_sample.c index 32cad59d604..cb316956162 100644 --- a/src/gallium/auxiliary/draw/draw_llvm_sample.c +++ b/src/gallium/auxiliary/draw/draw_llvm_sample.c @@ -283,7 +283,7 @@ draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_stat struct draw_llvm_sampler_soa *sampler; sampler = CALLOC_STRUCT(draw_llvm_sampler_soa); - if(!sampler) + if (!sampler) return NULL; sampler->base.destroy = draw_llvm_sampler_soa_destroy; diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index 3236e523a94..0204b439dee 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -109,7 +109,7 @@ draw_pt_arrays(struct draw_context *draw, frontend = draw->pt.frontend; - if (frontend ) { + if (frontend) { if (draw->pt.prim != prim || draw->pt.opt != opt) { /* In certain conditions switching primitives requires us to flush * and validate the different stages. One example is when smooth diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index 50ae192325b..01c6ba96e3f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -194,7 +194,7 @@ lp_build_min_simple(struct lp_build_context *bld, } } - if(intrinsic) { + if (intrinsic) { /* We need to handle nan's for floating point numbers. If one of the * inputs is nan the other should be returned (required by both D3D10+ * and OpenCL). @@ -376,7 +376,7 @@ lp_build_max_simple(struct lp_build_context *bld, } } - if(intrinsic) { + if (intrinsic) { if (util_cpu_caps.has_sse && type.floating && nan_behavior != GALLIVM_NAN_BEHAVIOR_UNDEFINED && nan_behavior != GALLIVM_NAN_RETURN_OTHER_SECOND_NONNAN && @@ -518,7 +518,7 @@ lp_build_add(struct lp_build_context *bld, } } - if(intrinsic) + if (intrinsic) return lp_build_intrinsic_binary(builder, intrinsic, lp_build_vec_type(bld->gallivm, bld->type), a, b); } @@ -810,7 +810,7 @@ lp_build_sub(struct lp_build_context *bld, } } - if(intrinsic) + if (intrinsic) return lp_build_intrinsic_binary(builder, intrinsic, lp_build_vec_type(bld->gallivm, bld->type), a, b); } @@ -3287,7 +3287,7 @@ lp_build_log2_approx(struct lp_build_context *bld, logexp = LLVMBuildSIToFP(builder, logexp, vec_type, ""); } - if(p_log2) { + if (p_log2) { /* mant = 1 + (float) mantissa(x) */ mant = LLVMBuildAnd(builder, i, mantmask, ""); mant = LLVMBuildOr(builder, mant, one, ""); @@ -3335,15 +3335,15 @@ lp_build_log2_approx(struct lp_build_context *bld, } } - if(p_exp) { + if (p_exp) { exp = LLVMBuildBitCast(builder, exp, vec_type, ""); *p_exp = exp; } - if(p_floor_log2) + if (p_floor_log2) *p_floor_log2 = logexp; - if(p_log2) + if (p_log2) *p_log2 = res; } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 28c7a86316e..3dadde2f26f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -1701,15 +1701,15 @@ emit_fetch_deriv( LLVMValueRef *ddx, LLVMValueRef *ddy) { - if(res) + if (res) *res = src; /* TODO: use interpolation coeffs for inputs */ - if(ddx) + if (ddx) *ddx = lp_build_ddx(&bld->bld_base.base, src); - if(ddy) + if (ddy) *ddy = lp_build_ddy(&bld->bld_base.base, src); } diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h index ba48d461d5c..803c1d39192 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h @@ -163,7 +163,7 @@ pb_map(struct pb_buffer *buf, unsigned flags, void *flush_ctx) { assert(buf); - if(!buf) + if (!buf) return NULL; assert(pipe_is_referenced(&buf->reference)); return buf->vtbl->map(buf, flags, flush_ctx); @@ -174,7 +174,7 @@ static inline void pb_unmap(struct pb_buffer *buf) { assert(buf); - if(!buf) + if (!buf) return; assert(pipe_is_referenced(&buf->reference)); buf->vtbl->unmap(buf); @@ -187,7 +187,7 @@ pb_get_base_buffer( struct pb_buffer *buf, pb_size *offset ) { assert(buf); - if(!buf) { + if (!buf) { base_buf = NULL; offset = 0; return; @@ -204,7 +204,7 @@ static inline enum pipe_error pb_validate(struct pb_buffer *buf, struct pb_validate *vl, unsigned flags) { assert(buf); - if(!buf) + if (!buf) return PIPE_ERROR; assert(buf->vtbl->validate); return buf->vtbl->validate(buf, vl, flags); @@ -215,7 +215,7 @@ static inline void pb_fence(struct pb_buffer *buf, struct pipe_fence_handle *fence) { assert(buf); - if(!buf) + if (!buf) return; assert(buf->vtbl->fence); buf->vtbl->fence(buf, fence); @@ -226,7 +226,7 @@ static inline void pb_destroy(struct pb_buffer *buf) { assert(buf); - if(!buf) + if (!buf) return; assert(!pipe_is_referenced(&buf->reference)); buf->vtbl->destroy(buf); diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index 08935b4dec7..2678268e923 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -626,7 +626,7 @@ fenced_buffer_copy_storage_to_gpu_locked(struct fenced_buffer *fenced_buf) assert(fenced_buf->buffer); map = pb_map(fenced_buf->buffer, PB_USAGE_CPU_WRITE, NULL); - if(!map) + if (!map) return PIPE_ERROR; memcpy(map, fenced_buf->data, fenced_buf->size); @@ -646,7 +646,7 @@ fenced_buffer_copy_storage_to_cpu_locked(struct fenced_buffer *fenced_buf) assert(fenced_buf->buffer); map = pb_map(fenced_buf->buffer, PB_USAGE_CPU_READ, NULL); - if(!map) + if (!map) return PIPE_ERROR; memcpy(fenced_buf->data, map, fenced_buf->size); @@ -720,7 +720,7 @@ fenced_buffer_map(struct pb_buffer *buf, map = fenced_buf->data; } - if(map) { + if (map) { ++fenced_buf->mapcount; fenced_buf->flags |= flags & PB_USAGE_CPU_READ_WRITE; } @@ -764,7 +764,7 @@ fenced_buffer_validate(struct pb_buffer *buf, pipe_mutex_lock(fenced_mgr->mutex); - if(!vl) { + if (!vl) { /* invalidate */ fenced_buf->vl = NULL; fenced_buf->validation_flags = 0; @@ -927,7 +927,7 @@ fenced_bufmgr_create_buffer(struct pb_manager *mgr, } fenced_buf = CALLOC_STRUCT(fenced_buffer); - if(!fenced_buf) + if (!fenced_buf) goto no_buffer; pipe_reference_init(&fenced_buf->base.reference, 1); @@ -1042,7 +1042,7 @@ fenced_bufmgr_create(struct pb_manager *provider, { struct fenced_manager *fenced_mgr; - if(!provider) + if (!provider) return NULL; fenced_mgr = CALLOC_STRUCT(fenced_manager); diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c index b97771457d6..ea2f2fa107c 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c @@ -132,7 +132,7 @@ pb_malloc_buffer_create(pb_size size, /* TODO: do a single allocation */ buf = CALLOC_STRUCT(malloc_buffer); - if(!buf) + if (!buf) return NULL; pipe_reference_init(&buf->base.reference, 1); diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_alt.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_alt.c index 47cbaeb20ac..f71bacc8820 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_alt.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_alt.c @@ -67,7 +67,7 @@ pb_alt_manager_create_buffer(struct pb_manager *_mgr, struct pb_buffer *buf; buf = mgr->provider1->create_buffer(mgr->provider1, size, desc); - if(buf) + if (buf) return buf; buf = mgr->provider2->create_buffer(mgr->provider2, size, desc); diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c index cc8ae84bb1b..1c8c25d6f76 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c @@ -354,7 +354,7 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr, } } - if(buf) { + if (buf) { mgr->cache_size -= buf->base.size; LIST_DEL(&buf->head); --mgr->numDelayed; @@ -367,7 +367,7 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr, pipe_mutex_unlock(mgr->mutex); buf = CALLOC_STRUCT(pb_cache_buffer); - if(!buf) + if (!buf) return NULL; buf->buffer = mgr->provider->create_buffer(mgr->provider, size, desc); @@ -454,7 +454,7 @@ pb_cache_manager_create(struct pb_manager *provider, { struct pb_cache_manager *mgr; - if(!provider) + if (!provider) return NULL; mgr = CALLOC_STRUCT(pb_cache_manager); diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c index 7ad70f293a6..8e9bd960d2d 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c @@ -160,7 +160,7 @@ pb_debug_buffer_fill(struct pb_debug_buffer *buf) map = pb_map(buf->buffer, PB_USAGE_CPU_WRITE, NULL); assert(map); - if(map) { + if (map) { fill_random_pattern(map, buf->underflow_size); fill_random_pattern(map + buf->underflow_size + buf->base.size, buf->overflow_size); @@ -183,7 +183,7 @@ pb_debug_buffer_check(struct pb_debug_buffer *buf) PB_USAGE_CPU_READ | PB_USAGE_UNSYNCHRONIZED, NULL); assert(map); - if(map) { + if (map) { boolean underflow, overflow; pb_size min_ofs, max_ofs; @@ -256,10 +256,10 @@ pb_debug_buffer_map(struct pb_buffer *_buf, pb_debug_buffer_check(buf); map = pb_map(buf->buffer, flags, flush_ctx); - if(!map) + if (!map) return NULL; - if(map) { + if (map) { pipe_mutex_lock(buf->mutex); ++buf->map_count; debug_backtrace_capture(buf->map_backtrace, 1, PB_DEBUG_MAP_BACKTRACE); @@ -375,7 +375,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr, assert(desc->alignment); buf = CALLOC_STRUCT(pb_debug_buffer); - if(!buf) + if (!buf) return NULL; real_size = mgr->underflow_size + size + mgr->overflow_size; @@ -462,7 +462,7 @@ pb_debug_manager_create(struct pb_manager *provider, { struct pb_debug_manager *mgr; - if(!provider) + if (!provider) return NULL; mgr = CALLOC_STRUCT(pb_debug_manager); diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c index 72099ba5850..14de61b163f 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c @@ -252,7 +252,7 @@ mm_bufmgr_create_from_buffer(struct pb_buffer *buffer, { struct mm_pb_manager *mm; - if(!buffer) + if (!buffer) return NULL; mm = CALLOC_STRUCT(mm_pb_manager); @@ -300,7 +300,7 @@ mm_bufmgr_create(struct pb_manager *provider, struct pb_manager *mgr; struct pb_desc desc; - if(!provider) + if (!provider) return NULL; memset(&desc, 0, sizeof(desc)); diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c index c20e2dca02d..4885d68c398 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c @@ -151,7 +151,7 @@ pb_ondemand_buffer_instantiate(struct pb_ondemand_buffer *buf) return PIPE_ERROR_OUT_OF_MEMORY; map = pb_map(buf->buffer, PB_USAGE_CPU_READ, NULL); - if(!map) { + if (!map) { pb_reference(&buf->buffer, NULL); return PIPE_ERROR; } @@ -241,7 +241,7 @@ pb_ondemand_manager_create_buffer(struct pb_manager *_mgr, struct pb_ondemand_buffer *buf; buf = CALLOC_STRUCT(pb_ondemand_buffer); - if(!buf) + if (!buf) return NULL; pipe_reference_init(&buf->base.reference, 1); @@ -288,11 +288,11 @@ pb_ondemand_manager_create(struct pb_manager *provider) { struct pb_ondemand_manager *mgr; - if(!provider) + if (!provider) return NULL; mgr = CALLOC_STRUCT(pb_ondemand_manager); - if(!mgr) + if (!mgr) return NULL; mgr->base.destroy = pb_ondemand_manager_destroy; diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c index 56a5e82ece0..98877b46352 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c @@ -261,7 +261,7 @@ pool_bufmgr_create(struct pb_manager *provider, struct pool_buffer *pool_buf; pb_size i; - if(!provider) + if (!provider) return NULL; pool = CALLOC_STRUCT(pool_pb_manager); diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c index aadeaa087f4..fdbcf9e5c44 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c @@ -542,7 +542,7 @@ pb_slab_range_manager_create(struct pb_manager *provider, pb_size bufSize; unsigned i; - if(!provider) + if (!provider) return NULL; mgr = CALLOC_STRUCT(pb_slab_range_manager); diff --git a/src/gallium/auxiliary/pipebuffer/pb_validate.c b/src/gallium/auxiliary/pipebuffer/pb_validate.c index 657ac23ef25..8489842effd 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_validate.c +++ b/src/gallium/auxiliary/pipebuffer/pb_validate.c @@ -66,7 +66,7 @@ pb_validate_add_buffer(struct pb_validate *vl, unsigned flags) { assert(buf); - if(!buf) + if (!buf) return PIPE_ERROR; assert(flags & PB_USAGE_GPU_READ_WRITE); @@ -94,7 +94,7 @@ pb_validate_add_buffer(struct pb_validate *vl, new_entries = (struct pb_validate_entry *)REALLOC(vl->entries, vl->size*sizeof(struct pb_validate_entry), new_size*sizeof(struct pb_validate_entry)); - if(!new_entries) + if (!new_entries) return PIPE_ERROR_OUT_OF_MEMORY; memset(new_entries + vl->size, 0, (new_size - vl->size)*sizeof(struct pb_validate_entry)); @@ -177,7 +177,7 @@ pb_validate_create() struct pb_validate *vl; vl = CALLOC_STRUCT(pb_validate); - if(!vl) + if (!vl) return NULL; vl->size = PB_VALIDATE_INITIAL_SIZE; diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index f2f518130fb..4730472f40f 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -1018,7 +1018,7 @@ static void validate( unsigned opcode, #ifdef DEBUG const struct tgsi_opcode_info *info = tgsi_get_opcode_info( opcode ); assert(info); - if(info) { + if (info) { assert(nr_dst == info->num_dst); assert(nr_src == info->num_src); } @@ -1083,7 +1083,7 @@ ureg_emit_label(struct ureg_program *ureg, { union tgsi_any_token *out, *insn; - if(!label_token) + if (!label_token) return; out = get_tokens( ureg, DOMAIN_INSN, 1 ); diff --git a/src/gallium/auxiliary/util/u_bitmask.c b/src/gallium/auxiliary/util/u_bitmask.c index b19be29a5a4..c22f5068923 100644 --- a/src/gallium/auxiliary/util/u_bitmask.c +++ b/src/gallium/auxiliary/util/u_bitmask.c @@ -66,7 +66,7 @@ util_bitmask_create(void) struct util_bitmask *bm; bm = MALLOC_STRUCT(util_bitmask); - if(!bm) + if (!bm) return NULL; bm->words = (util_bitmask_word *)CALLOC(UTIL_BITMASK_INITIAL_WORDS, sizeof(util_bitmask_word)); @@ -114,7 +114,7 @@ util_bitmask_resize(struct util_bitmask *bm, new_words = (util_bitmask_word *)REALLOC((void *)bm->words, bm->size / UTIL_BITMASK_BITS_PER_BYTE, new_size / UTIL_BITMASK_BITS_PER_BYTE); - if(!new_words) + if (!new_words) return FALSE; memset(new_words + bm->size/UTIL_BITMASK_BITS_PER_WORD, diff --git a/src/gallium/auxiliary/util/u_cache.c b/src/gallium/auxiliary/util/u_cache.c index da0856981eb..acc82bac0ff 100644 --- a/src/gallium/auxiliary/util/u_cache.c +++ b/src/gallium/auxiliary/util/u_cache.c @@ -95,7 +95,7 @@ util_cache_create(uint32_t (*hash)(const void *key), struct util_cache *cache; cache = CALLOC_STRUCT(util_cache); - if(!cache) + if (!cache) return NULL; cache->hash = hash; diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index 702953673ba..cb162d89a58 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -153,7 +153,7 @@ debug_get_option(const char *name, const char *dfault) const char *result; result = os_get_option(name); - if(!result) + if (!result) result = dfault; if (debug_get_option_should_print()) @@ -557,7 +557,7 @@ void debug_dump_surface(struct pipe_context *pipe, surface->u.tex.first_layer, PIPE_TRANSFER_READ, 0, 0, surface->width, surface->height, &transfer); - if(!data) + if (!data) return; debug_dump_image(prefix, @@ -654,7 +654,7 @@ debug_dump_transfer_bmp(struct pipe_context *pipe, transfer->box.height * transfer->box.depth * 4*sizeof(float)); - if(!rgba) + if (!rgba) goto error1; pipe_get_tile_rgba(transfer, ptr, 0, 0, @@ -680,7 +680,7 @@ debug_dump_float_rgba_bmp(const char *filename, struct bmp_info_header bmih; unsigned x, y; - if(!rgba) + if (!rgba) goto error1; bmfh.bfType = 0x4d42; @@ -702,7 +702,7 @@ debug_dump_float_rgba_bmp(const char *filename, bmih.biClrImportant = 0; stream = fopen(filename, "wb"); - if(!stream) + if (!stream) goto error1; fwrite(&bmfh, 14, 1, stream); diff --git a/src/gallium/auxiliary/util/u_debug_memory.c b/src/gallium/auxiliary/util/u_debug_memory.c index 3e7ecfa79f3..f1cc8eb1b7c 100644 --- a/src/gallium/auxiliary/util/u_debug_memory.c +++ b/src/gallium/auxiliary/util/u_debug_memory.c @@ -128,7 +128,7 @@ debug_malloc(const char *file, unsigned line, const char *function, struct debug_memory_footer *ftr; hdr = os_malloc(sizeof(*hdr) + size + sizeof(*ftr)); - if(!hdr) { + if (!hdr) { debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n", file, line, function, (long unsigned)size); @@ -167,7 +167,7 @@ debug_free(const char *file, unsigned line, const char *function, struct debug_memory_header *hdr; struct debug_memory_footer *ftr; - if(!ptr) + if (!ptr) return; hdr = header_from_data(ptr); @@ -213,7 +213,7 @@ debug_calloc(const char *file, unsigned line, const char *function, size_t count, size_t size ) { void *ptr = debug_malloc( file, line, function, count * size ); - if( ptr ) + if (ptr) memset( ptr, 0, count * size ); return ptr; } @@ -226,7 +226,7 @@ debug_realloc(const char *file, unsigned line, const char *function, struct debug_memory_footer *old_ftr, *new_ftr; void *new_ptr; - if(!old_ptr) + if (!old_ptr) return debug_malloc( file, line, function, new_size ); if(!new_size) { @@ -253,7 +253,7 @@ debug_realloc(const char *file, unsigned line, const char *function, /* alloc new */ new_hdr = os_malloc(sizeof(*new_hdr) + new_size + sizeof(*new_ftr)); - if(!new_hdr) { + if (!new_hdr) { debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n", file, line, function, (long unsigned)new_size); diff --git a/src/gallium/auxiliary/util/u_debug_refcnt.c b/src/gallium/auxiliary/util/u_debug_refcnt.c index a51b4c55f83..2c3dc986a90 100644 --- a/src/gallium/auxiliary/util/u_debug_refcnt.c +++ b/src/gallium/auxiliary/util/u_debug_refcnt.c @@ -79,7 +79,7 @@ static boolean debug_serial(void* p, unsigned* pserial) #endif pipe_mutex_lock(serials_mutex); - if(!serials_hash) + if (!serials_hash) serials_hash = util_hash_table_create(hash_ptr, compare_ptr); serial = (unsigned)(uintptr_t)util_hash_table_get(serials_hash, p); if(!serial) diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c index 441d16236b5..a73a1de2f0b 100644 --- a/src/gallium/auxiliary/util/u_dump_state.c +++ b/src/gallium/auxiliary/util/u_dump_state.c @@ -320,7 +320,7 @@ util_dump_resource(FILE *stream, const struct pipe_resource *state) void util_dump_rasterizer_state(FILE *stream, const struct pipe_rasterizer_state *state) { - if(!state) { + if (!state) { util_dump_null(stream); return; } @@ -374,7 +374,7 @@ util_dump_rasterizer_state(FILE *stream, const struct pipe_rasterizer_state *sta void util_dump_poly_stipple(FILE *stream, const struct pipe_poly_stipple *state) { - if(!state) { + if (!state) { util_dump_null(stream); return; } @@ -392,7 +392,7 @@ util_dump_poly_stipple(FILE *stream, const struct pipe_poly_stipple *state) void util_dump_viewport_state(FILE *stream, const struct pipe_viewport_state *state) { - if(!state) { + if (!state) { util_dump_null(stream); return; } @@ -409,7 +409,7 @@ util_dump_viewport_state(FILE *stream, const struct pipe_viewport_state *state) void util_dump_scissor_state(FILE *stream, const struct pipe_scissor_state *state) { - if(!state) { + if (!state) { util_dump_null(stream); return; } @@ -430,7 +430,7 @@ util_dump_clip_state(FILE *stream, const struct pipe_clip_state *state) { unsigned i; - if(!state) { + if (!state) { util_dump_null(stream); return; } @@ -456,7 +456,7 @@ util_dump_shader_state(FILE *stream, const struct pipe_shader_state *state) { unsigned i; - if(!state) { + if (!state) { util_dump_null(stream); return; } @@ -500,7 +500,7 @@ util_dump_depth_stencil_alpha_state(FILE *stream, const struct pipe_depth_stenci { unsigned i; - if(!state) { + if (!state) { util_dump_null(stream); return; } @@ -579,7 +579,7 @@ util_dump_blend_state(FILE *stream, const struct pipe_blend_state *state) { unsigned valid_entries = 1; - if(!state) { + if (!state) { util_dump_null(stream); return; } @@ -611,7 +611,7 @@ util_dump_blend_state(FILE *stream, const struct pipe_blend_state *state) void util_dump_blend_color(FILE *stream, const struct pipe_blend_color *state) { - if(!state) { + if (!state) { util_dump_null(stream); return; } @@ -626,7 +626,7 @@ util_dump_blend_color(FILE *stream, const struct pipe_blend_color *state) void util_dump_stencil_ref(FILE *stream, const struct pipe_stencil_ref *state) { - if(!state) { + if (!state) { util_dump_null(stream); return; } @@ -656,7 +656,7 @@ util_dump_framebuffer_state(FILE *stream, const struct pipe_framebuffer_state *s void util_dump_sampler_state(FILE *stream, const struct pipe_sampler_state *state) { - if(!state) { + if (!state) { util_dump_null(stream); return; } @@ -686,7 +686,7 @@ util_dump_sampler_state(FILE *stream, const struct pipe_sampler_state *state) void util_dump_surface(FILE *stream, const struct pipe_surface *state) { - if(!state) { + if (!state) { util_dump_null(stream); return; } @@ -770,7 +770,7 @@ util_dump_sampler_view(FILE *stream, const struct pipe_sampler_view *state) void util_dump_transfer(FILE *stream, const struct pipe_transfer *state) { - if(!state) { + if (!state) { util_dump_null(stream); return; } @@ -832,7 +832,7 @@ util_dump_index_buffer(FILE *stream, const struct pipe_index_buffer *state) void util_dump_vertex_buffer(FILE *stream, const struct pipe_vertex_buffer *state) { - if(!state) { + if (!state) { util_dump_null(stream); return; } @@ -851,7 +851,7 @@ util_dump_vertex_buffer(FILE *stream, const struct pipe_vertex_buffer *state) void util_dump_vertex_element(FILE *stream, const struct pipe_vertex_element *state) { - if(!state) { + if (!state) { util_dump_null(stream); return; } @@ -889,7 +889,7 @@ util_dump_stream_output_target(FILE *stream, void util_dump_draw_info(FILE *stream, const struct pipe_draw_info *state) { - if(!state) { + if (!state) { util_dump_null(stream); return; } @@ -924,7 +924,7 @@ util_dump_draw_info(FILE *stream, const struct pipe_draw_info *state) void util_dump_box(FILE *stream, const struct pipe_box *box) { - if(!box) { + if (!box) { util_dump_null(stream); return; } diff --git a/src/gallium/auxiliary/util/u_handle_table.c b/src/gallium/auxiliary/util/u_handle_table.c index 42c4e44b644..c6eeeef0f3a 100644 --- a/src/gallium/auxiliary/util/u_handle_table.c +++ b/src/gallium/auxiliary/util/u_handle_table.c @@ -64,7 +64,7 @@ handle_table_create(void) struct handle_table *ht; ht = MALLOC_STRUCT(handle_table); - if(!ht) + if (!ht) return NULL; ht->objects = (void **)CALLOC(HANDLE_TABLE_INITIAL_SIZE, sizeof(void *)); @@ -114,7 +114,7 @@ handle_table_resize(struct handle_table *ht, new_objects = (void **)REALLOC((void *)ht->objects, ht->size*sizeof(void *), new_size*sizeof(void *)); - if(!new_objects) + if (!new_objects) return 0; memset(new_objects + ht->size, 0, (new_size - ht->size)*sizeof(void *)); @@ -139,7 +139,7 @@ handle_table_clear(struct handle_table *ht, */ object = ht->objects[index]; - if(object) { + if (object) { ht->objects[index] = NULL; if(ht->destroy) @@ -199,7 +199,7 @@ handle_table_set(struct handle_table *ht, return 0; assert(object); - if(!object) + if (!object) return 0; index = handle - 1; @@ -247,7 +247,7 @@ handle_table_remove(struct handle_table *ht, index = handle - 1; object = ht->objects[index]; - if(!object) + if (!object) return; handle_table_clear(ht, index); diff --git a/src/gallium/auxiliary/util/u_hash_table.c b/src/gallium/auxiliary/util/u_hash_table.c index a505fbc4d83..9e2b6b7de8b 100644 --- a/src/gallium/auxiliary/util/u_hash_table.c +++ b/src/gallium/auxiliary/util/u_hash_table.c @@ -82,7 +82,7 @@ util_hash_table_create(unsigned (*hash)(void *key), struct util_hash_table *ht; ht = MALLOC_STRUCT(util_hash_table); - if(!ht) + if (!ht) return NULL; ht->cso = cso_hash_create(); @@ -154,14 +154,14 @@ util_hash_table_set(struct util_hash_table *ht, key_hash = ht->hash(key); item = util_hash_table_find_item(ht, key, key_hash); - if(item) { + if (item) { /* TODO: key/value destruction? */ item->value = value; return PIPE_OK; } item = MALLOC_STRUCT(util_hash_table_item); - if(!item) + if (!item) return PIPE_ERROR_OUT_OF_MEMORY; item->key = key; @@ -191,7 +191,7 @@ util_hash_table_get(struct util_hash_table *ht, key_hash = ht->hash(key); item = util_hash_table_find_item(ht, key, key_hash); - if(!item) + if (!item) return NULL; return item->value; diff --git a/src/gallium/auxiliary/util/u_surfaces.c b/src/gallium/auxiliary/util/u_surfaces.c index c2f2b74c939..78b2506e47b 100644 --- a/src/gallium/auxiliary/util/u_surfaces.c +++ b/src/gallium/auxiliary/util/u_surfaces.c @@ -59,7 +59,7 @@ util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, } ps = (struct pipe_surface *)CALLOC(1, surface_struct_size); - if(!ps) + if (!ps) { *res = NULL; return FALSE; @@ -114,7 +114,7 @@ util_surfaces_destroy(struct util_surfaces *us, struct pipe_resource *pt, void ( for(i = 0; i <= pt->last_level; ++i) { struct pipe_surface *ps = us->u.array[i]; - if(ps) + if (ps) destroy_surface(ps); } FREE(us->u.array); -- 2.30.2