On 8/30/25 04:03, Daniel P. Berrangé wrote:
+#ifndef PTHREAD_MAX_NAMELEN_NP
+#define PTHREAD_MAX_NAMELEN_NP 16
+#endif
+
+static __thread char namebuf[PTHREAD_MAX_NAMELEN_NP];

If you're going to have this...

+static __thread char namebuf[64];

... or this, why not just remember the name from when we set it?

You could even store a pointer instead of a larger number of characters. I'll note that all of the names we actually pass to qemu_thread_create are string literals, and that we don't actually need to do any memory allocation at all with them.


+    name = g_utf16_to_utf8(namew, -1, NULL, NULL, NULL);
+    LocalFree(namew);
+    if (!name) {
+        goto error;
+    }

That would certainly avoid this kind of hassle.



Reply via email to