Minor tweak

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17335 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2003-07-25 05:31:52 +00:00
parent 5434cb4393
commit e8fb1797f9
2 changed files with 12 additions and 4 deletions

View file

@ -3,6 +3,7 @@
* Source/NSDistributedNotificationCenter.m: Partially reverted last * Source/NSDistributedNotificationCenter.m: Partially reverted last
change ... seemed to cause problems on some systems. change ... seemed to cause problems on some systems.
* Tools/gdnc.m: ditto. * Tools/gdnc.m: ditto.
* Source/NSDebug.m: Small thread safely fix.
2003-07-23 Richard Frith-Macdonald <rfm@gnu.org> 2003-07-23 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -28,6 +28,7 @@
#include "config.h" #include "config.h"
#include <stdio.h> #include <stdio.h>
#include "Foundation/NSData.h"
#include "Foundation/NSDebug.h" #include "Foundation/NSDebug.h"
#include "Foundation/NSString.h" #include "Foundation/NSString.h"
#include "Foundation/NSLock.h" #include "Foundation/NSLock.h"
@ -423,7 +424,9 @@ GSDebugAllocationClassList()
const char* const char*
GSDebugAllocationList(BOOL changeFlag) GSDebugAllocationList(BOOL changeFlag)
{ {
const char *ans; const char *ans;
NSData *d;
if (debug_allocation == NO) if (debug_allocation == NO)
{ {
return "Debug allocation system is not active!\n"; return "Debug allocation system is not active!\n";
@ -431,9 +434,10 @@ GSDebugAllocationList(BOOL changeFlag)
if (uniqueLock != nil) if (uniqueLock != nil)
[uniqueLock lock]; [uniqueLock lock];
ans = _GSDebugAllocationList(changeFlag); ans = _GSDebugAllocationList(changeFlag);
d = [NSData dataWithBytes: ans length: strlen(ans) + 1];
if (uniqueLock != nil) if (uniqueLock != nil)
[uniqueLock unlock]; [uniqueLock unlock];
return ans; return (const char*)[d bytes];
} }
static const char* static const char*
@ -520,7 +524,9 @@ _GSDebugAllocationList(BOOL difference)
const char* const char*
GSDebugAllocationListAll() GSDebugAllocationListAll()
{ {
const char *ans; const char *ans;
NSData *d;
if (debug_allocation == NO) if (debug_allocation == NO)
{ {
return "Debug allocation system is not active!\n"; return "Debug allocation system is not active!\n";
@ -528,9 +534,10 @@ GSDebugAllocationListAll()
if (uniqueLock != nil) if (uniqueLock != nil)
[uniqueLock lock]; [uniqueLock lock];
ans = _GSDebugAllocationListAll(); ans = _GSDebugAllocationListAll();
d = [NSData dataWithBytes: ans length: strlen(ans)+1];
if (uniqueLock != nil) if (uniqueLock != nil)
[uniqueLock unlock]; [uniqueLock unlock];
return ans; return (const char*)[d bytes];
} }
static const char* static const char*