Improve initialisation

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@24741 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2007-03-01 17:35:43 +00:00
parent a62325a01f
commit ea4a13d07c
12 changed files with 31 additions and 18 deletions

View file

@ -1,3 +1,19 @@
2007-02-29 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSZone.m: tidy indentation
* Source/NSURLCredential.m:
* Source/NSURLAuthenticationChallenge.m:
* Source/NSURLCredentialStorage.m:
* Source/NSURLResponse.m:
* Source/NSURLProtocol.m:
* Source/NSURLCache.m:
* Source/NSHTTPCookieStorage.m:
* Source/NSHTTPCookie.m:
* Source/NSURLProtectionSpace.m:
* Source/NSURLRequest.m:
Use standard function to initialise and clear memory, fixing some
potential uninitialised memory errors.
2007-02-29 Richard Frith-Macdonald <rfm@gnu.org>
* configure.ac: Restorelast reversion and fix actual bug (I hope)

View file

@ -58,7 +58,7 @@ typedef struct {
if (o != nil)
{
o->_NSHTTPCookieInternal = NSZoneMalloc(z, sizeof(Internal));
o->_NSHTTPCookieInternal = NSZoneCalloc(z, 1, sizeof(Internal));
}
return o;
}

View file

@ -68,7 +68,7 @@ static NSHTTPCookieStorage *storage = nil;
o = (NSHTTPCookieStorage*)
NSAllocateObject(self, 0, NSDefaultMallocZone());
o->_NSHTTPCookieStorageInternal = (Internal*)
NSZoneMalloc(NSDefaultMallocZone(), sizeof(Internal));
NSZoneCalloc(NSDefaultMallocZone(), 1, sizeof(Internal));
inst->_policy = NSHTTPCookieAcceptPolicyAlways;
inst->_cookies = [NSMutableSet new];
storage = o;

View file

@ -46,7 +46,7 @@ typedef struct {
if (o != nil)
{
o->_NSURLAuthenticationChallengeInternal
= NSZoneMalloc(z, sizeof(Internal));
= NSZoneCalloc(z, 1, sizeof(Internal));
}
return o;
}

View file

@ -51,8 +51,7 @@ static NSURLCache *shared = nil;
if (o != nil)
{
o->_NSURLCacheInternal = NSZoneMalloc(z, sizeof(Internal));
memset(o->_NSURLCacheInternal, '\0', sizeof(Internal));
o->_NSURLCacheInternal = NSZoneCalloc(z, 1, sizeof(Internal));
}
return o;
}

View file

@ -42,7 +42,7 @@ typedef struct {
if (o != nil)
{
o->_NSURLCredentialInternal = NSZoneMalloc(z, sizeof(Internal));
o->_NSURLCredentialInternal = NSZoneCalloc(z, 1, sizeof(Internal));
}
return o;
}

View file

@ -56,7 +56,7 @@ static NSURLCredentialStorage *storage = nil;
o = (NSURLCredentialStorage*)
NSAllocateObject(self, 0, NSDefaultMallocZone());
o->_NSURLCredentialStorageInternal = (Internal*)
NSZoneMalloc(NSDefaultMallocZone(), sizeof(Internal));
NSZoneCalloc(NSDefaultMallocZone(), 1, sizeof(Internal));
((Internal*)(o->_NSURLCredentialStorageInternal))->credentials
= [NSMutableDictionary new];
((Internal*)(o->_NSURLCredentialStorageInternal))->defaults

View file

@ -62,7 +62,7 @@ typedef struct {
if (o != nil)
{
o->_NSURLProtectionSpaceInternal = NSZoneMalloc(z, sizeof(Internal));
o->_NSURLProtectionSpaceInternal = NSZoneCalloc(z, 1, sizeof(Internal));
}
return o;
}

View file

@ -51,7 +51,7 @@ static NSLock *regLock = nil;
if (o != nil)
{
o->_NSURLProtocolInternal = NSZoneMalloc(z, sizeof(Internal));
o->_NSURLProtocolInternal = NSZoneCalloc(z, 1, sizeof(Internal));
}
return o;
}

View file

@ -60,8 +60,7 @@ typedef struct {
if (o != nil)
{
o->_NSURLRequestInternal = NSZoneMalloc(z, sizeof(Internal));
memset(o->_NSURLRequestInternal, '\0', sizeof(Internal));
o->_NSURLRequestInternal = NSZoneCalloc(z, 1, sizeof(Internal));
}
return o;
}

View file

@ -126,8 +126,7 @@ static const NSMapTableKeyCallBacks headerKeyCallBacks =
if (o != nil)
{
o->_NSURLResponseInternal = NSZoneMalloc(z, sizeof(Internal));
memset(o->_NSURLResponseInternal, '\0', sizeof(Internal));
o->_NSURLResponseInternal = NSZoneCalloc(z, 1, sizeof(Internal));
}
return o;
}

View file

@ -1703,12 +1703,12 @@ NSCreateZone (size_t start, size_t gran, BOOL canFree)
newZone = (NSZone*)zone;
}
[gnustep_global_lock lock];
newZone->next = zone_list;
zone_list = newZone;
[gnustep_global_lock unlock];
[gnustep_global_lock lock];
newZone->next = zone_list;
zone_list = newZone;
[gnustep_global_lock unlock];
return newZone;
return newZone;
}
/**