From bdeb855b30dfe7f6e695cba98445a7ba09e6416e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Gallou=C3=ABt?= Date: Wed, 30 Sep 2026 15:14:45 +0200 Subject: [PATCH] ggml-et : remove useless alloca() (#29663) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adrien Gallouët --- ggml/src/ggml-et/ggml-et.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ggml/src/ggml-et/ggml-et.cpp b/ggml/src/ggml-et/ggml-et.cpp index 61c31d6f29..755077fad5 100644 --- a/ggml/src/ggml-et/ggml-et.cpp +++ b/ggml/src/ggml-et/ggml-et.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #if __has_include() @@ -32,9 +33,7 @@ namespace fs = std::experimental::filesystem; * @brief prints the metadata of a single tensorf */ static void ggml_et_dump_tensor_metadata(const ggml_tensor * ggtensor, size_t indent_level, const char * title) { - char * spaces = (char *) alloca(indent_level + 1); - memset(spaces, ' ', indent_level); - spaces[indent_level] = '\0'; + std::string spaces(indent_level, ' '); fprintf(stderr, "%s%s: %s\n" "%s type: %s\n" @@ -43,10 +42,10 @@ static void ggml_et_dump_tensor_metadata(const ggml_tensor * ggtensor, size_t in "%s op: %s\n" "%s data: %p\n" "%s src0: %p\n", - spaces, title, ggtensor->name, spaces, ggml_type_name(ggtensor->type), spaces, (long long) ggtensor->ne[0], - (long long) ggtensor->ne[1], (long long) ggtensor->ne[2], (long long) ggtensor->ne[3], spaces, - ggtensor->nb[0], ggtensor->nb[1], ggtensor->nb[2], ggtensor->nb[3], spaces, ggml_op_name(ggtensor->op), - spaces, ggtensor->data, spaces, (void *) ggtensor->src[0]); + spaces.c_str(), title, ggtensor->name, spaces.c_str(), ggml_type_name(ggtensor->type), spaces.c_str(), (long long) ggtensor->ne[0], + (long long) ggtensor->ne[1], (long long) ggtensor->ne[2], (long long) ggtensor->ne[3], spaces.c_str(), + ggtensor->nb[0], ggtensor->nb[1], ggtensor->nb[2], ggtensor->nb[3], spaces.c_str(), ggml_op_name(ggtensor->op), + spaces.c_str(), ggtensor->data, spaces.c_str(), (void *) ggtensor->src[0]); } /*