a little bit of thread-safety/re-entrancy safety added

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2327 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas
2000-05-15 05:54:11 +00:00
parent 66af6ed055
commit 071fd8da55
2 changed files with 6 additions and 6 deletions

View File

@@ -434,11 +434,12 @@ decode_md5_string(const char *string, unsigned char *data)
const char *
guid_to_string(const GUID * guid)
{
static char string[33];
char *string = malloc(GUID_ENCODING_LENGTH+1);
if (!string) return NULL;
encode_md5_data(guid->data, string);
string[32] = '\0';
string[GUID_ENCODING_LENGTH] = '\0';
return string;
}

View File

@@ -70,10 +70,9 @@ void guid_new(GUID *guid);
/* Return a null-terminated string encoding of the id. String
* encodings of identifiers are hex numbers printed only with the
* characters '0' through '9' and 'a' through 'f'. The encoding will
* always be 32 characters long. The returned string should not be
* modified. A subsequent call to guid_to_string() will overwrite
* the result of a previous call. hack alert -- this means that
* this routine is *not* thread safe! ... needs fixing. */
* always be 32 characters long. The returned string should be
* freed when no longer needed.
*/
const char * guid_to_string(const GUID * guid);