From 231355baec6487e92111ebec0d0468a65f0c22ea Mon Sep 17 00:00:00 2001 From: Steffen Winter Date: Mon, 22 Dec 2025 15:32:48 +0100 Subject: [PATCH] fix: remove unused asprintf implementation function --- src/linux/intel_gpu_top/intel_gpu_top.c | 35 +------------------------ 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/src/linux/intel_gpu_top/intel_gpu_top.c b/src/linux/intel_gpu_top/intel_gpu_top.c index 09504b8..e466c5f 100644 --- a/src/linux/intel_gpu_top/intel_gpu_top.c +++ b/src/linux/intel_gpu_top/intel_gpu_top.c @@ -50,39 +50,6 @@ #include "i915_drm.h" #include "igt_perf.h" -#ifdef __clang__ //? Workaround for missing asprintf when compiling with clang, taken from https://stackoverflow.com/a/4899487 -int asprintf(char **ret, const char *format, ...) -{ - va_list ap; - - *ret = NULL; /* Ensure value can be passed to free() */ - - va_start(ap, format); - int count = vsnprintf(NULL, 0, format, ap); - va_end(ap); - - if (count >= 0) - { - char* buffer = malloc(count + 1); - if (buffer == NULL) - return -1; - - va_start(ap, format); - count = vsnprintf(buffer, count + 1, format, ap); - va_end(ap); - - if (count < 0) - { - free(buffer); - return count; - } - *ret = buffer; - } - - return count; -} -#endif - __attribute__((format(scanf,3,4))) static int igt_sysfs_scanf(int dir, const char *attr, const char *fmt, ...) { @@ -694,4 +661,4 @@ void pmu_sample(struct engines *engines) update_sample(&engines->imc_reads, val); update_sample(&engines->imc_writes, val); } -} \ No newline at end of file +}