Bugzilla bug #39942: additional tweaks related to the thread-private

error string buffer.
Modified files: prerror.c, prcthr.c, pruthr.c
This commit is contained in:
wtc%netscape.com 2000-08-10 00:34:11 +00:00
parent 5fb749ab79
commit d961ab7c89
3 changed files with 5 additions and 3 deletions

View File

@ -65,7 +65,7 @@ PR_IMPLEMENT(void) PR_SetErrorText(PRIntn textLength, const char *text)
{
if (NULL != thread->errorString)
PR_DELETE(thread->errorString);
thread->errorStringSize = 0;
thread->errorStringSize = 0;
}
else
{
@ -82,9 +82,9 @@ PR_IMPLEMENT(void) PR_SetErrorText(PRIntn textLength, const char *text)
}
thread->errorStringSize = size;
}
thread->errorStringLength = textLength;
memcpy(thread->errorString, text, textLength+1 );
}
thread->errorStringLength = textLength;
}
PR_IMPLEMENT(PRInt32) PR_GetErrorTextLength(void)
@ -96,7 +96,7 @@ PR_IMPLEMENT(PRInt32) PR_GetErrorTextLength(void)
PR_IMPLEMENT(PRInt32) PR_GetErrorText(char *text)
{
PRThread *thread = PR_GetCurrentThread();
if (0 != thread->errorStringSize)
if (0 != thread->errorStringLength)
memcpy(text, thread->errorString, thread->errorStringLength+1);
return thread->errorStringLength;
} /* PR_GetErrorText */

View File

@ -258,6 +258,7 @@ static void _PR_InitializeRecycledThread(PRThread *thread)
#endif
PR_ASSERT(thread->dumpArg == 0 && thread->dump == 0);
PR_ASSERT(thread->errorString == 0 && thread->errorStringSize == 0);
PR_ASSERT(thread->errorStringLength == 0);
/* Reset data members in thread structure */
thread->errorCode = thread->osErrorCode = 0;

View File

@ -68,6 +68,7 @@ void _PR_CleanupThread(PRThread *thread)
PR_DELETE(thread->errorString);
thread->errorStringSize = 0;
thread->errorStringLength = 0;
thread->environment = NULL;
}