Commit 12229aee authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Change the way how localtime/gmtime buffer is stored in __thread_data.

parent e15ac98c
......@@ -73,6 +73,7 @@ static inline void msvcrt_free_tls_mem(void)
HeapFree(GetProcessHeap(),0,tls->wasctime_buffer);
HeapFree(GetProcessHeap(),0,tls->strerror_buffer);
HeapFree(GetProcessHeap(),0,tls->wcserror_buffer);
HeapFree(GetProcessHeap(),0,tls->time_buffer);
free_locinfo(tls->locinfo);
free_mbcinfo(tls->mbcinfo);
}
......
......@@ -172,7 +172,7 @@ struct __thread_data {
void *unk2[4];
char *asctime_buffer; /* buffer for asctime */
MSVCRT_wchar_t *wasctime_buffer; /* buffer for wasctime */
struct MSVCRT_tm time_buffer; /* buffer for localtime/gmtime */
struct MSVCRT_tm *time_buffer; /* buffer for localtime/gmtime */
char *efcvt_buffer; /* buffer for ecvt/fcvt */
int unk3[2];
void *unk4[4];
......
......@@ -212,10 +212,13 @@ struct MSVCRT_tm* CDECL MSVCRT__localtime64(const MSVCRT___time64_t* secs)
}
data = msvcrt_get_thread_data();
unix_tm_to_msvcrt( &data->time_buffer, tm );
if(!data->time_buffer)
data->time_buffer = MSVCRT_malloc(sizeof(struct MSVCRT_tm));
unix_tm_to_msvcrt( data->time_buffer, tm );
_munlock(_TIME_LOCK);
return &data->time_buffer;
return data->time_buffer;
}
/*********************************************************************
......@@ -344,9 +347,12 @@ struct MSVCRT_tm* CDECL MSVCRT__gmtime64(const MSVCRT___time64_t *secs)
{
thread_data_t * const data = msvcrt_get_thread_data();
if(MSVCRT__gmtime64_s(&data->time_buffer, secs))
if(!data->time_buffer)
data->time_buffer = MSVCRT_malloc(sizeof(struct MSVCRT_tm));
if(MSVCRT__gmtime64_s(data->time_buffer, secs))
return NULL;
return &data->time_buffer;
return data->time_buffer;
}
/*********************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment