Signed-off-by: Eric Engestrom <eric.engest...@intel.com> --- src/compiler/glsl/ir_builder_print_visitor.cpp | 2 +- src/compiler/glsl/ir_print_visitor.cpp | 12 ++++++------ src/compiler/glsl/link_interface_blocks.cpp | 4 ++-- src/compiler/glsl/linker.cpp | 2 +- src/compiler/glsl/opt_dead_builtin_varyings.cpp | 10 +++++----- src/compiler/glsl_types.cpp | 10 +++++----- src/gallium/auxiliary/draw/draw_llvm.c | 10 +++++----- src/gallium/auxiliary/driver_ddebug/dd_util.h | 4 ++-- src/gallium/auxiliary/gallivm/lp_bld_arit_overflow.c | 2 +- src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | 4 ++-- src/gallium/auxiliary/gallivm/lp_bld_gather.c | 2 +- src/gallium/auxiliary/gallivm/lp_bld_init.c | 4 ++-- src/gallium/auxiliary/gallivm/lp_bld_intr.c | 4 ++-- src/gallium/auxiliary/gallivm/lp_bld_printf.c | 2 +- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 2 +- src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 2 +- src/gallium/auxiliary/pipe-loader/pipe_loader.c | 4 ++-- src/gallium/auxiliary/util/u_debug_flush.c | 2 +- src/gallium/auxiliary/util/u_debug_image.c | 2 +- src/gallium/auxiliary/util/u_debug_symbol.c | 8 ++++---- src/gallium/auxiliary/util/u_network.c | 2 +- src/gallium/auxiliary/util/u_simple_shaders.c | 2 +- src/gallium/auxiliary/util/u_tests.c | 2 +- src/gallium/drivers/etnaviv/etnaviv_screen.c | 2 +- src/gallium/drivers/freedreno/freedreno_screen.c | 2 +- src/gallium/drivers/i915/i915_screen.c | 2 +- src/gallium/drivers/llvmpipe/lp_flush.c | 4 ++-- src/gallium/drivers/llvmpipe/lp_rast.c | 2 +- src/gallium/drivers/llvmpipe/lp_screen.c | 2 +- src/gallium/drivers/llvmpipe/lp_state_fs.c | 4 ++-- src/gallium/drivers/llvmpipe/lp_state_setup.c | 2 +- src/gallium/drivers/llvmpipe/lp_test_arit.c | 2 +- src/gallium/drivers/llvmpipe/lp_test_format.c | 2 +- src/gallium/drivers/nouveau/nouveau_screen.c | 2 +- src/gallium/drivers/softpipe/sp_flush.c | 4 ++-- src/gallium/drivers/svga/svga_pipe_flush.c | 4 ++-- src/gallium/drivers/svga/svga_screen.c | 8 ++++---- src/gallium/drivers/swr/swr_screen.cpp | 2 +- src/intel/vulkan/anv_device.c | 4 ++-- src/util/u_debug.c | 6 +++--- src/util/u_queue.c | 6 +++--- src/util/u_string.h | 2 +- 42 files changed, 80 insertions(+), 80 deletions(-)
diff --git a/src/compiler/glsl/ir_builder_print_visitor.cpp b/src/compiler/glsl/ir_builder_print_visitor.cpp index da04868652a402ce855c..9745dec1af3aa27e2461 100644 --- a/src/compiler/glsl/ir_builder_print_visitor.cpp +++ b/src/compiler/glsl/ir_builder_print_visitor.cpp @@ -706,7 +706,7 @@ ir_builder_print_visitor::visit_leave(ir_call *ir) const struct hash_entry *const he = _mesa_hash_table_search(index_map, ir->return_deref); - util_snprintf(return_deref_string, sizeof(return_deref_string), + snprintf(return_deref_string, sizeof(return_deref_string), "operand(r%04X).val", (unsigned)(uintptr_t) he->data); } else { diff --git a/src/compiler/glsl/ir_print_visitor.cpp b/src/compiler/glsl/ir_print_visitor.cpp index 1626657081ea36bbaf13..4b7ef758bc447bc76e76 100644 --- a/src/compiler/glsl/ir_print_visitor.cpp +++ b/src/compiler/glsl/ir_print_visitor.cpp @@ -168,31 +168,31 @@ void ir_print_visitor::visit(ir_variable *ir) char binding[32] = {0}; if (ir->data.binding) - util_snprintf(binding, sizeof(binding), "binding=%i ", ir->data.binding); + snprintf(binding, sizeof(binding), "binding=%i ", ir->data.binding); char loc[32] = {0}; if (ir->data.location != -1) - util_snprintf(loc, sizeof(loc), "location=%i ", ir->data.location); + snprintf(loc, sizeof(loc), "location=%i ", ir->data.location); char component[32] = {0}; if (ir->data.explicit_component || ir->data.location_frac != 0) - util_snprintf(component, sizeof(component), "component=%i ", + snprintf(component, sizeof(component), "component=%i ", ir->data.location_frac); char stream[32] = {0}; if (ir->data.stream & (1u << 31)) { if (ir->data.stream & ~(1u << 31)) { - util_snprintf(stream, sizeof(stream), "stream(%u,%u,%u,%u) ", + snprintf(stream, sizeof(stream), "stream(%u,%u,%u,%u) ", ir->data.stream & 3, (ir->data.stream >> 2) & 3, (ir->data.stream >> 4) & 3, (ir->data.stream >> 6) & 3); } } else if (ir->data.stream) { - util_snprintf(stream, sizeof(stream), "stream%u ", ir->data.stream); + snprintf(stream, sizeof(stream), "stream%u ", ir->data.stream); } char image_format[32] = {0}; if (ir->data.image_format) { - util_snprintf(image_format, sizeof(image_format), "format=%x ", + snprintf(image_format, sizeof(image_format), "format=%x ", ir->data.image_format); } diff --git a/src/compiler/glsl/link_interface_blocks.cpp b/src/compiler/glsl/link_interface_blocks.cpp index 801fbcd5d9f90c6be8f8..6e044ca979730f991614 100644 --- a/src/compiler/glsl/link_interface_blocks.cpp +++ b/src/compiler/glsl/link_interface_blocks.cpp @@ -234,7 +234,7 @@ class interface_block_definitions if (var->data.explicit_location && var->data.location >= VARYING_SLOT_VAR0) { char location_str[11]; - util_snprintf(location_str, 11, "%d", var->data.location); + snprintf(location_str, 11, "%d", var->data.location); const struct hash_entry *entry = _mesa_hash_table_search(ht, location_str); @@ -260,7 +260,7 @@ class interface_block_definitions * unsigned location value which is overkill but future proof. */ char location_str[11]; - util_snprintf(location_str, 11, "%d", var->data.location); + snprintf(location_str, 11, "%d", var->data.location); _mesa_hash_table_insert(ht, ralloc_strdup(mem_ctx, location_str), var); } else { _mesa_hash_table_insert(ht, diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 17fe0a584481fc06449a..84a802cf3b00d8c614f9 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -4223,7 +4223,7 @@ is_top_level_shader_storage_block_member(const char* name, return false; } - util_snprintf(full_instanced_name, name_length, "%s.%s", + snprintf(full_instanced_name, name_length, "%s.%s", interface_name, field_name); /* Check if its top-level shader storage block member of an diff --git a/src/compiler/glsl/opt_dead_builtin_varyings.cpp b/src/compiler/glsl/opt_dead_builtin_varyings.cpp index 6ed00128ed93110e1940..853847ebfd55748fa04c 100644 --- a/src/compiler/glsl/opt_dead_builtin_varyings.cpp +++ b/src/compiler/glsl/opt_dead_builtin_varyings.cpp @@ -323,14 +323,14 @@ class replace_varyings_visitor : public ir_rvalue_visitor { if (!(external_color_usage & (1 << i))) { if (info->color[i]) { - util_snprintf(name, 32, "gl_%s_FrontColor%i_dummy", mode_str, i); + snprintf(name, 32, "gl_%s_FrontColor%i_dummy", mode_str, i); this->new_color[i] = new (ctx) ir_variable(glsl_type::vec4_type, name, ir_var_temporary); } if (info->backcolor[i]) { - util_snprintf(name, 32, "gl_%s_BackColor%i_dummy", mode_str, i); + snprintf(name, 32, "gl_%s_BackColor%i_dummy", mode_str, i); this->new_backcolor[i] = new (ctx) ir_variable(glsl_type::vec4_type, name, ir_var_temporary); @@ -342,7 +342,7 @@ class replace_varyings_visitor : public ir_rvalue_visitor { info->fog) { char name[32]; - util_snprintf(name, 32, "gl_%s_FogFragCoord_dummy", mode_str); + snprintf(name, 32, "gl_%s_FogFragCoord_dummy", mode_str); this->new_fog = new (ctx) ir_variable(glsl_type::float_type, name, ir_var_temporary); } @@ -366,13 +366,13 @@ class replace_varyings_visitor : public ir_rvalue_visitor { if (!(external_usage & (1 << i))) { /* This varying is unused in the next stage. Declare * a temporary instead of an output. */ - util_snprintf(name, 32, "gl_%s_%s%i_dummy", mode_str, var_name, i); + snprintf(name, 32, "gl_%s_%s%i_dummy", mode_str, var_name, i); new_var[i] = new (ctx) ir_variable(glsl_type::vec4_type, name, ir_var_temporary); } else { - util_snprintf(name, 32, "gl_%s_%s%i", mode_str, var_name, i); + snprintf(name, 32, "gl_%s_%s%i", mode_str, var_name, i); new_var[i] = new(ctx) ir_variable(glsl_type::vec4_type, name, this->info->mode); diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp index e6262371bd0c7a6f3a54..df387630b411f16fb244 100644 --- a/src/compiler/glsl_types.cpp +++ b/src/compiler/glsl_types.cpp @@ -460,7 +460,7 @@ glsl_type::glsl_type(const glsl_type *array, unsigned length) : char *const n = (char *) ralloc_size(this->mem_ctx, name_length); if (length == 0) - util_snprintf(n, name_length, "%s[]", array->name); + snprintf(n, name_length, "%s[]", array->name); else { /* insert outermost dimensions in the correct spot * otherwise the dimension order will be backwards @@ -468,11 +468,11 @@ glsl_type::glsl_type(const glsl_type *array, unsigned length) : const char *pos = strchr(array->name, '['); if (pos) { int idx = pos - array->name; - util_snprintf(n, idx+1, "%s", array->name); - util_snprintf(n + idx, name_length - idx, "[%u]%s", + snprintf(n, idx+1, "%s", array->name); + snprintf(n + idx, name_length - idx, "[%u]%s", length, array->name + idx); } else { - util_snprintf(n, name_length, "%s[%u]", array->name, length); + snprintf(n, name_length, "%s[%u]", array->name, length); } } @@ -854,7 +854,7 @@ glsl_type::get_array_instance(const glsl_type *base, unsigned array_size) * named 'foo'. */ char key[128]; - util_snprintf(key, sizeof(key), "%p[%u]", (void *) base, array_size); + snprintf(key, sizeof(key), "%p[%u]", (void *) base, array_size); mtx_lock(&glsl_type::hash_mutex); diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 69c108037509e61243d2..7c6483f3992a647afe4f 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -387,7 +387,7 @@ create_jit_vertex_header(struct gallivm_state *gallivm, int data_elems) LLVMTypeRef vertex_header; char struct_name[24]; - util_snprintf(struct_name, 23, "vertex_header%d", data_elems); + snprintf(struct_name, 23, "vertex_header%d", data_elems); elem_types[DRAW_JIT_VERTEX_VERTEX_ID] = LLVMIntTypeInContext(gallivm->context, 32); elem_types[DRAW_JIT_VERTEX_CLIP_POS] = LLVMArrayType(LLVMFloatTypeInContext(gallivm->context), 4); @@ -562,7 +562,7 @@ draw_llvm_create_variant(struct draw_llvm *llvm, variant->llvm = llvm; variant->shader = shader; - util_snprintf(module_name, sizeof(module_name), "draw_llvm_vs_variant%u", + snprintf(module_name, sizeof(module_name), "draw_llvm_vs_variant%u", variant->shader->variants_cached); variant->gallivm = gallivm_create(module_name, llvm->context); @@ -1574,7 +1574,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant) memset(&system_values, 0, sizeof(system_values)); - util_snprintf(func_name, sizeof(func_name), "draw_llvm_vs_variant%u", + snprintf(func_name, sizeof(func_name), "draw_llvm_vs_variant%u", variant->shader->variants_cached); i = 0; @@ -2254,7 +2254,7 @@ draw_gs_llvm_generate(struct draw_llvm *llvm, memset(&system_values, 0, sizeof(system_values)); - util_snprintf(func_name, sizeof(func_name), "draw_llvm_gs_variant%u", + snprintf(func_name, sizeof(func_name), "draw_llvm_gs_variant%u", variant->shader->variants_cached); assert(variant->vertex_header_ptr_type); @@ -2388,7 +2388,7 @@ draw_gs_llvm_create_variant(struct draw_llvm *llvm, variant->llvm = llvm; variant->shader = shader; - util_snprintf(module_name, sizeof(module_name), "draw_llvm_gs_variant%u", + snprintf(module_name, sizeof(module_name), "draw_llvm_gs_variant%u", variant->shader->variants_cached); variant->gallivm = gallivm_create(module_name, llvm->context); diff --git a/src/gallium/auxiliary/driver_ddebug/dd_util.h b/src/gallium/auxiliary/driver_ddebug/dd_util.h index 20aca94cc6703bbbd955..b41de84f9925f0f5cc01 100644 --- a/src/gallium/auxiliary/driver_ddebug/dd_util.h +++ b/src/gallium/auxiliary/driver_ddebug/dd_util.h @@ -62,12 +62,12 @@ dd_get_debug_filename_and_mkdir(char *buf, size_t buflen, bool verbose) strcpy(proc_name, "unknown"); } - util_snprintf(dir, sizeof(dir), "%s/"DD_DIR, debug_get_option("HOME", ".")); + snprintf(dir, sizeof(dir), "%s/"DD_DIR, debug_get_option("HOME", ".")); if (mkdir(dir, 0774) && errno != EEXIST) fprintf(stderr, "dd: can't create a directory (%i)\n", errno); - util_snprintf(buf, buflen, "%s/%s_%u_%08u", dir, proc_name, getpid(), + snprintf(buf, buflen, "%s/%s_%u_%08u", dir, proc_name, getpid(), p_atomic_inc_return(&index) - 1); if (verbose) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit_overflow.c b/src/gallium/auxiliary/gallivm/lp_bld_arit_overflow.c index 152ad573451059b0c5a6..0ff51721a707601036a9 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit_overflow.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit_overflow.c @@ -80,7 +80,7 @@ build_binary_int_overflow(struct gallivm_state *gallivm, debug_assert(type_width == 16 || type_width == 32 || type_width == 64); - util_snprintf(intr_str, sizeof intr_str, "%s.i%u", + snprintf(intr_str, sizeof intr_str, "%s.i%u", intr_prefix, type_width); oelems[0] = type_ref; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp index 23ada3d0433c1e1c9f80..1bada6ff39479db4d7ea 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp @@ -241,9 +241,9 @@ lp_profile(LLVMValueRef func, const void *code) if (getenv("PERF_BUILDID_DIR")) { pid_t pid = getpid(); char filename[256]; - util_snprintf(filename, sizeof filename, "/tmp/perf-%llu.map", (unsigned long long)pid); + snprintf(filename, sizeof filename, "/tmp/perf-%llu.map", (unsigned long long)pid); perf_map_file = fopen(filename, "wt"); - util_snprintf(filename, sizeof filename, "/tmp/perf-%llu.map.asm", (unsigned long long)pid); + snprintf(filename, sizeof filename, "/tmp/perf-%llu.map.asm", (unsigned long long)pid); perf_asm_file.open(filename); } first_time = FALSE; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_gather.c b/src/gallium/auxiliary/gallivm/lp_bld_gather.c index 8cabe9ef01e1ec4c65de..53a797d85da8fb951b2f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_gather.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_gather.c @@ -327,7 +327,7 @@ lp_build_gather_avx2(struct gallivm_state *gallivm, src_ptr = LLVMBuildGEP(builder, base_ptr, &offsets, 1, "vector-gep"); char intrinsic[64]; - util_snprintf(intrinsic, sizeof intrinsic, "llvm.masked.gather.v%u%s%u", + snprintf(intrinsic, sizeof intrinsic, "llvm.masked.gather.v%u%s%u", length, dst_type.floating ? "f" : "i", src_width); LLVMValueRef alignment = LLVMConstInt(i32_type, src_width/8, 0); LLVMValueRef mask = LLVMConstAllOnes(i1_vec_type); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index e8bca5bc3afce7210149..ab234b922cfb40082c8e 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -371,7 +371,7 @@ init_gallivm_state(struct gallivm_state *gallivm, const char *name, { const unsigned pointer_size = 8 * sizeof(void *); char layout[512]; - util_snprintf(layout, sizeof layout, "%c-p:%u:%u:%u-i64:64:64-a0:0:%u-s0:%u:%u", + snprintf(layout, sizeof layout, "%c-p:%u:%u:%u-i64:64:64-a0:0:%u-s0:%u:%u", #ifdef PIPE_ARCH_LITTLE_ENDIAN 'e', // little endian #else @@ -594,7 +594,7 @@ gallivm_compile_module(struct gallivm_state *gallivm) if (gallivm_debug & GALLIVM_DEBUG_DUMP_BC) { char filename[256]; assert(gallivm->module_name); - util_snprintf(filename, sizeof(filename), "ir_%s.bc", gallivm->module_name); + snprintf(filename, sizeof(filename), "ir_%s.bc", gallivm->module_name); LLVMWriteBitcodeToFile(gallivm->module, filename); debug_printf("%s written\n", filename); debug_printf("Invoke as \"opt %s %s | llc -O%d %s%s\"\n", diff --git a/src/gallium/auxiliary/gallivm/lp_bld_intr.c b/src/gallium/auxiliary/gallivm/lp_bld_intr.c index 74ed16f33f0e5dae13a9..7f7612e7cdef293b76d6 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_intr.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_intr.c @@ -90,9 +90,9 @@ lp_format_intrinsic(char *name, } if (length) { - util_snprintf(name, size, "%s.v%u%c%u", name_root, length, c, width); + snprintf(name, size, "%s.v%u%c%u", name_root, length, c, width); } else { - util_snprintf(name, size, "%s.%c%u", name_root, c, width); + snprintf(name, size, "%s.%c%u", name_root, c, width); } } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_printf.c b/src/gallium/auxiliary/gallivm/lp_bld_printf.c index cf58c3b1eaa8d6152c17..a4233a24e3317cc98f0c 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_printf.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_printf.c @@ -108,7 +108,7 @@ lp_build_print_value(struct gallivm_state *gallivm, type_fmt[5] = '\0'; } else if (type_kind == LLVMIntegerTypeKind) { if (LLVMGetIntTypeWidth(type_ref) == 64) { - util_snprintf(type_fmt + 2, 3, "%s", PRId64); + snprintf(type_fmt + 2, 3, "%s", PRId64); } else if (LLVMGetIntTypeWidth(type_ref) == 8) { type_fmt[2] = 'u'; } else { diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 018cca8f9dfa48757ac5..125df919e02c2bba085f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -3564,7 +3564,7 @@ lp_build_sample_soa_func(struct gallivm_state *gallivm, * Additionally lod_property has to be included too. */ - util_snprintf(func_name, sizeof(func_name), "texfunc_res_%d_sam_%d_%x", + snprintf(func_name, sizeof(func_name), "texfunc_res_%d_sam_%d_%x", texture_index, sampler_index, sample_key); function = LLVMGetNamedFunction(module, func_name); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 0f5b3d9acb7ef1813976..a90796237f66afddb58f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -96,7 +96,7 @@ emit_dump_reg(struct gallivm_state *gallivm, { char buf[32]; - util_snprintf(buf, sizeof buf, " %s[%u].%c = ", + snprintf(buf, sizeof buf, " %s[%u].%c = ", tgsi_file_name(file), index, "xyzw"[chan]); diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.c b/src/gallium/auxiliary/pipe-loader/pipe_loader.c index 3311a4b361859c669ece..481cdd31aa1b6a281020 100644 --- a/src/gallium/auxiliary/pipe-loader/pipe_loader.c +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.c @@ -151,11 +151,11 @@ pipe_loader_find_module(const char *driver_name, len = next - library_paths; if (len) - ret = util_snprintf(path, sizeof(path), "%.*s/%s%s%s", + ret = snprintf(path, sizeof(path), "%.*s/%s%s%s", len, library_paths, MODULE_PREFIX, driver_name, UTIL_DL_EXT); else - ret = util_snprintf(path, sizeof(path), "%s%s%s", + ret = snprintf(path, sizeof(path), "%s%s%s", MODULE_PREFIX, driver_name, UTIL_DL_EXT); if (ret > 0 && ret < sizeof(path)) { diff --git a/src/gallium/auxiliary/util/u_debug_flush.c b/src/gallium/auxiliary/util/u_debug_flush.c index c49af095ed1377440a82..84c41cef9cfe4b4d3523 100644 --- a/src/gallium/auxiliary/util/u_debug_flush.c +++ b/src/gallium/auxiliary/util/u_debug_flush.c @@ -327,7 +327,7 @@ debug_flush_might_flush_cb(UNUSED void *key, void *value, void *data) const char *reason = (const char *) data; char message[80]; - util_snprintf(message, sizeof(message), + snprintf(message, sizeof(message), "%s referenced mapped buffer detected.", reason); debug_flush_alert(message, reason, 3, item->bt_depth, TRUE, TRUE, NULL); diff --git a/src/gallium/auxiliary/util/u_debug_image.c b/src/gallium/auxiliary/util/u_debug_image.c index f0fd6cf8339fe0364c92..4e7984886d0d17b6b644 100644 --- a/src/gallium/auxiliary/util/u_debug_image.c +++ b/src/gallium/auxiliary/util/u_debug_image.c @@ -57,7 +57,7 @@ debug_dump_image(const char *prefix, unsigned char *rgb8; FILE *f; - util_snprintf(filename, sizeof(filename), "%s.ppm", prefix); + snprintf(filename, sizeof(filename), "%s.ppm", prefix); rgb8 = MALLOC(height * width * 3); if (!rgb8) { diff --git a/src/gallium/auxiliary/util/u_debug_symbol.c b/src/gallium/auxiliary/util/u_debug_symbol.c index ad9b8f11204acb67d40b..7eaac9a701eec23b1673 100644 --- a/src/gallium/auxiliary/util/u_debug_symbol.c +++ b/src/gallium/auxiliary/util/u_debug_symbol.c @@ -191,7 +191,7 @@ debug_symbol_name_dbghelp(const void *addr, char* buf, unsigned size) if (GetModuleFileNameA(hModule, buffer, sizeof buffer) == sizeof buffer) { return FALSE; } - util_snprintf(buf, size, "%p at %s+0x%lx", + snprintf(buf, size, "%p at %s+0x%lx", addr, buffer, (unsigned long)((uintptr_t)addr - (uintptr_t)hModule)); @@ -208,9 +208,9 @@ debug_symbol_name_dbghelp(const void *addr, char* buf, unsigned size) } if (Line.FileName) { - util_snprintf(buf, size, "%s at %s:%lu", pSymbol->Name, Line.FileName, Line.LineNumber); + snprintf(buf, size, "%s at %s:%lu", pSymbol->Name, Line.FileName, Line.LineNumber); } else { - util_snprintf(buf, size, "%s", pSymbol->Name); + snprintf(buf, size, "%s", pSymbol->Name); } return TRUE; @@ -258,7 +258,7 @@ debug_symbol_name(const void *addr, char* buf, unsigned size) } #endif - util_snprintf(buf, size, "%p", addr); + snprintf(buf, size, "%p", addr); buf[size - 1] = 0; } diff --git a/src/gallium/auxiliary/util/u_network.c b/src/gallium/auxiliary/util/u_network.c index 89395f54ea505cb39a95..15c30f375b0f17ff5c82 100644 --- a/src/gallium/auxiliary/util/u_network.c +++ b/src/gallium/auxiliary/util/u_network.c @@ -119,7 +119,7 @@ u_socket_connect(const char *hostname, uint16_t port) hints.ai_family = AF_UNSPEC; // AF_INET or AF_INET6 to force version hints.ai_socktype = SOCK_STREAM; - util_snprintf(portString, sizeof(portString), "%d", port); + snprintf(portString, sizeof(portString), "%d", port); r = getaddrinfo(hostname, portString, NULL, &addr); if (r != 0) { diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c b/src/gallium/auxiliary/util/u_simple_shaders.c index 4046ab1202b22e9215b2..f1dfc41bd2ceb3a0035f 100644 --- a/src/gallium/auxiliary/util/u_simple_shaders.c +++ b/src/gallium/auxiliary/util/u_simple_shaders.c @@ -667,7 +667,7 @@ util_make_fs_blit_msaa_gen(struct pipe_context *pipe, assert(tgsi_tex == TGSI_TEXTURE_2D_MSAA || tgsi_tex == TGSI_TEXTURE_2D_ARRAY_MSAA); - util_snprintf(text, sizeof(text), shader_templ, type, samp_type, + snprintf(text, sizeof(text), shader_templ, type, samp_type, output_semantic, conversion_decl, type, conversion, output_mask); if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens))) { diff --git a/src/gallium/auxiliary/util/u_tests.c b/src/gallium/auxiliary/util/u_tests.c index 59953dc70a47977020b7..4252b4c566551d70090c 100644 --- a/src/gallium/auxiliary/util/u_tests.c +++ b/src/gallium/auxiliary/util/u_tests.c @@ -623,7 +623,7 @@ test_texture_barrier(struct pipe_context *ctx, bool use_fbfetch, assert(num_samples >= 1 && num_samples <= 8); - util_snprintf(name, sizeof(name), "%s: %s, %u samples", __func__, + snprintf(name, sizeof(name), "%s: %s, %u samples", __func__, use_fbfetch ? "FBFETCH" : "sampler", MAX2(num_samples, 1)); if (!ctx->screen->get_param(ctx->screen, PIPE_CAP_TEXTURE_BARRIER)) { diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index fb51aa5f4e8d7542232f..f1c2d6a355a9566665a5 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -106,7 +106,7 @@ etna_screen_get_name(struct pipe_screen *pscreen) struct etna_screen *priv = etna_screen(pscreen); static char buffer[128]; - util_snprintf(buffer, sizeof(buffer), "Vivante GC%x rev %04x", priv->model, + snprintf(buffer, sizeof(buffer), "Vivante GC%x rev %04x", priv->model, priv->revision); return buffer; diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index 88d91a91234184145186..8e273815e3491d1864a2 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -111,7 +111,7 @@ static const char * fd_screen_get_name(struct pipe_screen *pscreen) { static char buffer[128]; - util_snprintf(buffer, sizeof(buffer), "FD%03d", + snprintf(buffer, sizeof(buffer), "FD%03d", fd_screen(pscreen)->device_id); return buffer; } diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index a7b4a43c0153ef9965f2..7efc22522a80cba7776c 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -103,7 +103,7 @@ i915_get_name(struct pipe_screen *screen) break; } - util_snprintf(buffer, sizeof(buffer), "i915 (chipset: %s)", chipset); + snprintf(buffer, sizeof(buffer), "i915 (chipset: %s)", chipset); return buffer; } diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c index 452753f881052908b8cf..94c78ef18c4a328d16ab 100644 --- a/src/gallium/drivers/llvmpipe/lp_flush.c +++ b/src/gallium/drivers/llvmpipe/lp_flush.c @@ -62,12 +62,12 @@ llvmpipe_flush( struct pipe_context *pipe, unsigned i; for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++) { - util_snprintf(filename, sizeof(filename), "cbuf%u_%u", i, frame_no); + snprintf(filename, sizeof(filename), "cbuf%u_%u", i, frame_no); debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.cbufs[i]); } if (0) { - util_snprintf(filename, sizeof(filename), "zsbuf_%u", frame_no); + snprintf(filename, sizeof(filename), "zsbuf_%u", frame_no); debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.zsbuf); } diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index 9d4f9f8d0276af5d151c..a4cb211e14b30e4ab540 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -789,7 +789,7 @@ thread_function(void *init_data) char thread_name[16]; unsigned fpstate; - util_snprintf(thread_name, sizeof thread_name, "llvmpipe-%u", task->thread_index); + snprintf(thread_name, sizeof thread_name, "llvmpipe-%u", task->thread_index); u_thread_setname(thread_name); /* Make sure that denorms are treated like zeros. This is diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index c95016a6cbef6d7610c7..f6e820ac1beae4ed9ad7 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -97,7 +97,7 @@ static const char * llvmpipe_get_name(struct pipe_screen *screen) { static char buf[100]; - util_snprintf(buf, sizeof(buf), "llvmpipe (LLVM %u.%u, %u bits)", + snprintf(buf, sizeof(buf), "llvmpipe (LLVM %u.%u, %u bits)", HAVE_LLVM >> 8, HAVE_LLVM & 0xff, lp_native_vector_width ); return buf; diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index ab285bed1cab9ef8b83d..802acafd16e5ac7e44a6 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -2486,7 +2486,7 @@ generate_fragment(struct llvmpipe_context *lp, blend_vec_type = lp_build_vec_type(gallivm, blend_type); - util_snprintf(func_name, sizeof(func_name), "fs%u_variant%u_%s", + snprintf(func_name, sizeof(func_name), "fs%u_variant%u_%s", shader->no, variant->no, partial_mask ? "partial" : "whole"); arg_types[0] = variant->jit_context_ptr_type; /* context */ @@ -2825,7 +2825,7 @@ generate_variant(struct llvmpipe_context *lp, if (!variant) return NULL; - util_snprintf(module_name, sizeof(module_name), "fs%u_variant%u", + snprintf(module_name, sizeof(module_name), "fs%u_variant%u", shader->no, shader->variants_created); variant->gallivm = gallivm_create(module_name, lp->context); diff --git a/src/gallium/drivers/llvmpipe/lp_state_setup.c b/src/gallium/drivers/llvmpipe/lp_state_setup.c index 77c7ac1bbde585e2a471..ba5db0da42990038865b 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_state_setup.c @@ -727,7 +727,7 @@ generate_setup_variant(struct lp_setup_variant_key *key, variant->no = setup_no++; - util_snprintf(func_name, sizeof(func_name), "setup_variant_%u", + snprintf(func_name, sizeof(func_name), "setup_variant_%u", variant->no); variant->gallivm = gallivm = gallivm_create(func_name, lp->context); diff --git a/src/gallium/drivers/llvmpipe/lp_test_arit.c b/src/gallium/drivers/llvmpipe/lp_test_arit.c index acba7ed44a85613b231a..21e2d89d946bc1c12ef0 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_test_arit.c @@ -399,7 +399,7 @@ static boolean test_unary(unsigned verbose, FILE *fp, const struct unary_test_t *test, unsigned length) { char test_name[128]; - util_snprintf(test_name, sizeof test_name, "%s.v%u", test->name, length); + snprintf(test_name, sizeof test_name, "%s.v%u", test->name, length); LLVMContextRef context; struct gallivm_state *gallivm; LLVMValueRef test_func; diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index a8aa33d8ae9e476102b4..4bce56d573d0a5b85e5e 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -97,7 +97,7 @@ add_fetch_rgba_test(struct gallivm_state *gallivm, unsigned verbose, LLVMValueRef rgba; LLVMValueRef cache = NULL; - util_snprintf(name, sizeof name, "fetch_%s_%s", desc->short_name, + snprintf(name, sizeof name, "fetch_%s_%s", desc->short_name, type.floating ? "float" : "unorm8"); args[0] = LLVMPointerType(lp_build_vec_type(gallivm, type), 0); diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index e9fe04bddf7df52dbc3e..eca1f0ac79599a2e9a4a 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -34,7 +34,7 @@ nouveau_screen_get_name(struct pipe_screen *pscreen) struct nouveau_device *dev = nouveau_screen(pscreen)->device; static char buffer[128]; - util_snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset); + snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset); return buffer; } diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c index 3bf8c49921888281b3c2..eba3a086c346590861ed 100644 --- a/src/gallium/drivers/softpipe/sp_flush.c +++ b/src/gallium/drivers/softpipe/sp_flush.c @@ -82,9 +82,9 @@ softpipe_flush( struct pipe_context *pipe, if (flags & PIPE_FLUSH_END_OF_FRAME) { static unsigned frame_no = 1; static char filename[256]; - util_snprintf(filename, sizeof(filename), "cbuf_%u.bmp", frame_no); + snprintf(filename, sizeof(filename), "cbuf_%u.bmp", frame_no); debug_dump_surface_bmp(pipe, filename, softpipe->framebuffer.cbufs[0]); - util_snprintf(filename, sizeof(filename), "zsbuf_%u.bmp", frame_no); + snprintf(filename, sizeof(filename), "zsbuf_%u.bmp", frame_no); debug_dump_surface_bmp(pipe, filename, softpipe->framebuffer.zsbuf); ++frame_no; } diff --git a/src/gallium/drivers/svga/svga_pipe_flush.c b/src/gallium/drivers/svga/svga_pipe_flush.c index 1f4eebc124a950fbc305..7e809d0cda8bde661bb9 100644 --- a/src/gallium/drivers/svga/svga_pipe_flush.c +++ b/src/gallium/drivers/svga/svga_pipe_flush.c @@ -60,12 +60,12 @@ static void svga_flush( struct pipe_context *pipe, unsigned i; for (i = 0; i < fb->nr_cbufs; i++) { - util_snprintf(filename, sizeof(filename), "cbuf%u_%04u.bmp", i, frame_no); + snprintf(filename, sizeof(filename), "cbuf%u_%04u.bmp", i, frame_no); debug_dump_surface_bmp(&svga->pipe, filename, fb->cbufs[i]); } if (0 && fb->zsbuf) { - util_snprintf(filename, sizeof(filename), "zsbuf_%04u.bmp", frame_no); + snprintf(filename, sizeof(filename), "zsbuf_%04u.bmp", frame_no); debug_dump_surface_bmp(&svga->pipe, filename, fb->zsbuf); } diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index 95dde8b089751b11e0e4..31f6c0b1198d9b597159 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -99,7 +99,7 @@ svga_get_name( struct pipe_screen *pscreen ) llvm = "LLVM;"; #endif - util_snprintf(name, sizeof(name), "SVGA3D; %s %s %s", build, mutex, llvm); + snprintf(name, sizeof(name), "SVGA3D; %s %s %s", build, mutex, llvm); return name; } @@ -893,11 +893,11 @@ init_logging(struct pipe_screen *screen) char host_log[1000]; /* Log Version to Host */ - util_snprintf(host_log, sizeof(host_log) - strlen(log_prefix), + snprintf(host_log, sizeof(host_log) - strlen(log_prefix), "%s%s", log_prefix, svga_get_name(screen)); svga_host_log(host_log); - util_snprintf(host_log, sizeof(host_log) - strlen(log_prefix), + snprintf(host_log, sizeof(host_log) - strlen(log_prefix), "%s" PACKAGE_VERSION MESA_GIT_SHA1, log_prefix); svga_host_log(host_log); @@ -907,7 +907,7 @@ init_logging(struct pipe_screen *screen) if (debug_get_bool_option("SVGA_EXTRA_LOGGING", FALSE)) { char cmdline[1000]; if (os_get_command_line(cmdline, sizeof(cmdline))) { - util_snprintf(host_log, sizeof(host_log) - strlen(log_prefix), + snprintf(host_log, sizeof(host_log) - strlen(log_prefix), "%s%s", log_prefix, cmdline); svga_host_log(host_log); } diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp index de9008ddf6afa3e82584..f025578218bbf337540d 100644 --- a/src/gallium/drivers/swr/swr_screen.cpp +++ b/src/gallium/drivers/swr/swr_screen.cpp @@ -68,7 +68,7 @@ static const char * swr_get_name(struct pipe_screen *screen) { static char buf[100]; - util_snprintf(buf, sizeof(buf), "SWR (LLVM %u.%u, %u bits)", + snprintf(buf, sizeof(buf), "SWR (LLVM %u.%u, %u bits)", HAVE_LLVM >> 8, HAVE_LLVM & 0xff, lp_native_vector_width ); return buf; diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index ee35e013329005671391..d63cd28293ee5cfa244e 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -1136,10 +1136,10 @@ void anv_GetPhysicalDeviceProperties2( (VkPhysicalDeviceDriverPropertiesKHR *) ext; driver_props->driverID = VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA_KHR; - util_snprintf(driver_props->driverName, VK_MAX_DRIVER_NAME_SIZE_KHR, + snprintf(driver_props->driverName, VK_MAX_DRIVER_NAME_SIZE_KHR, "Intel open-source Mesa driver"); - util_snprintf(driver_props->driverInfo, VK_MAX_DRIVER_INFO_SIZE_KHR, + snprintf(driver_props->driverInfo, VK_MAX_DRIVER_INFO_SIZE_KHR, "Mesa " PACKAGE_VERSION MESA_GIT_SHA1); driver_props->conformanceVersion = (VkConformanceVersionKHR) { diff --git a/src/util/u_debug.c b/src/util/u_debug.c index adf62ae9b4a6153c2a2c..9e547f508ca3bbc80653 100644 --- a/src/util/u_debug.c +++ b/src/util/u_debug.c @@ -330,7 +330,7 @@ debug_dump_enum(const struct debug_named_value *names, ++names; } - util_snprintf(rest, sizeof(rest), "0x%08lx", value); + snprintf(rest, sizeof(rest), "0x%08lx", value); return rest; } @@ -354,7 +354,7 @@ debug_dump_enum_noprefix(const struct debug_named_value *names, ++names; } - util_snprintf(rest, sizeof(rest), "0x%08lx", value); + snprintf(rest, sizeof(rest), "0x%08lx", value); return rest; } @@ -387,7 +387,7 @@ debug_dump_flags(const struct debug_named_value *names, unsigned long value) else first = 0; - util_snprintf(rest, sizeof(rest), "0x%08lx", value); + snprintf(rest, sizeof(rest), "0x%08lx", value); strncat(output, rest, sizeof(output) - strlen(output) - 1); output[sizeof(output) - 1] = '\0'; } diff --git a/src/util/u_queue.c b/src/util/u_queue.c index 3812c824b6dab14a8586..d18bc7e4077e608a0de9 100644 --- a/src/util/u_queue.c +++ b/src/util/u_queue.c @@ -255,7 +255,7 @@ util_queue_thread_func(void *input) if (strlen(queue->name) > 0) { char name[16]; - util_snprintf(name, sizeof(name), "%s%i", queue->name, thread_index); + snprintf(name, sizeof(name), "%s%i", queue->name, thread_index); u_thread_setname(name); } @@ -336,10 +336,10 @@ util_queue_init(struct util_queue *queue, memset(queue, 0, sizeof(*queue)); if (process_len) { - util_snprintf(queue->name, sizeof(queue->name), "%.*s:%s", + snprintf(queue->name, sizeof(queue->name), "%.*s:%s", process_len, process_name, name); } else { - util_snprintf(queue->name, sizeof(queue->name), "%s", name); + snprintf(queue->name, sizeof(queue->name), "%s", name); } queue->flags = flags; diff --git a/src/util/u_string.h b/src/util/u_string.h index 3e4807aaba0e29708ecd..f51361d725985ffeb9ae 100644 --- a/src/util/u_string.h +++ b/src/util/u_string.h @@ -82,6 +82,7 @@ util_vsnprintf(char *str, size_t size, const char *format, va_list ap) return ret; } +#define snprintf util_snprintf static inline int PRINTFLIKE(3, 4) util_snprintf(char *str, size_t size, const char *format, ...) @@ -214,7 +215,6 @@ util_strstr(const char *haystack, const char *needle) #else #define util_vsnprintf vsnprintf -#define util_snprintf snprintf #endif -- Cheers, Eric _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev