standards‑compliant thread id string

This commit is contained in:
Cristy
2026-02-14 22:00:21 -05:00
parent d72e8680d6
commit efd91b90c2
2 changed files with 24 additions and 7 deletions
+24
View File
@@ -85,6 +85,30 @@ static inline MagickThreadType GetMagickThreadId(void)
#endif
}
static inline void DecorateFilenameWithThreadId(const char *filename,
char *thread_filename)
{
MagickThreadType
id;
char
thread_id[2*sizeof(id)+1];
ssize_t
i;
unsigned char
bytes[sizeof(id)];
id=GetMagickThreadId();
(void) memcpy(bytes,&id,sizeof(id));
for (i=0; i < (ssize_t) sizeof(bytes); i++)
(void) sprintf(thread_id+2*i,"%02x",bytes[i]);
thread_id[sizeof(thread_id)-1]='\0';
(void) FormatLocaleString(thread_filename,MagickPathExtent,"%s|%s",thread_id,
filename);
}
static inline size_t GetMagickThreadSignature(void)
{
#if defined(MAGICKCORE_THREAD_SUPPORT)
-7
View File
@@ -36,13 +36,6 @@ extern ModuleExport size_t \
extern ModuleExport void \
Unregister ## coder ## Image(void);
static inline void DecorateFilenameWithThreadId(const char *filename,
char *thread_filename)
{
(void) FormatLocaleString(thread_filename,MagickPathExtent,"%.20g|%s",
(double) GetMagickThreadId(),filename);
}
static inline ImageType IdentifyImageCoderType(const Image *image,
ExceptionInfo *exception)
{