mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Replace assert with NSAssert
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3248 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5a2bd37c96
commit
a3751eb7bf
31 changed files with 182 additions and 199 deletions
|
@ -24,7 +24,6 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <gnustep/base/preface.h>
|
#include <gnustep/base/preface.h>
|
||||||
#include <gnustep/base/Archiver.h>
|
#include <gnustep/base/Archiver.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
/* Eventually some functionality may be moved out of Encoder and
|
/* Eventually some functionality may be moved out of Encoder and
|
||||||
Decoder and into these objects.
|
Decoder and into these objects.
|
||||||
|
|
|
@ -154,7 +154,7 @@ static id nilBinaryTreeNode;
|
||||||
id tmp;
|
id tmp;
|
||||||
|
|
||||||
/* Make sure we actually own the anObject. */
|
/* Make sure we actually own the anObject. */
|
||||||
assert ([anObject binaryTree] == self);
|
NSAssert([anObject binaryTree] == self, NSInternalInconsistencyException);
|
||||||
|
|
||||||
// here tmp is the right node;
|
// here tmp is the right node;
|
||||||
if ((tmp = [anObject rightNode]) != [self nilNode])
|
if ((tmp = [anObject rightNode]) != [self nilNode])
|
||||||
|
@ -179,7 +179,7 @@ static id nilBinaryTreeNode;
|
||||||
id tmp;
|
id tmp;
|
||||||
|
|
||||||
/* Make sure we actually own the anObject. */
|
/* Make sure we actually own the anObject. */
|
||||||
assert ([anObject binaryTree] == self);
|
NSAssert([anObject binaryTree] == self, NSInternalInconsistencyException);
|
||||||
|
|
||||||
// here tmp is the left node;
|
// here tmp is the left node;
|
||||||
if ((tmp = [anObject leftNode]) != [self nilNode])
|
if ((tmp = [anObject leftNode]) != [self nilNode])
|
||||||
|
@ -202,7 +202,7 @@ static id nilBinaryTreeNode;
|
||||||
id parentNode;
|
id parentNode;
|
||||||
|
|
||||||
/* Make sure we actually own the aNode. */
|
/* Make sure we actually own the aNode. */
|
||||||
assert ([aNode binaryTree] == self);
|
NSAssert([aNode binaryTree] == self, NSInternalInconsistencyException);
|
||||||
|
|
||||||
while ((parentNode = [aNode parentNode]) != [self nilNode])
|
while ((parentNode = [aNode parentNode]) != [self nilNode])
|
||||||
aNode = parentNode;
|
aNode = parentNode;
|
||||||
|
@ -215,7 +215,7 @@ static id nilBinaryTreeNode;
|
||||||
unsigned count = 0;
|
unsigned count = 0;
|
||||||
|
|
||||||
/* Make sure we actually own the aNode. */
|
/* Make sure we actually own the aNode. */
|
||||||
assert ([aNode binaryTree] == self);
|
NSAssert([aNode binaryTree] == self, NSInternalInconsistencyException);
|
||||||
|
|
||||||
if (aNode == nil || aNode == [self nilNode])
|
if (aNode == nil || aNode == [self nilNode])
|
||||||
[self error:"in %s, Can't find depth of nil node", sel_get_name(_cmd)];
|
[self error:"in %s, Can't find depth of nil node", sel_get_name(_cmd)];
|
||||||
|
@ -234,7 +234,7 @@ static id nilBinaryTreeNode;
|
||||||
id tmpNode;
|
id tmpNode;
|
||||||
|
|
||||||
/* Make sure we actually own the aNode. */
|
/* Make sure we actually own the aNode. */
|
||||||
assert ([aNode binaryTree] == self);
|
NSAssert([aNode binaryTree] == self, NSInternalInconsistencyException);
|
||||||
|
|
||||||
if (aNode == nil || aNode == [self nilNode])
|
if (aNode == nil || aNode == [self nilNode])
|
||||||
{
|
{
|
||||||
|
@ -262,7 +262,7 @@ static id nilBinaryTreeNode;
|
||||||
unsigned count = 0;
|
unsigned count = 0;
|
||||||
|
|
||||||
/* Make sure we actually own the aNode. */
|
/* Make sure we actually own the aNode. */
|
||||||
assert ([aNode binaryTree] == self);
|
NSAssert([aNode binaryTree] == self, NSInternalInconsistencyException);
|
||||||
|
|
||||||
if ([aNode leftNode] != [self nilNode])
|
if ([aNode leftNode] != [self nilNode])
|
||||||
count += 1 + [self nodeCountUnderNode:[aNode leftNode]];
|
count += 1 + [self nodeCountUnderNode:[aNode leftNode]];
|
||||||
|
@ -276,7 +276,7 @@ static id nilBinaryTreeNode;
|
||||||
id y;
|
id y;
|
||||||
|
|
||||||
/* Make sure we actually own the aNode. */
|
/* Make sure we actually own the aNode. */
|
||||||
assert ([aNode binaryTree] == self);
|
NSAssert([aNode binaryTree] == self, NSInternalInconsistencyException);
|
||||||
|
|
||||||
y = [aNode rightNode];
|
y = [aNode rightNode];
|
||||||
if (y == [self nilNode])
|
if (y == [self nilNode])
|
||||||
|
@ -304,7 +304,7 @@ static id nilBinaryTreeNode;
|
||||||
id y;
|
id y;
|
||||||
|
|
||||||
/* Make sure we actually own the aNode. */
|
/* Make sure we actually own the aNode. */
|
||||||
assert ([aNode binaryTree] == self);
|
NSAssert([aNode binaryTree] == self, NSInternalInconsistencyException);
|
||||||
|
|
||||||
y = [aNode leftNode];
|
y = [aNode leftNode];
|
||||||
if (y == [self nilNode])
|
if (y == [self nilNode])
|
||||||
|
@ -344,7 +344,7 @@ static id nilBinaryTreeNode;
|
||||||
id theParent, tmpChild;
|
id theParent, tmpChild;
|
||||||
|
|
||||||
/* Make sure no one else already owns the newObject. */
|
/* Make sure no one else already owns the newObject. */
|
||||||
assert ([newObject binaryTree] == NO_OBJECT);
|
NSAssert([newObject binaryTree] == NO_OBJECT, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Claim ownership of the newObject. */
|
/* Claim ownership of the newObject. */
|
||||||
[newObject retain];
|
[newObject retain];
|
||||||
|
@ -386,7 +386,7 @@ static id nilBinaryTreeNode;
|
||||||
id x, y;
|
id x, y;
|
||||||
|
|
||||||
/* Make sure we actually own the aNode. */
|
/* Make sure we actually own the aNode. */
|
||||||
assert ([oldObject binaryTree] == self);
|
NSAssert([oldObject binaryTree] == self, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Extract the oldObject and sew up the cut. */
|
/* Extract the oldObject and sew up the cut. */
|
||||||
if ([oldObject leftNode] == [self nilNode]
|
if ([oldObject leftNode] == [self nilNode]
|
||||||
|
@ -508,7 +508,7 @@ static id nilBinaryTreeNode;
|
||||||
id tmp;
|
id tmp;
|
||||||
|
|
||||||
/* Make sure no one else already owns the newObject. */
|
/* Make sure no one else already owns the newObject. */
|
||||||
assert ([newObject linkedList] == NO_OBJECT);
|
NSAssert([newObject linkedList] == NO_OBJECT, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Claim ownership of the newObject. */
|
/* Claim ownership of the newObject. */
|
||||||
[newObject retain];
|
[newObject retain];
|
||||||
|
@ -542,7 +542,7 @@ static id nilBinaryTreeNode;
|
||||||
id tmp;
|
id tmp;
|
||||||
|
|
||||||
/* Make sure no one else already owns the newObject. */
|
/* Make sure no one else already owns the newObject. */
|
||||||
assert ([newObject linkedList] == NO_OBJECT);
|
NSAssert([newObject linkedList] == NO_OBJECT, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Claim ownership of the newObject. */
|
/* Claim ownership of the newObject. */
|
||||||
[newObject retain];
|
[newObject retain];
|
||||||
|
@ -588,7 +588,7 @@ static id nilBinaryTreeNode;
|
||||||
if (_count == 0)
|
if (_count == 0)
|
||||||
{
|
{
|
||||||
/* Make sure no one else already owns the newObject. */
|
/* Make sure no one else already owns the newObject. */
|
||||||
assert ([newObject linkedList] == NO_OBJECT);
|
NSAssert([newObject linkedList] == NO_OBJECT, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Claim ownership of the newObject. */
|
/* Claim ownership of the newObject. */
|
||||||
[newObject retain];
|
[newObject retain];
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
#include <Foundation/NSHashTable.h>
|
#include <Foundation/NSHashTable.h>
|
||||||
#include <Foundation/NSCoder.h>
|
#include <Foundation/NSCoder.h>
|
||||||
#include <Foundation/NSAutoreleasePool.h>
|
#include <Foundation/NSAutoreleasePool.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* Exception strings */
|
/* Exception strings */
|
||||||
|
|
|
@ -686,7 +686,6 @@
|
||||||
array[i++] = o;
|
array[i++] = o;
|
||||||
}
|
}
|
||||||
[self freeEnumState: &es];
|
[self freeEnumState: &es];
|
||||||
assert (c == i);
|
|
||||||
for (i = 0; i < c; i++)
|
for (i = 0; i < c; i++)
|
||||||
[array[i] release];
|
[array[i] release];
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include <gnustep/base/MemoryStream.h>
|
#include <gnustep/base/MemoryStream.h>
|
||||||
#include <Foundation/NSConnection.h>
|
#include <Foundation/NSConnection.h>
|
||||||
#include <Foundation/NSProxy.h>
|
#include <Foundation/NSProxy.h>
|
||||||
#include <assert.h>
|
#include <Foundation/NSException.h>
|
||||||
|
|
||||||
#define PTR2LONG(P) (((char*)(P))-(char*)0)
|
#define PTR2LONG(P) (((char*)(P))-(char*)0)
|
||||||
#define LONG2PTR(L) (((char*)0)+(L))
|
#define LONG2PTR(L) (((char*)0)+(L))
|
||||||
|
@ -276,14 +276,14 @@ static BOOL debug_connected_coder = NO;
|
||||||
"anObj"s are Proxies! */
|
"anObj"s are Proxies! */
|
||||||
if (is_decoding)
|
if (is_decoding)
|
||||||
{
|
{
|
||||||
assert([anObj isProxy]);
|
NSAssert([anObj isProxy], NSInternalInconsistencyException);
|
||||||
assert([anObj targetForProxy] == xref);
|
NSAssert([anObj targetForProxy] == xref, NSInternalInconsistencyException);
|
||||||
/* This gets done in Proxy +newForRemote:connection:
|
/* This gets done in Proxy +newForRemote:connection:
|
||||||
[connection addProxy:anObj]; */
|
[connection addProxy:anObj]; */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(PTR2LONG(anObj) == xref);
|
NSAssert(PTR2LONG(anObj) == xref, NSInternalInconsistencyException);
|
||||||
[connection addLocalObject:anObj];
|
[connection addLocalObject:anObj];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -618,7 +618,7 @@ my_method_get_next_argument (arglist_t argframe,
|
||||||
/* xxx Perhaps we could speed things up by making this an ivar,
|
/* xxx Perhaps we could speed things up by making this an ivar,
|
||||||
and caching it. */
|
and caching it. */
|
||||||
imp = get_imp (cl, sel);
|
imp = get_imp (cl, sel);
|
||||||
assert(imp);
|
NSAssert(imp, NSInternalInconsistencyException);
|
||||||
ret = __builtin_apply((void(*)(void))imp,
|
ret = __builtin_apply((void(*)(void))imp,
|
||||||
argframe,
|
argframe,
|
||||||
types_get_size_of_stack_arguments(return_type));
|
types_get_size_of_stack_arguments(return_type));
|
||||||
|
|
|
@ -123,7 +123,7 @@
|
||||||
|
|
||||||
- (void) removeObject: oldObject
|
- (void) removeObject: oldObject
|
||||||
{
|
{
|
||||||
assert ([oldObject linkedList] == self);
|
NSAssert([oldObject linkedList] == self, NSInternalInconsistencyException);
|
||||||
if (_first_link == oldObject)
|
if (_first_link == oldObject)
|
||||||
{
|
{
|
||||||
if (_count > 1)
|
if (_count > 1)
|
||||||
|
@ -152,10 +152,10 @@
|
||||||
- (void) insertObject: newObject after: oldObject
|
- (void) insertObject: newObject after: oldObject
|
||||||
{
|
{
|
||||||
/* Make sure we actually own the oldObject. */
|
/* Make sure we actually own the oldObject. */
|
||||||
assert ([oldObject linkedList] == self);
|
NSAssert([oldObject linkedList] == self, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Make sure no one else already owns the newObject. */
|
/* Make sure no one else already owns the newObject. */
|
||||||
assert ([newObject linkedList] == NO_OBJECT);
|
NSAssert([newObject linkedList] == NO_OBJECT, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Claim ownership of the newObject. */
|
/* Claim ownership of the newObject. */
|
||||||
[newObject retain];
|
[newObject retain];
|
||||||
|
@ -185,10 +185,10 @@
|
||||||
- (void) insertObject: newObject before: oldObject
|
- (void) insertObject: newObject before: oldObject
|
||||||
{
|
{
|
||||||
/* Make sure we actually own the oldObject. */
|
/* Make sure we actually own the oldObject. */
|
||||||
assert ([oldObject linkedList] == self);
|
NSAssert([oldObject linkedList] == self, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Make sure no one else already owns the newObject. */
|
/* Make sure no one else already owns the newObject. */
|
||||||
assert ([newObject linkedList] == NO_OBJECT);
|
NSAssert([newObject linkedList] == NO_OBJECT, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Claim ownership of the newObject. */
|
/* Claim ownership of the newObject. */
|
||||||
[newObject retain];
|
[newObject retain];
|
||||||
|
@ -218,10 +218,10 @@
|
||||||
- (void) replaceObject: oldObject with: newObject
|
- (void) replaceObject: oldObject with: newObject
|
||||||
{
|
{
|
||||||
/* Make sure we actually own the oldObject. */
|
/* Make sure we actually own the oldObject. */
|
||||||
assert ([oldObject linkedList] == self);
|
NSAssert([oldObject linkedList] == self, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Make sure no one else already owns the newObject. */
|
/* Make sure no one else already owns the newObject. */
|
||||||
assert ([newObject linkedList] == NO_OBJECT);
|
NSAssert([newObject linkedList] == NO_OBJECT, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Claim ownership of the newObject. */
|
/* Claim ownership of the newObject. */
|
||||||
[newObject retain];
|
[newObject retain];
|
||||||
|
@ -248,7 +248,7 @@
|
||||||
- (void) appendObject: newObject
|
- (void) appendObject: newObject
|
||||||
{
|
{
|
||||||
/* Make sure no one else already owns the newObject. */
|
/* Make sure no one else already owns the newObject. */
|
||||||
assert ([newObject linkedList] == NO_OBJECT);
|
NSAssert([newObject linkedList] == NO_OBJECT, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Insert it. */
|
/* Insert it. */
|
||||||
if (_count == 0)
|
if (_count == 0)
|
||||||
|
@ -271,7 +271,7 @@
|
||||||
- (void) prependObject: newObject
|
- (void) prependObject: newObject
|
||||||
{
|
{
|
||||||
/* Make sure no one else already owns the newObject. */
|
/* Make sure no one else already owns the newObject. */
|
||||||
assert ([newObject linkedList] == NO_OBJECT);
|
NSAssert([newObject linkedList] == NO_OBJECT, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Insert it. */
|
/* Insert it. */
|
||||||
if (_count == 0)
|
if (_count == 0)
|
||||||
|
@ -296,7 +296,7 @@
|
||||||
CHECK_INDEX_RANGE_ERROR(index, (_count+1));
|
CHECK_INDEX_RANGE_ERROR(index, (_count+1));
|
||||||
|
|
||||||
/* Make sure no one else already owns the newObject. */
|
/* Make sure no one else already owns the newObject. */
|
||||||
assert ([newObject linkedList] == NO_OBJECT);
|
NSAssert([newObject linkedList] == NO_OBJECT, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Insert it. */
|
/* Insert it. */
|
||||||
if (_count == 0)
|
if (_count == 0)
|
||||||
|
@ -356,7 +356,7 @@
|
||||||
- successorOfObject: oldObject
|
- successorOfObject: oldObject
|
||||||
{
|
{
|
||||||
/* Make sure we actually own the oldObject. */
|
/* Make sure we actually own the oldObject. */
|
||||||
assert ([oldObject linkedList] == self);
|
NSAssert([oldObject linkedList] == self, NSInternalInconsistencyException);
|
||||||
|
|
||||||
return [oldObject nextLink];
|
return [oldObject nextLink];
|
||||||
}
|
}
|
||||||
|
@ -364,7 +364,7 @@
|
||||||
- predecessorOfObject: oldObject
|
- predecessorOfObject: oldObject
|
||||||
{
|
{
|
||||||
/* Make sure we actually own the oldObject. */
|
/* Make sure we actually own the oldObject. */
|
||||||
assert ([oldObject linkedList] == self);
|
NSAssert([oldObject linkedList] == self, NSInternalInconsistencyException);
|
||||||
|
|
||||||
return [oldObject prevLink];
|
return [oldObject prevLink];
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <gnustep/base/MachPort.h>
|
#include <gnustep/base/MachPort.h>
|
||||||
#include <Foundation/NSLock.h>
|
#include <Foundation/NSLock.h>
|
||||||
|
#include <Foundation/NSException.h>
|
||||||
#include <gnustep/base/Set.h>
|
#include <gnustep/base/Set.h>
|
||||||
|
|
||||||
#include <mach/cthreads.h>
|
#include <mach/cthreads.h>
|
||||||
|
@ -41,7 +42,7 @@ static NSLock *portDictionaryGate;
|
||||||
+ initialize
|
+ initialize
|
||||||
{
|
{
|
||||||
portDictionaryGate = [NSLock new];
|
portDictionaryGate = [NSLock new];
|
||||||
assert(sizeof(int) == sizeof(port_t));
|
NSAssert(sizeof(int) == sizeof(port_t), NSInternalInconsistencyException);
|
||||||
portDictionary = [[Dictionary alloc]
|
portDictionary = [[Dictionary alloc]
|
||||||
initWithType:@encode(id)
|
initWithType:@encode(id)
|
||||||
keyType:@encode(int)];
|
keyType:@encode(int)];
|
||||||
|
|
|
@ -87,7 +87,6 @@ push_pool_to_cache (struct autorelease_thread_vars *tv, id p)
|
||||||
static id
|
static id
|
||||||
pop_pool_from_cache (struct autorelease_thread_vars *tv)
|
pop_pool_from_cache (struct autorelease_thread_vars *tv)
|
||||||
{
|
{
|
||||||
assert (tv->pool_cache_count);
|
|
||||||
return tv->pool_cache[--(tv->pool_cache_count)];
|
return tv->pool_cache[--(tv->pool_cache_count)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +149,6 @@ pop_pool_from_cache (struct autorelease_thread_vars *tv)
|
||||||
|
|
||||||
- (void) _setChildPool: pool
|
- (void) _setChildPool: pool
|
||||||
{
|
{
|
||||||
assert (!_child);
|
|
||||||
_child = pool;
|
_child = pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
#include <Foundation/NSMapTable.h>
|
#include <Foundation/NSMapTable.h>
|
||||||
#include <Foundation/NSAutoreleasePool.h>
|
#include <Foundation/NSAutoreleasePool.h>
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#ifndef __WIN32__
|
#ifndef __WIN32__
|
||||||
|
@ -203,7 +202,7 @@ _bundle_path_for_name(NSString* path, NSString* name)
|
||||||
void
|
void
|
||||||
_bundle_load_callback(Class theClass, Category *theCategory)
|
_bundle_load_callback(Class theClass, Category *theCategory)
|
||||||
{
|
{
|
||||||
assert(_loadingBundle);
|
NSCAssert(_loadingBundle, NSInternalInconsistencyException);
|
||||||
/* Don't store categories */
|
/* Don't store categories */
|
||||||
if (!theCategory)
|
if (!theCategory)
|
||||||
[(NSMutableArray *)[_loadingBundle _bundleClasses] addObject: (id)theClass];
|
[(NSMutableArray *)[_loadingBundle _bundleClasses] addObject: (id)theClass];
|
||||||
|
@ -266,7 +265,7 @@ _bundle_load_callback(Class theClass, Category *theCategory)
|
||||||
|
|
||||||
path = [[NSProcessInfo processInfo] processName];
|
path = [[NSProcessInfo processInfo] processName];
|
||||||
output = objc_find_executable([path cString]);
|
output = objc_find_executable([path cString]);
|
||||||
assert(output);
|
NSAssert(output, NSInternalInconsistencyException);
|
||||||
path = [NSString stringWithCString: output];
|
path = [NSString stringWithCString: output];
|
||||||
OBJC_FREE(output);
|
OBJC_FREE(output);
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@
|
||||||
#include <Foundation/NSLock.h>
|
#include <Foundation/NSLock.h>
|
||||||
#include <Foundation/NSThread.h>
|
#include <Foundation/NSThread.h>
|
||||||
#include <Foundation/NSNotification.h>
|
#include <Foundation/NSNotification.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
NSString* NSConnectionReplyMode = @"NSConnectionReplyMode";
|
NSString* NSConnectionReplyMode = @"NSConnectionReplyMode";
|
||||||
|
|
||||||
|
@ -1272,7 +1271,7 @@ static int messages_received_count;
|
||||||
this is done is in this function DECODER(). IP will be nil
|
this is done is in this function DECODER(). IP will be nil
|
||||||
if mframe_build_return() never called DECODER(), i.e. when
|
if mframe_build_return() never called DECODER(), i.e. when
|
||||||
we are just returning (void).*/
|
we are just returning (void).*/
|
||||||
assert (ip == (id)-1 || ip == nil);
|
NSAssert(ip == (id)-1 || ip == nil, NSInternalInconsistencyException);
|
||||||
rep_in_count++; /* received a reply */
|
rep_in_count++; /* received a reply */
|
||||||
return retframe;
|
return retframe;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include <Foundation/NSArray.h>
|
#include <Foundation/NSArray.h>
|
||||||
#include <Foundation/NSUtilities.h>
|
#include <Foundation/NSUtilities.h>
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
@class NSSetNonCore;
|
@class NSSetNonCore;
|
||||||
@class NSMutableSetNonCore;
|
@class NSMutableSetNonCore;
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <Foundation/NSDate.h>
|
#include <Foundation/NSDate.h>
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
#include <Foundation/NSCoder.h>
|
#include <Foundation/NSCoder.h>
|
||||||
|
#include <Foundation/NSException.h>
|
||||||
#ifndef __WIN32__
|
#ifndef __WIN32__
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif /* !__WIN32__ */
|
#endif /* !__WIN32__ */
|
||||||
|
@ -74,7 +75,7 @@
|
||||||
interval += (double)tp.tv_usec / 1000000.0;
|
interval += (double)tp.tv_usec / 1000000.0;
|
||||||
|
|
||||||
/* There seems to be a problem with bad double arithmetic... */
|
/* There seems to be a problem with bad double arithmetic... */
|
||||||
assert (interval < 0);
|
NSAssert(interval < 0, NSInternalInconsistencyException);
|
||||||
|
|
||||||
return interval;
|
return interval;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -63,7 +63,7 @@ enum
|
||||||
{
|
{
|
||||||
NSDistantObject *new_proxy;
|
NSDistantObject *new_proxy;
|
||||||
|
|
||||||
assert ([aConnection isValid]);
|
NSAssert([aConnection isValid], NSInternalInconsistencyException);
|
||||||
if ((new_proxy = [aConnection localForTarget: anObject])) {
|
if ((new_proxy = [aConnection localForTarget: anObject])) {
|
||||||
return new_proxy;
|
return new_proxy;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ enum
|
||||||
{
|
{
|
||||||
NSDistantObject *new_proxy;
|
NSDistantObject *new_proxy;
|
||||||
|
|
||||||
assert ([aConnection isValid]);
|
NSAssert([aConnection isValid], NSInternalInconsistencyException);
|
||||||
if ((new_proxy = [aConnection proxyForTarget: anObject])) {
|
if ((new_proxy = [aConnection proxyForTarget: anObject])) {
|
||||||
return new_proxy;
|
return new_proxy;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ enum
|
||||||
format: @"NSDistantObject objects only encode with PortEncoder class"];
|
format: @"NSDistantObject objects only encode with PortEncoder class"];
|
||||||
|
|
||||||
encoder_connection = [aRmc connection];
|
encoder_connection = [aRmc connection];
|
||||||
assert (encoder_connection);
|
NSAssert(encoder_connection, NSInternalInconsistencyException);
|
||||||
if (![encoder_connection isValid])
|
if (![encoder_connection isValid])
|
||||||
[NSException
|
[NSException
|
||||||
raise: NSGenericException
|
raise: NSGenericException
|
||||||
|
@ -177,9 +177,9 @@ format: @"NSDistantObject objects only encode with PortEncoder class"];
|
||||||
*/
|
*/
|
||||||
NSPort *proxy_connection_out_port = [_connection sendPort];
|
NSPort *proxy_connection_out_port = [_connection sendPort];
|
||||||
|
|
||||||
assert (proxy_connection_out_port);
|
NSAssert(proxy_connection_out_port, NSInternalInconsistencyException);
|
||||||
assert ([proxy_connection_out_port isValid]);
|
NSAssert([proxy_connection_out_port isValid], NSInternalInconsistencyException);
|
||||||
assert (proxy_connection_out_port != [encoder_connection sendPort]);
|
NSAssert(proxy_connection_out_port != [encoder_connection sendPort], NSInternalInconsistencyException);
|
||||||
|
|
||||||
proxy_tag = PROXY_REMOTE_FOR_BOTH;
|
proxy_tag = PROXY_REMOTE_FOR_BOTH;
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ format: @"NSDistantObject objects only encode with PortEncoder class"];
|
||||||
{
|
{
|
||||||
NSDistantObject *new_proxy;
|
NSDistantObject *new_proxy;
|
||||||
|
|
||||||
assert ([aConnection isValid]);
|
NSAssert([aConnection isValid], NSInternalInconsistencyException);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If there already is a local proxy for this target/connection
|
* If there already is a local proxy for this target/connection
|
||||||
|
@ -268,7 +268,7 @@ format: @"NSDistantObject objects only encode with PortEncoder class"];
|
||||||
{
|
{
|
||||||
NSDistantObject *new_proxy;
|
NSDistantObject *new_proxy;
|
||||||
|
|
||||||
assert ([aConnection isValid]);
|
NSAssert([aConnection isValid], NSInternalInconsistencyException);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If there already is a proxy for this target/connection combination,
|
* If there already is a proxy for this target/connection combination,
|
||||||
|
@ -395,7 +395,7 @@ static inline BOOL class_is_kind_of (Class self, Class aClassObject)
|
||||||
format: @"NSDistantObject objects only decode with PortDecoder class"];
|
format: @"NSDistantObject objects only decode with PortDecoder class"];
|
||||||
|
|
||||||
decoder_connection = [aRmc connection];
|
decoder_connection = [aRmc connection];
|
||||||
assert (decoder_connection);
|
NSAssert(decoder_connection, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* First get the tag, so we know what values need to be decoded. */
|
/* First get the tag, so we know what values need to be decoded. */
|
||||||
[aRmc decodeValueOfCType: @encode(typeof(proxy_tag))
|
[aRmc decodeValueOfCType: @encode(typeof(proxy_tag))
|
||||||
|
@ -478,7 +478,7 @@ format: @"NSDistantObject objects only decode with PortDecoder class"];
|
||||||
[aRmc decodeObjectAt: &proxy_connection_out_port
|
[aRmc decodeObjectAt: &proxy_connection_out_port
|
||||||
withName: NULL];
|
withName: NULL];
|
||||||
|
|
||||||
assert (proxy_connection_out_port);
|
NSAssert(proxy_connection_out_port, NSInternalInconsistencyException);
|
||||||
/* xxx - if there already exists a connection for talking to the
|
/* xxx - if there already exists a connection for talking to the
|
||||||
* out port, we use that one rather than creating a new one from
|
* out port, we use that one rather than creating a new one from
|
||||||
* our listening port.
|
* our listening port.
|
||||||
|
@ -508,8 +508,8 @@ format: @"NSDistantObject objects only decode with PortDecoder class"];
|
||||||
NSLog(@"Receiving a triangle-connection proxy 0x%x "
|
NSLog(@"Receiving a triangle-connection proxy 0x%x "
|
||||||
@"connection 0x%x\n", target, (unsigned)proxy_connection);
|
@"connection 0x%x\n", target, (unsigned)proxy_connection);
|
||||||
|
|
||||||
assert (proxy_connection != decoder_connection);
|
NSAssert(proxy_connection != decoder_connection, NSInternalInconsistencyException);
|
||||||
assert ([proxy_connection isValid]);
|
NSAssert([proxy_connection isValid], NSInternalInconsistencyException);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we don't already have a proxy for the object on the
|
* If we don't already have a proxy for the object on the
|
||||||
|
|
|
@ -113,10 +113,10 @@
|
||||||
[cstream release];
|
[cstream release];
|
||||||
cstream = saved_cstream;
|
cstream = saved_cstream;
|
||||||
/* Reset ourselves, except for object_2_fref. */
|
/* Reset ourselves, except for object_2_fref. */
|
||||||
assert (!in_progress_table);
|
NSAssert(!in_progress_table, NSInternalInconsistencyException);
|
||||||
NSResetMapTable (object_2_xref);
|
NSResetMapTable (object_2_xref);
|
||||||
NSResetMapTable (const_ptr_2_xref);
|
NSResetMapTable (const_ptr_2_xref);
|
||||||
assert (fref_counter == 0);
|
NSAssert(fref_counter == 0, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Then encode everything "for real". */
|
/* Then encode everything "for real". */
|
||||||
[self encodeName: @"Root Object"];
|
[self encodeName: @"Root Object"];
|
||||||
|
|
|
@ -164,8 +164,9 @@
|
||||||
|
|
||||||
- (unichar) characterAtIndex: (unsigned int)index
|
- (unichar) characterAtIndex: (unsigned int)index
|
||||||
{
|
{
|
||||||
/* xxx raise NSException instead of assert. */
|
if (index >= [self length])
|
||||||
assert(index < [self length]);
|
[NSException raise: NSRangeException
|
||||||
|
format: @"index greater than sequence length"];
|
||||||
return _contents_chars[index];
|
return _contents_chars[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,7 @@ NSDecrementExtraRefCountWasZero (id anObject)
|
||||||
objc_mutex_unlock (retain_counts_gate);
|
objc_mutex_unlock (retain_counts_gate);
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
assert ((int)(node->value) > 0);
|
NSAssert((int)(node->value) > 0, NSInternalInconsistencyException);
|
||||||
if (!--((int)(node->value)))
|
if (!--((int)(node->value)))
|
||||||
o_map_remove_node (node);
|
o_map_remove_node (node);
|
||||||
objc_mutex_unlock (retain_counts_gate);
|
objc_mutex_unlock (retain_counts_gate);
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include <gnustep/base/MemoryStream.h>
|
#include <gnustep/base/MemoryStream.h>
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
#include <Foundation/DistributedObjects.h>
|
#include <Foundation/DistributedObjects.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#define DEFAULT_SIZE 256
|
#define DEFAULT_SIZE 256
|
||||||
|
|
||||||
|
|
|
@ -1040,7 +1040,7 @@ static int debug_run_loop = 0;
|
||||||
id saved_mode;
|
id saved_mode;
|
||||||
int num_inputs = 0;
|
int num_inputs = 0;
|
||||||
|
|
||||||
assert (mode);
|
NSAssert(mode, NSInvalidArgumentException);
|
||||||
saved_mode = _current_mode;
|
saved_mode = _current_mode;
|
||||||
_current_mode = mode;
|
_current_mode = mode;
|
||||||
|
|
||||||
|
@ -1209,14 +1209,14 @@ static int debug_run_loop = 0;
|
||||||
if (FD_ISSET (fd_index, &write_fds))
|
if (FD_ISSET (fd_index, &write_fds))
|
||||||
{
|
{
|
||||||
id watcher = (id) NSMapGet (wfd_2_object, (void*)fd_index);
|
id watcher = (id) NSMapGet (wfd_2_object, (void*)fd_index);
|
||||||
assert (watcher);
|
NSAssert(watcher, NSInternalInconsistencyException);
|
||||||
[watcher eventFor:(void*)fd_index mode:_current_mode];
|
[watcher eventFor:(void*)fd_index mode:_current_mode];
|
||||||
[NSNotificationQueue runLoopASAP];
|
[NSNotificationQueue runLoopASAP];
|
||||||
}
|
}
|
||||||
if (FD_ISSET (fd_index, &read_fds))
|
if (FD_ISSET (fd_index, &read_fds))
|
||||||
{
|
{
|
||||||
id watcher = (id) NSMapGet (rfd_2_object, (void*)fd_index);
|
id watcher = (id) NSMapGet (rfd_2_object, (void*)fd_index);
|
||||||
assert (watcher);
|
NSAssert(watcher, NSInternalInconsistencyException);
|
||||||
[watcher eventFor:(void*)fd_index mode:_current_mode];
|
[watcher eventFor:(void*)fd_index mode:_current_mode];
|
||||||
[NSNotificationQueue runLoopASAP];
|
[NSNotificationQueue runLoopASAP];
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <Foundation/NSArray.h>
|
#include <Foundation/NSArray.h>
|
||||||
#include <Foundation/NSUtilities.h>
|
#include <Foundation/NSUtilities.h>
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
#include <assert.h>
|
#include <Foundation/NSException.h>
|
||||||
|
|
||||||
@interface NSSetNonCore : NSSet
|
@interface NSSetNonCore : NSSet
|
||||||
@end
|
@end
|
||||||
|
@ -305,9 +305,7 @@ static Class NSMutableSet_concrete_class;
|
||||||
for (i = 0; i < c; i++)
|
for (i = 0; i < c; i++)
|
||||||
{
|
{
|
||||||
k[i] = [e nextObject];
|
k[i] = [e nextObject];
|
||||||
assert(k[i]);
|
|
||||||
}
|
}
|
||||||
assert(![e nextObject]);
|
|
||||||
return [[[NSArray alloc] initWithObjects:k count:c]
|
return [[[NSArray alloc] initWithObjects:k count:c]
|
||||||
autorelease];
|
autorelease];
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <Foundation/NSDate.h>
|
#include <Foundation/NSDate.h>
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
#include <Foundation/NSRunLoop.h>
|
#include <Foundation/NSRunLoop.h>
|
||||||
#include <gnustep/base/Invocation.h>
|
#include <Foundation/NSInvocation.h>
|
||||||
|
|
||||||
@implementation NSTimer
|
@implementation NSTimer
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@
|
||||||
{
|
{
|
||||||
NSTimeInterval ti = [_fire_date timeIntervalSinceReferenceDate];
|
NSTimeInterval ti = [_fire_date timeIntervalSinceReferenceDate];
|
||||||
NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];
|
NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];
|
||||||
assert (now < 0.0);
|
NSAssert(now < 0.0, NSInternalInconsistencyException);
|
||||||
while (ti < now) // xxx remove this
|
while (ti < now) // xxx remove this
|
||||||
ti += _interval;
|
ti += _interval;
|
||||||
[_fire_date release];
|
[_fire_date release];
|
||||||
|
@ -131,7 +131,7 @@
|
||||||
|
|
||||||
- (void) invalidate
|
- (void) invalidate
|
||||||
{
|
{
|
||||||
assert (_is_valid);
|
NSAssert(_is_valid, NSInternalInconsistencyException);
|
||||||
_is_valid = NO;
|
_is_valid = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
126
Source/NSZone.m
126
Source/NSZone.m
|
@ -76,14 +76,12 @@
|
||||||
tested them extensively in multithreaded cases. */
|
tested them extensively in multithreaded cases. */
|
||||||
|
|
||||||
|
|
||||||
/* Define to turn off assertions. */
|
/* Define to turn off NSAssertions. */
|
||||||
#define NDEBUG 1
|
#define NS_BLOCK_ASSERTIONS 1
|
||||||
//#define DEBUG 1
|
|
||||||
|
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <gnustep/base/preface.h>
|
#include <gnustep/base/preface.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <objc/objc-api.h>
|
#include <objc/objc-api.h>
|
||||||
|
@ -288,8 +286,8 @@ chunkNext(ff_block *ptr)
|
||||||
static inline void
|
static inline void
|
||||||
chunkMakeLink(ff_block *ptr)
|
chunkMakeLink(ff_block *ptr)
|
||||||
{
|
{
|
||||||
assert(!chunkIsInUse(ptr));
|
NSAssert(!chunkIsInUse(ptr), NSInternalInconsistencyException);
|
||||||
assert(!chunkIsLive(ptr));
|
NSAssert(!chunkIsLive(ptr), NSInternalInconsistencyException);
|
||||||
(&(chunkNext(ptr)->size))[-1] = chunkSize(ptr);
|
(&(chunkNext(ptr)->size))[-1] = chunkSize(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,8 +297,8 @@ chunkChop(ff_block *ptr, size_t size)
|
||||||
ff_block *remainder;
|
ff_block *remainder;
|
||||||
size_t left = chunkSize(ptr)-size;
|
size_t left = chunkSize(ptr)-size;
|
||||||
|
|
||||||
assert((chunkSize(ptr) % MINCHUNK) == 0);
|
NSAssert((chunkSize(ptr) % MINCHUNK) == 0, NSInternalInconsistencyException);
|
||||||
assert(chunkSize(ptr) > size);
|
NSAssert(chunkSize(ptr) > size, NSInternalInconsistencyException);
|
||||||
remainder = (ff_block*)((void*)ptr+size);
|
remainder = (ff_block*)((void*)ptr+size);
|
||||||
chunkSetSize(remainder, left | PREVUSE);
|
chunkSetSize(remainder, left | PREVUSE);
|
||||||
chunkMakeLink(remainder);
|
chunkMakeLink(remainder);
|
||||||
|
@ -314,12 +312,12 @@ chunkPrev(ff_block *ptr)
|
||||||
size_t offset;
|
size_t offset;
|
||||||
ff_block *prev;
|
ff_block *prev;
|
||||||
|
|
||||||
assert(!chunkIsPrevInUse(ptr));
|
NSAssert(!chunkIsPrevInUse(ptr), NSInternalInconsistencyException);
|
||||||
offset = (&(ptr->size))[-1];
|
offset = (&(ptr->size))[-1];
|
||||||
assert(offset > 0 && (offset % MINCHUNK) == 0);
|
NSAssert(offset > 0 && (offset % MINCHUNK) == 0, NSInternalInconsistencyException);
|
||||||
prev = (ff_block*)((void*)ptr-offset);
|
prev = (ff_block*)((void*)ptr-offset);
|
||||||
assert(chunkSize(prev) == offset);
|
NSAssert(chunkSize(prev) == offset, NSInternalInconsistencyException);
|
||||||
assert(!chunkIsInUse(prev));
|
NSAssert(!chunkIsInUse(prev), NSInternalInconsistencyException);
|
||||||
return prev;
|
return prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,8 +540,8 @@ fmalloc (NSZone *zone, size_t size)
|
||||||
size_buf[i] = size_buf[bufsize];
|
size_buf[i] = size_buf[bufsize];
|
||||||
ptr_buf[i] = ptr_buf[bufsize];
|
ptr_buf[i] = ptr_buf[bufsize];
|
||||||
|
|
||||||
assert(chunkIsInUse(chunkhead));
|
NSAssert(chunkIsInUse(chunkhead), NSInternalInconsistencyException);
|
||||||
assert((chunkSize(chunkhead) % MINCHUNK) == 0);
|
NSAssert((chunkSize(chunkhead) % MINCHUNK) == 0, NSInternalInconsistencyException);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -574,9 +572,9 @@ fmalloc (NSZone *zone, size_t size)
|
||||||
format: @"Out of memory"];
|
format: @"Out of memory"];
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(chunkIsInUse(chunkhead));
|
NSAssert(chunkIsInUse(chunkhead), NSInternalInconsistencyException);
|
||||||
assert(chunkIsPrevInUse(chunkNext(chunkhead)));
|
NSAssert(chunkIsPrevInUse(chunkNext(chunkhead)), NSInternalInconsistencyException);
|
||||||
assert((chunkSize(chunkhead) % MINCHUNK) == 0);
|
NSAssert((chunkSize(chunkhead) % MINCHUNK) == 0, NSInternalInconsistencyException);
|
||||||
}
|
}
|
||||||
chunkhead->next = (ff_block*)(chunkToPointer(chunkhead)+size);
|
chunkhead->next = (ff_block*)(chunkToPointer(chunkhead)+size);
|
||||||
*((char*)chunkhead->next) = (char)42;
|
*((char*)chunkhead->next) = (char)42;
|
||||||
|
@ -601,15 +599,15 @@ frealloc (NSZone *zone, void *ptr, size_t size)
|
||||||
ff_block *chunkhead, *slack;
|
ff_block *chunkhead, *slack;
|
||||||
void *result;
|
void *result;
|
||||||
|
|
||||||
assert(ptr == NULL || NSZoneFromPointer(ptr) == zone);
|
NSAssert(ptr == NULL || NSZoneFromPointer(ptr) == zone, NSInternalInconsistencyException);
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
return fmalloc(zone, size);
|
return fmalloc(zone, size);
|
||||||
chunkhead = pointerToChunk(ptr);
|
chunkhead = pointerToChunk(ptr);
|
||||||
objc_mutex_lock(zptr->lock);
|
objc_mutex_lock(zptr->lock);
|
||||||
realsize = chunkSize(chunkhead);
|
realsize = chunkSize(chunkhead);
|
||||||
|
|
||||||
assert(chunkIsInUse(chunkhead));
|
NSAssert(chunkIsInUse(chunkhead), NSInternalInconsistencyException);
|
||||||
assert((realsize % MINCHUNK) == 0);
|
NSAssert((realsize % MINCHUNK) == 0, NSInternalInconsistencyException);
|
||||||
|
|
||||||
chunkClrLive(chunkhead);
|
chunkClrLive(chunkhead);
|
||||||
if (chunksize < realsize)
|
if (chunksize < realsize)
|
||||||
|
@ -633,7 +631,7 @@ frealloc (NSZone *zone, void *ptr, size_t size)
|
||||||
nextchunk = chunkNext(chunkhead);
|
nextchunk = chunkNext(chunkhead);
|
||||||
nextsize = chunkSize(nextchunk);
|
nextsize = chunkSize(nextchunk);
|
||||||
|
|
||||||
assert((nextsize % MINCHUNK) == 0);
|
NSAssert((nextsize % MINCHUNK) == 0, NSInternalInconsistencyException);
|
||||||
|
|
||||||
if (!chunkIsInUse(nextchunk) && (nextsize+realsize >= chunksize))
|
if (!chunkIsInUse(nextchunk) && (nextsize+realsize >= chunksize))
|
||||||
/* Expand to next chunk. */
|
/* Expand to next chunk. */
|
||||||
|
@ -688,13 +686,13 @@ static void
|
||||||
ffree (NSZone *zone, void *ptr)
|
ffree (NSZone *zone, void *ptr)
|
||||||
{
|
{
|
||||||
ff_block *chunk;
|
ff_block *chunk;
|
||||||
assert(NSZoneFromPointer(ptr) == zone);
|
NSAssert(NSZoneFromPointer(ptr) == zone, NSInternalInconsistencyException);
|
||||||
objc_mutex_lock(((ffree_zone*)zone)->lock);
|
objc_mutex_lock(((ffree_zone*)zone)->lock);
|
||||||
chunk = pointerToChunk(ptr);
|
chunk = pointerToChunk(ptr);
|
||||||
if (chunkIsLive(chunk) == 0)
|
if (chunkIsLive(chunk) == 0)
|
||||||
[NSException raise: NSMallocException
|
[NSException raise: NSMallocException
|
||||||
format: @"Attempt to free freed memory"];
|
format: @"Attempt to free freed memory"];
|
||||||
assert(*((char*)chunk->next) == (char)42);
|
NSAssert(*((char*)chunk->next) == (char)42, NSInternalInconsistencyException);
|
||||||
add_buf((ffree_zone*)zone, chunk);
|
add_buf((ffree_zone*)zone, chunk);
|
||||||
objc_mutex_unlock(((ffree_zone*)zone)->lock);
|
objc_mutex_unlock(((ffree_zone*)zone)->lock);
|
||||||
}
|
}
|
||||||
|
@ -960,7 +958,7 @@ fstats (NSZone *zone)
|
||||||
static inline size_t
|
static inline size_t
|
||||||
segindex (size_t size)
|
segindex (size_t size)
|
||||||
{
|
{
|
||||||
assert(size%MINCHUNK == 0);
|
NSAssert(size%MINCHUNK == 0, NSInternalInconsistencyException);
|
||||||
|
|
||||||
if (size < CLTOSZ(8))
|
if (size < CLTOSZ(8))
|
||||||
return size/MINCHUNK;
|
return size/MINCHUNK;
|
||||||
|
@ -993,7 +991,7 @@ get_chunk (ffree_zone *zone, size_t size)
|
||||||
ff_block *chunk;
|
ff_block *chunk;
|
||||||
ff_link *link = zone->segheadlist[class];
|
ff_link *link = zone->segheadlist[class];
|
||||||
|
|
||||||
assert(size%MINCHUNK == 0);
|
NSAssert(size%MINCHUNK == 0, NSInternalInconsistencyException);
|
||||||
|
|
||||||
while ((link != NULL) && (chunkSize((ff_block*)link) < size))
|
while ((link != NULL) && (chunkSize((ff_block*)link) < size))
|
||||||
link = link->next;
|
link = link->next;
|
||||||
|
@ -1049,13 +1047,13 @@ get_chunk (ffree_zone *zone, size_t size)
|
||||||
{
|
{
|
||||||
ff_block *slack;
|
ff_block *slack;
|
||||||
|
|
||||||
assert(class < MAX_SEG);
|
NSAssert(class < MAX_SEG, NSInternalInconsistencyException);
|
||||||
|
|
||||||
chunk = (ff_block*)zone->segheadlist[class];
|
chunk = (ff_block*)zone->segheadlist[class];
|
||||||
|
|
||||||
assert(!chunkIsInUse(chunk));
|
NSAssert(!chunkIsInUse(chunk), NSInternalInconsistencyException);
|
||||||
assert(size < chunkSize(chunk));
|
NSAssert(size < chunkSize(chunk), NSInternalInconsistencyException);
|
||||||
assert((chunkSize(chunk) % MINCHUNK) == 0);
|
NSAssert((chunkSize(chunk) % MINCHUNK) == 0, NSInternalInconsistencyException);
|
||||||
|
|
||||||
take_chunk(zone, chunk);
|
take_chunk(zone, chunk);
|
||||||
slack = chunkChop(chunk, size);
|
slack = chunkChop(chunk, size);
|
||||||
|
@ -1069,10 +1067,10 @@ get_chunk (ffree_zone *zone, size_t size)
|
||||||
chunk = (ff_block*)link;
|
chunk = (ff_block*)link;
|
||||||
chunksize = chunkSize(chunk);
|
chunksize = chunkSize(chunk);
|
||||||
|
|
||||||
assert((chunksize % MINCHUNK) == 0);
|
NSAssert((chunksize % MINCHUNK) == 0, NSInternalInconsistencyException);
|
||||||
assert(!chunkIsInUse(chunk));
|
NSAssert(!chunkIsInUse(chunk), NSInternalInconsistencyException);
|
||||||
assert(chunkIsPrevInUse(chunk));
|
NSAssert(chunkIsPrevInUse(chunk), NSInternalInconsistencyException);
|
||||||
assert(chunkIsInUse(chunkNext(chunk)));
|
NSAssert(chunkIsInUse(chunkNext(chunk)), NSInternalInconsistencyException);
|
||||||
|
|
||||||
take_chunk(zone, chunk);
|
take_chunk(zone, chunk);
|
||||||
if (chunksize > size)
|
if (chunksize > size)
|
||||||
|
@ -1086,15 +1084,15 @@ get_chunk (ffree_zone *zone, size_t size)
|
||||||
{
|
{
|
||||||
ff_block *nextchunk = chunkNext(chunk);
|
ff_block *nextchunk = chunkNext(chunk);
|
||||||
|
|
||||||
assert(!chunkIsInUse(chunk));
|
NSAssert(!chunkIsInUse(chunk), NSInternalInconsistencyException);
|
||||||
assert(!chunkIsPrevInUse(nextchunk));
|
NSAssert(!chunkIsPrevInUse(nextchunk), NSInternalInconsistencyException);
|
||||||
assert(chunksize == size);
|
NSAssert(chunksize == size, NSInternalInconsistencyException);
|
||||||
chunkSetInUse(chunk);
|
chunkSetInUse(chunk);
|
||||||
chunkSetPrevInUse(nextchunk);
|
chunkSetPrevInUse(nextchunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(chunkIsInUse(chunk));
|
NSAssert(chunkIsInUse(chunk), NSInternalInconsistencyException);
|
||||||
assert(chunkIsPrevInUse(chunkNext(chunk)));
|
NSAssert(chunkIsPrevInUse(chunkNext(chunk)), NSInternalInconsistencyException);
|
||||||
return chunk;
|
return chunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1107,8 +1105,8 @@ take_chunk (ffree_zone *zone, ff_block *chunk)
|
||||||
ff_link *otherlink;
|
ff_link *otherlink;
|
||||||
ff_link *links = (ff_link*)chunk;
|
ff_link *links = (ff_link*)chunk;
|
||||||
|
|
||||||
assert((size % MINCHUNK) == 0);
|
NSAssert((size % MINCHUNK) == 0, NSInternalInconsistencyException);
|
||||||
assert(!chunkIsInUse(chunk));
|
NSAssert(!chunkIsInUse(chunk), NSInternalInconsistencyException);
|
||||||
|
|
||||||
if (links->prev == NULL)
|
if (links->prev == NULL)
|
||||||
zone->segheadlist[class] = links->next;
|
zone->segheadlist[class] = links->next;
|
||||||
|
@ -1140,15 +1138,15 @@ put_chunk (ffree_zone *zone, ff_block *chunk)
|
||||||
size_t class = segindex(size);
|
size_t class = segindex(size);
|
||||||
ff_link *links = (ff_link*)chunk;
|
ff_link *links = (ff_link*)chunk;
|
||||||
|
|
||||||
assert((chunkSize(chunk) % MINCHUNK) == 0);
|
NSAssert((chunkSize(chunk) % MINCHUNK) == 0, NSInternalInconsistencyException);
|
||||||
assert(!chunkIsInUse(chunk));
|
NSAssert(!chunkIsInUse(chunk), NSInternalInconsistencyException);
|
||||||
assert(chunkIsPrevInUse(chunk));
|
NSAssert(chunkIsPrevInUse(chunk), NSInternalInconsistencyException);
|
||||||
assert(chunkIsInUse(chunkNext(chunk)));
|
NSAssert(chunkIsInUse(chunkNext(chunk)), NSInternalInconsistencyException);
|
||||||
|
|
||||||
chunkMakeLink(chunk);
|
chunkMakeLink(chunk);
|
||||||
if (zone->segtaillist[class] == NULL)
|
if (zone->segtaillist[class] == NULL)
|
||||||
{
|
{
|
||||||
assert(zone->segheadlist[class] == NULL);
|
NSAssert(zone->segheadlist[class] == NULL, NSInternalInconsistencyException);
|
||||||
|
|
||||||
zone->segheadlist[class] = zone->segtaillist[class] = links;
|
zone->segheadlist[class] = zone->segtaillist[class] = links;
|
||||||
links->prev = links->next = NULL;
|
links->prev = links->next = NULL;
|
||||||
|
@ -1157,7 +1155,7 @@ put_chunk (ffree_zone *zone, ff_block *chunk)
|
||||||
{
|
{
|
||||||
ff_link *prevlink = zone->segtaillist[class];
|
ff_link *prevlink = zone->segtaillist[class];
|
||||||
|
|
||||||
assert(zone->segheadlist[class] != NULL);
|
NSAssert(zone->segheadlist[class] != NULL, NSInternalInconsistencyException);
|
||||||
|
|
||||||
links->next = NULL;
|
links->next = NULL;
|
||||||
links->prev = prevlink;
|
links->prev = prevlink;
|
||||||
|
@ -1174,10 +1172,10 @@ add_buf (ffree_zone *zone, ff_block *chunk)
|
||||||
{
|
{
|
||||||
size_t bufsize = zone->bufsize;
|
size_t bufsize = zone->bufsize;
|
||||||
|
|
||||||
assert(bufsize < BUFFER);
|
NSAssert(bufsize < BUFFER, NSInternalInconsistencyException);
|
||||||
assert(chunkIsInUse(chunk));
|
NSAssert(chunkIsInUse(chunk), NSInternalInconsistencyException);
|
||||||
assert((chunkSize(chunk) % MINCHUNK) == 0);
|
NSAssert((chunkSize(chunk) % MINCHUNK) == 0, NSInternalInconsistencyException);
|
||||||
assert(chunkSize(chunk) >= MINCHUNK);
|
NSAssert(chunkSize(chunk) >= MINCHUNK, NSInternalInconsistencyException);
|
||||||
|
|
||||||
zone->bufsize++;
|
zone->bufsize++;
|
||||||
zone->size_buf[bufsize] = chunkSize(chunk);
|
zone->size_buf[bufsize] = chunkSize(chunk);
|
||||||
|
@ -1197,23 +1195,23 @@ flush_buf (ffree_zone *zone)
|
||||||
size_t *size_buf = zone->size_buf;
|
size_t *size_buf = zone->size_buf;
|
||||||
ff_block **ptr_buf = zone->ptr_buf;
|
ff_block **ptr_buf = zone->ptr_buf;
|
||||||
|
|
||||||
assert(bufsize <= BUFFER);
|
NSAssert(bufsize <= BUFFER, NSInternalInconsistencyException);
|
||||||
|
|
||||||
for (i = 0; i < bufsize; i++)
|
for (i = 0; i < bufsize; i++)
|
||||||
{
|
{
|
||||||
size = size_buf[i];
|
size = size_buf[i];
|
||||||
chunk = ptr_buf[i];
|
chunk = ptr_buf[i];
|
||||||
|
|
||||||
assert(chunkSize(chunk) == size);
|
NSAssert(chunkSize(chunk) == size, NSInternalInconsistencyException);
|
||||||
assert(chunkIsInUse(chunk));
|
NSAssert(chunkIsInUse(chunk), NSInternalInconsistencyException);
|
||||||
|
|
||||||
nextchunk = chunkNext(chunk);
|
nextchunk = chunkNext(chunk);
|
||||||
if (!chunkIsPrevInUse(chunk))
|
if (!chunkIsPrevInUse(chunk))
|
||||||
/* Coalesce with previous chunk. */
|
/* Coalesce with previous chunk. */
|
||||||
{
|
{
|
||||||
chunk = chunkPrev(chunk);
|
chunk = chunkPrev(chunk);
|
||||||
assert(!chunkIsInUse(chunk));
|
NSAssert(!chunkIsInUse(chunk), NSInternalInconsistencyException);
|
||||||
assert(chunkIsPrevInUse(chunk));
|
NSAssert(chunkIsPrevInUse(chunk), NSInternalInconsistencyException);
|
||||||
size += chunkSize(chunk);
|
size += chunkSize(chunk);
|
||||||
take_chunk(zone, chunk);
|
take_chunk(zone, chunk);
|
||||||
}
|
}
|
||||||
|
@ -1222,8 +1220,8 @@ flush_buf (ffree_zone *zone)
|
||||||
{
|
{
|
||||||
size_t nextsize = chunkSize(nextchunk);
|
size_t nextsize = chunkSize(nextchunk);
|
||||||
|
|
||||||
assert(chunkIsPrevInUse(nextchunk));
|
NSAssert(chunkIsPrevInUse(nextchunk), NSInternalInconsistencyException);
|
||||||
assert((nextsize % MINCHUNK) == 0);
|
NSAssert((nextsize % MINCHUNK) == 0, NSInternalInconsistencyException);
|
||||||
size += nextsize;
|
size += nextsize;
|
||||||
take_chunk(zone, nextchunk);
|
take_chunk(zone, nextchunk);
|
||||||
nextchunk = chunkNext(nextchunk);
|
nextchunk = chunkNext(nextchunk);
|
||||||
|
@ -1231,13 +1229,13 @@ flush_buf (ffree_zone *zone)
|
||||||
chunkSetSize(chunk, size | PREVUSE);
|
chunkSetSize(chunk, size | PREVUSE);
|
||||||
put_chunk(zone, chunk);
|
put_chunk(zone, chunk);
|
||||||
chunkClrPrevInUse(nextchunk);
|
chunkClrPrevInUse(nextchunk);
|
||||||
assert(chunkNext(chunk) == nextchunk);
|
NSAssert(chunkNext(chunk) == nextchunk, NSInternalInconsistencyException);
|
||||||
assert(chunkPrev(nextchunk) == chunk);
|
NSAssert(chunkPrev(nextchunk) == chunk, NSInternalInconsistencyException);
|
||||||
assert((chunkSize(chunk) % MINCHUNK) == 0);
|
NSAssert((chunkSize(chunk) % MINCHUNK) == 0, NSInternalInconsistencyException);
|
||||||
assert(!chunkIsInUse(chunk));
|
NSAssert(!chunkIsInUse(chunk), NSInternalInconsistencyException);
|
||||||
assert(chunkIsPrevInUse(chunk));
|
NSAssert(chunkIsPrevInUse(chunk), NSInternalInconsistencyException);
|
||||||
assert(chunkIsInUse(nextchunk));
|
NSAssert(chunkIsInUse(nextchunk), NSInternalInconsistencyException);
|
||||||
assert(!chunkIsPrevInUse(nextchunk));
|
NSAssert(!chunkIsPrevInUse(nextchunk), NSInternalInconsistencyException);
|
||||||
}
|
}
|
||||||
zone->bufsize = 0;
|
zone->bufsize = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -410,19 +410,19 @@ static NotificationDispatcher *default_notification_dispatcher = nil;
|
||||||
id nr_object;
|
id nr_object;
|
||||||
LinkedList *mapped_nr_list;
|
LinkedList *mapped_nr_list;
|
||||||
|
|
||||||
assert ([nr_list firstObject] == nr);
|
NSAssert([nr_list firstObject] == nr, NSInternalInconsistencyException);
|
||||||
if ((nr_name = [nr notificationName]))
|
if ((nr_name = [nr notificationName]))
|
||||||
{
|
{
|
||||||
mapped_nr_list = NSMapGet (_name_2_nr_list, nr_name);
|
mapped_nr_list = NSMapGet (_name_2_nr_list, nr_name);
|
||||||
assert (mapped_nr_list == nr_list);
|
NSAssert(mapped_nr_list == nr_list, NSInternalInconsistencyException);
|
||||||
NSMapRemove (_name_2_nr_list, nr_name);
|
NSMapRemove (_name_2_nr_list, nr_name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nr_object = [nr notificationObject];
|
nr_object = [nr notificationObject];
|
||||||
assert (nr_object);
|
NSAssert(nr_object, NSInternalInconsistencyException);
|
||||||
mapped_nr_list = NSMapGet (_object_2_nr_list, nr_object);
|
mapped_nr_list = NSMapGet (_object_2_nr_list, nr_object);
|
||||||
assert (mapped_nr_list == nr_list);
|
NSAssert(mapped_nr_list == nr_list, NSInternalInconsistencyException);
|
||||||
NSMapRemove (_object_2_nr_list, nr_object);
|
NSMapRemove (_object_2_nr_list, nr_object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <gnustep/base/Array.h>
|
#include <gnustep/base/Array.h>
|
||||||
#include <gnustep/base/NSString.h>
|
#include <gnustep/base/NSString.h>
|
||||||
|
#include <Foundation/NSException.h>
|
||||||
|
|
||||||
|
|
||||||
@implementation OrderedCollection
|
@implementation OrderedCollection
|
||||||
|
@ -86,7 +87,7 @@
|
||||||
{
|
{
|
||||||
id o;
|
id o;
|
||||||
|
|
||||||
assert (aCollection != self);
|
NSAssert(aCollection != self, NSInvalidArgumentException);
|
||||||
/* xxx Could be more efficient. */
|
/* xxx Could be more efficient. */
|
||||||
FOR_COLLECTION(aCollection, o)
|
FOR_COLLECTION(aCollection, o)
|
||||||
{
|
{
|
||||||
|
@ -99,7 +100,7 @@
|
||||||
{
|
{
|
||||||
id o;
|
id o;
|
||||||
|
|
||||||
assert (aCollection != self);
|
NSAssert(aCollection != self, NSInvalidArgumentException);
|
||||||
if ([(id)aCollection conformsTo: @protocol(IndexedCollecting)])
|
if ([(id)aCollection conformsTo: @protocol(IndexedCollecting)])
|
||||||
{
|
{
|
||||||
FOR_INDEXED_COLLECTION_REVERSE(self, o)
|
FOR_INDEXED_COLLECTION_REVERSE(self, o)
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <gnustep/base/Port.h>
|
#include <gnustep/base/Port.h>
|
||||||
#include <gnustep/base/Coder.h> /* for Coding protocol in Object category */
|
#include <gnustep/base/Coder.h> /* for Coding protocol in Object category */
|
||||||
#include <gnustep/base/NotificationDispatcher.h>
|
#include <gnustep/base/NotificationDispatcher.h>
|
||||||
|
#include <Foundation/NSException.h>
|
||||||
|
|
||||||
@implementation Port
|
@implementation Port
|
||||||
|
|
||||||
|
@ -113,7 +114,7 @@
|
||||||
|
|
||||||
- (void) setReceivedPacketInvocation: (id <Invoking>)invocation
|
- (void) setReceivedPacketInvocation: (id <Invoking>)invocation
|
||||||
{
|
{
|
||||||
assert (!_packet_invocation);
|
NSAssert(!_packet_invocation, NSInternalInconsistencyException);
|
||||||
_packet_invocation = invocation;
|
_packet_invocation = invocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,8 +159,8 @@
|
||||||
self = [super initWithCapacity: c prefix: 0];
|
self = [super initWithCapacity: c prefix: 0];
|
||||||
if (self)
|
if (self)
|
||||||
{
|
{
|
||||||
assert ([op isValid]);
|
NSAssert([op isValid], NSInternalInconsistencyException);
|
||||||
assert (!ip || [ip isValid]);
|
NSAssert(!ip || [ip isValid], NSInternalInconsistencyException);
|
||||||
_reply_out_port = op;
|
_reply_out_port = op;
|
||||||
_receiving_in_port = ip;
|
_receiving_in_port = ip;
|
||||||
}
|
}
|
||||||
|
@ -188,7 +189,7 @@
|
||||||
self = [super initWithCapacity: c prefix: [[self class] prefixSize]];
|
self = [super initWithCapacity: c prefix: [[self class] prefixSize]];
|
||||||
if (self)
|
if (self)
|
||||||
{
|
{
|
||||||
assert ([ip isValid]);
|
NSAssert([ip isValid], NSInternalInconsistencyException);
|
||||||
_reply_in_port = ip;
|
_reply_in_port = ip;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
#include <gnustep/base/RNGBerkeley.h>
|
#include <gnustep/base/RNGBerkeley.h>
|
||||||
#include <gnustep/base/Time.h>
|
#include <gnustep/base/Time.h>
|
||||||
#include <gnustep/base/Coder.h>
|
#include <gnustep/base/Coder.h>
|
||||||
|
#include <Foundation/NSException.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
float f;
|
float f;
|
||||||
|
@ -57,8 +57,8 @@ static id defaultRNG = nil;
|
||||||
if (self == [Random class])
|
if (self == [Random class])
|
||||||
{
|
{
|
||||||
defaultRNG = [RNGBerkeley class];
|
defaultRNG = [RNGBerkeley class];
|
||||||
assert(sizeof(double) == 2 * sizeof(long));
|
NSAssert(sizeof(double) == 2 * sizeof(long), NSInternalInconsistencyException);
|
||||||
assert(sizeof(float) == sizeof(long));
|
NSAssert(sizeof(float) == sizeof(long), NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Following taken from libg++ */
|
/* Following taken from libg++ */
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ static id defaultRNG = nil;
|
||||||
result.f = 1.0;
|
result.f = 1.0;
|
||||||
result.i |= ([rng nextRandom] & singleMantissa.u);
|
result.i |= ([rng nextRandom] & singleMantissa.u);
|
||||||
result.f -= 1.0;
|
result.f -= 1.0;
|
||||||
assert(result.f < 1.0 && result.f >= 0);
|
NSAssert(result.f < 1.0 && result.f >= 0, NSInternalInconsistencyException);
|
||||||
return result.f;
|
return result.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ static id defaultRNG = nil;
|
||||||
result.u[0] |= ([rng nextRandom] & doubleMantissa.u[0]);
|
result.u[0] |= ([rng nextRandom] & doubleMantissa.u[0]);
|
||||||
result.u[1] |= ([rng nextRandom] & doubleMantissa.u[1]);
|
result.u[1] |= ([rng nextRandom] & doubleMantissa.u[1]);
|
||||||
result.d -= 1.0;
|
result.d -= 1.0;
|
||||||
assert(result.d < 1.0 && result.d >= 0);
|
NSAssert(result.d < 1.0 && result.d >= 0, NSInternalInconsistencyException);
|
||||||
return result.d;
|
return result.d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <objc/Storage.h>
|
#include <objc/Storage.h>
|
||||||
#include <gnustep/base/preface.h>
|
#include <gnustep/base/preface.h>
|
||||||
#include <assert.h>
|
|
||||||
/* memcpy() and memcmp() are gcc builtin's */
|
/* memcpy() and memcmp() are gcc builtin's */
|
||||||
|
|
||||||
/* Deal with bzero: */
|
/* Deal with bzero: */
|
||||||
|
@ -129,7 +128,6 @@ static inline void _makeRoomForAnotherIfNecessary(Storage *self)
|
||||||
{
|
{
|
||||||
if (self->numElements == self->maxElements)
|
if (self->numElements == self->maxElements)
|
||||||
{
|
{
|
||||||
assert(self->maxElements);
|
|
||||||
self->maxElements *= 2;
|
self->maxElements *= 2;
|
||||||
self->dataPtr = (void*)
|
self->dataPtr = (void*)
|
||||||
objc_realloc (self->dataPtr, self->maxElements*self->elementSize);
|
objc_realloc (self->dataPtr, self->maxElements*self->elementSize);
|
||||||
|
|
|
@ -763,7 +763,7 @@ static NSMapTable* port_number_2_port;
|
||||||
don't create a new one, just return the old one. */
|
don't create a new one, just return the old one. */
|
||||||
if ((p = (id) NSMapGet (port_number_2_port, (void*)((int)n))))
|
if ((p = (id) NSMapGet (port_number_2_port, (void*)((int)n))))
|
||||||
{
|
{
|
||||||
assert (p->is_valid);
|
NSAssert(p->is_valid, NSInternalInconsistencyException);
|
||||||
return [p retain];
|
return [p retain];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -784,7 +784,7 @@ static NSMapTable* port_number_2_port;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Register the port object according to its socket. */
|
/* Register the port object according to its socket. */
|
||||||
assert (!NSMapGet (socket_2_port, (void*)p->_port_socket));
|
NSAssert(!NSMapGet (socket_2_port, (void*)p->_port_socket), NSInternalInconsistencyException);
|
||||||
NSMapInsert (socket_2_port, (void*)p->_port_socket, p);
|
NSMapInsert (socket_2_port, (void*)p->_port_socket, p);
|
||||||
|
|
||||||
/* Give the socket a name using bind() and INADDR_ANY for the
|
/* Give the socket a name using bind() and INADDR_ANY for the
|
||||||
|
@ -861,7 +861,7 @@ static NSMapTable* port_number_2_port;
|
||||||
strerror(errno)];
|
strerror(errno)];
|
||||||
|
|
||||||
}
|
}
|
||||||
assert (p->_listening_address.sin_port);
|
NSAssert(p->_listening_address.sin_port, NSInternalInconsistencyException);
|
||||||
n = ntohs(p->_listening_address.sin_port);
|
n = ntohs(p->_listening_address.sin_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -885,7 +885,7 @@ static NSMapTable* port_number_2_port;
|
||||||
hp = gethostbyname (hostname);
|
hp = gethostbyname (hostname);
|
||||||
if (!hp)
|
if (!hp)
|
||||||
[self error: "Could not get address of local host \"%s\"", hostname];
|
[self error: "Could not get address of local host \"%s\"", hostname];
|
||||||
assert (hp);
|
NSAssert(hp, NSInternalInconsistencyException);
|
||||||
memcpy (&(p->_listening_address.sin_addr), hp->h_addr, hp->h_length);
|
memcpy (&(p->_listening_address.sin_addr), hp->h_addr, hp->h_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -967,7 +967,7 @@ static NSMapTable* port_number_2_port;
|
||||||
|
|
||||||
- (struct sockaddr_in*) _listeningSockaddr
|
- (struct sockaddr_in*) _listeningSockaddr
|
||||||
{
|
{
|
||||||
assert (is_valid);
|
NSAssert(is_valid, NSInternalInconsistencyException);
|
||||||
return &_listening_address;
|
return &_listening_address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1127,7 +1127,7 @@ static NSMapTable* port_number_2_port;
|
||||||
{
|
{
|
||||||
/* No bytes are remaining to be read for this packet;
|
/* No bytes are remaining to be read for this packet;
|
||||||
the packet is complete; return it. */
|
the packet is complete; return it. */
|
||||||
assert (packet && [packet class]);
|
NSAssert(packet && [packet class], NSInternalInconsistencyException);
|
||||||
NSMapRemove(_client_sock_2_packet, (void*)fd_index);
|
NSMapRemove(_client_sock_2_packet, (void*)fd_index);
|
||||||
if (debug_tcp_port > 1)
|
if (debug_tcp_port > 1)
|
||||||
NSLog(@"%s: Read from socket %d\n",
|
NSLog(@"%s: Read from socket %d\n",
|
||||||
|
@ -1153,7 +1153,7 @@ static NSMapTable* port_number_2_port;
|
||||||
id out_port;
|
id out_port;
|
||||||
|
|
||||||
/* Make sure there is enough room in the provided array. */
|
/* Make sure there is enough room in the provided array. */
|
||||||
assert (*count > NSCountMapTable (_client_sock_2_out_port));
|
NSAssert(*count > NSCountMapTable (_client_sock_2_out_port), NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Put in our listening socket. */
|
/* Put in our listening socket. */
|
||||||
*count = 0;
|
*count = 0;
|
||||||
|
@ -1177,7 +1177,7 @@ static NSMapTable* port_number_2_port;
|
||||||
id arp = [NSAutoreleasePool new];
|
id arp = [NSAutoreleasePool new];
|
||||||
id packet;
|
id packet;
|
||||||
|
|
||||||
assert(type == ET_RPORT);
|
NSAssert(type == ET_RPORT, NSInvalidArgumentException);
|
||||||
|
|
||||||
packet = [self _tryToGetPacketFromReadableFD: (int)extra];
|
packet = [self _tryToGetPacketFromReadableFD: (int)extra];
|
||||||
if (packet) {
|
if (packet) {
|
||||||
|
@ -1203,9 +1203,9 @@ assert(type == ET_RPORT);
|
||||||
{
|
{
|
||||||
int s = [p _port_socket];
|
int s = [p _port_socket];
|
||||||
|
|
||||||
assert (is_valid);
|
NSAssert(is_valid, NSInternalInconsistencyException);
|
||||||
/* Make sure it hasn't already been added. */
|
/* Make sure it hasn't already been added. */
|
||||||
assert (!NSMapGet (_client_sock_2_out_port, (void*)s));
|
NSAssert(!NSMapGet (_client_sock_2_out_port, (void*)s), NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Add it, and put its socket in the set of file descriptors we poll. */
|
/* Add it, and put its socket in the set of file descriptors we poll. */
|
||||||
NSMapInsert (_client_sock_2_out_port, (void*)s, p);
|
NSMapInsert (_client_sock_2_out_port, (void*)s, p);
|
||||||
|
@ -1217,7 +1217,7 @@ assert(type == ET_RPORT);
|
||||||
id packet;
|
id packet;
|
||||||
int s = [p _port_socket];
|
int s = [p _port_socket];
|
||||||
|
|
||||||
assert (is_valid);
|
NSAssert(is_valid, NSInternalInconsistencyException);
|
||||||
if (debug_tcp_port)
|
if (debug_tcp_port)
|
||||||
NSLog(@"%s: Closed connection from\n %@\n",
|
NSLog(@"%s: Closed connection from\n %@\n",
|
||||||
object_get_class_name (self), [p description]);
|
object_get_class_name (self), [p description]);
|
||||||
|
@ -1279,7 +1279,7 @@ assert(type == ET_RPORT);
|
||||||
/* This will call [self _invalidateConnectedOutPort: for each. */
|
/* This will call [self _invalidateConnectedOutPort: for each. */
|
||||||
[out_ports[i] invalidate];
|
[out_ports[i] invalidate];
|
||||||
}
|
}
|
||||||
assert (!NSCountMapTable (_client_sock_2_out_port));
|
NSAssert(!NSCountMapTable (_client_sock_2_out_port), NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* xxx Perhaps should delay this close() to keep another port from
|
/* xxx Perhaps should delay this close() to keep another port from
|
||||||
getting it. This may help Connection invalidation confusion.
|
getting it. This may help Connection invalidation confusion.
|
||||||
|
@ -1302,7 +1302,6 @@ assert(type == ET_RPORT);
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[self invalidate];
|
[self invalidate];
|
||||||
/* assert that these are empty? */
|
|
||||||
NSFreeMapTable (_client_sock_2_out_port);
|
NSFreeMapTable (_client_sock_2_out_port);
|
||||||
NSFreeMapTable (_client_sock_2_packet);
|
NSFreeMapTable (_client_sock_2_packet);
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
|
@ -1352,7 +1351,7 @@ assert(type == ET_RPORT);
|
||||||
|
|
||||||
- (void) encodeWithCoder: aCoder
|
- (void) encodeWithCoder: aCoder
|
||||||
{
|
{
|
||||||
assert (is_valid);
|
NSAssert(is_valid, NSInternalInconsistencyException);
|
||||||
/* We are actually encoding a "send right" (ala Mach),
|
/* We are actually encoding a "send right" (ala Mach),
|
||||||
not a receive right.
|
not a receive right.
|
||||||
These values must match those expected by [TcpOutPort +newWithCoder] */
|
These values must match those expected by [TcpOutPort +newWithCoder] */
|
||||||
|
@ -1443,7 +1442,7 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
NSMapEnumerator me = NSEnumerateMapTable (out_port_bag);
|
NSMapEnumerator me = NSEnumerateMapTable (out_port_bag);
|
||||||
void *k;
|
void *k;
|
||||||
|
|
||||||
assert (sockaddr);
|
NSAssert(sockaddr, NSInternalInconsistencyException);
|
||||||
while (NSNextMapEnumeratorPair (&me, &k, (void**)&p))
|
while (NSNextMapEnumeratorPair (&me, &k, (void**)&p))
|
||||||
{
|
{
|
||||||
/* xxx Do I need to make sure connectedInPort is the same too? */
|
/* xxx Do I need to make sure connectedInPort is the same too? */
|
||||||
|
@ -1455,7 +1454,7 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
/* Assume that sin_family is equal. Using memcmp() doesn't
|
/* Assume that sin_family is equal. Using memcmp() doesn't
|
||||||
work because sin_zero's may differ. */
|
work because sin_zero's may differ. */
|
||||||
{
|
{
|
||||||
assert (p->is_valid);
|
NSAssert(p->is_valid, NSInternalInconsistencyException);
|
||||||
return [p retain];
|
return [p retain];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1470,11 +1469,11 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
ivar. */
|
ivar. */
|
||||||
if (sock && (p = NSMapGet (socket_2_port, (void*)sock)))
|
if (sock && (p = NSMapGet (socket_2_port, (void*)sock)))
|
||||||
{
|
{
|
||||||
assert ([p isKindOfClass: [TcpOutPort class]]);
|
NSAssert([p isKindOfClass: [TcpOutPort class]], NSInternalInconsistencyException);
|
||||||
if (sockaddr)
|
if (sockaddr)
|
||||||
{
|
{
|
||||||
/* Make sure the address we're setting it to is non-zero. */
|
/* Make sure the address we're setting it to is non-zero. */
|
||||||
assert (sockaddr->sin_port);
|
NSAssert(sockaddr->sin_port, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* See if the _remote_in_port_address is already set */
|
/* See if the _remote_in_port_address is already set */
|
||||||
if (p->_remote_in_port_address.sin_family)
|
if (p->_remote_in_port_address.sin_family)
|
||||||
|
@ -1520,7 +1519,7 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
}
|
}
|
||||||
if (p)
|
if (p)
|
||||||
{
|
{
|
||||||
assert (p->is_valid);
|
NSAssert(p->is_valid, NSInternalInconsistencyException);
|
||||||
return [p retain];
|
return [p retain];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1551,7 +1550,7 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
/* Set the port's address. */
|
/* Set the port's address. */
|
||||||
if (sockaddr)
|
if (sockaddr)
|
||||||
{
|
{
|
||||||
assert (sockaddr->sin_port);
|
NSAssert(sockaddr->sin_port, NSInternalInconsistencyException);
|
||||||
memcpy (&(p->_remote_in_port_address), sockaddr, sizeof(*sockaddr));
|
memcpy (&(p->_remote_in_port_address), sockaddr, sizeof(*sockaddr));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1570,7 +1569,7 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
if (!sock) {
|
if (!sock) {
|
||||||
int rval;
|
int rval;
|
||||||
|
|
||||||
assert (p->_remote_in_port_address.sin_family);
|
NSAssert(p->_remote_in_port_address.sin_family, NSInternalInconsistencyException);
|
||||||
|
|
||||||
if (connect (p->_port_socket,
|
if (connect (p->_port_socket,
|
||||||
(struct sockaddr*)&(p->_remote_in_port_address),
|
(struct sockaddr*)&(p->_remote_in_port_address),
|
||||||
|
@ -1604,7 +1603,7 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Put it in the shared socket->port map table. */
|
/* Put it in the shared socket->port map table. */
|
||||||
assert (!NSMapGet (socket_2_port, (void*)p->_port_socket));
|
NSAssert(!NSMapGet (socket_2_port, (void*)p->_port_socket), NSInternalInconsistencyException);
|
||||||
NSMapInsert (socket_2_port, (void*)p->_port_socket, p);
|
NSMapInsert (socket_2_port, (void*)p->_port_socket, p);
|
||||||
|
|
||||||
/* Put it in TcpOutPort's registry. */
|
/* Put it in TcpOutPort's registry. */
|
||||||
|
@ -1701,9 +1700,9 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
format: @"[TcpInPort newWithAcceptedSocket:] getsockname(): %s",
|
format: @"[TcpInPort newWithAcceptedSocket:] getsockname(): %s",
|
||||||
strerror(errno)];
|
strerror(errno)];
|
||||||
}
|
}
|
||||||
assert (size == sizeof (struct sockaddr_in));
|
NSAssert(size == sizeof (struct sockaddr_in), NSInternalInconsistencyException);
|
||||||
/* xxx Perhaps I have to get peer name here!! */
|
/* xxx Perhaps I have to get peer name here!! */
|
||||||
assert (ntohs (addr.sin_port) != [p portNumber]);
|
NSAssert(ntohs (addr.sin_port) != [p portNumber], NSInternalInconsistencyException);
|
||||||
#elif 0
|
#elif 0
|
||||||
struct sockaddr_in in_port_address;
|
struct sockaddr_in in_port_address;
|
||||||
c = read (s, &in_port_address, sizeof(struct sockaddr_in));
|
c = read (s, &in_port_address, sizeof(struct sockaddr_in));
|
||||||
|
@ -1723,7 +1722,7 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
{
|
{
|
||||||
id reply_port = [packet replyInPort];
|
id reply_port = [packet replyInPort];
|
||||||
|
|
||||||
assert (is_valid);
|
NSAssert(is_valid, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* If the socket of this TcpOutPort isn't already being polled
|
/* If the socket of this TcpOutPort isn't already being polled
|
||||||
for incoming data by a TcpInPort, and if the packet's REPLY_PORT
|
for incoming data by a TcpInPort, and if the packet's REPLY_PORT
|
||||||
|
@ -1858,11 +1857,11 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
|
|
||||||
- (void) encodeWithCoder: aCoder
|
- (void) encodeWithCoder: aCoder
|
||||||
{
|
{
|
||||||
assert (is_valid);
|
NSAssert(is_valid, NSInternalInconsistencyException);
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
assert (!_polling_in_port
|
NSAssert(!_polling_in_port
|
||||||
|| (ntohs (_remote_in_port_address.sin_port)
|
|| (ntohs (_remote_in_port_address.sin_port)
|
||||||
!= [_polling_in_port portNumber]));
|
!= [_polling_in_port portNumber]), NSInternalInconsistencyException);
|
||||||
/* Encode these at bytes, not as C-variables, because they are
|
/* Encode these at bytes, not as C-variables, because they are
|
||||||
already in "network byte-order". */
|
already in "network byte-order". */
|
||||||
[aCoder encodeBytes: &_remote_in_port_address.sin_port
|
[aCoder encodeBytes: &_remote_in_port_address.sin_port
|
||||||
|
@ -1948,7 +1947,7 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
/* *size is the number of bytes in the packet, not including
|
/* *size is the number of bytes in the packet, not including
|
||||||
the PREFIX_SIZE-byte header. */
|
the PREFIX_SIZE-byte header. */
|
||||||
*packet_size = ntohl (*(PREFIX_LENGTH_TYPE*) prefix_buffer);
|
*packet_size = ntohl (*(PREFIX_LENGTH_TYPE*) prefix_buffer);
|
||||||
assert (packet_size);
|
NSAssert(packet_size, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* If the reply address is non-zero, and the TcpOutPort for this socket
|
/* If the reply address is non-zero, and the TcpOutPort for this socket
|
||||||
doesn't already have its _address ivar set, then set it now. */
|
doesn't already have its _address ivar set, then set it now. */
|
||||||
|
@ -2011,7 +2010,7 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
NSLog(@"%s: Write to socket %d\n", object_get_class_name (self), s);
|
NSLog(@"%s: Write to socket %d\n", object_get_class_name (self), s);
|
||||||
|
|
||||||
/* Put the packet size in the first four bytes of the packet. */
|
/* Put the packet size in the first four bytes of the packet. */
|
||||||
assert (prefix == PREFIX_SIZE);
|
NSAssert(prefix == PREFIX_SIZE, NSInternalInconsistencyException);
|
||||||
*(PREFIX_LENGTH_TYPE*)[data mutableBytes] = htonl (eof_position);
|
*(PREFIX_LENGTH_TYPE*)[data mutableBytes] = htonl (eof_position);
|
||||||
|
|
||||||
/* Put the sockaddr_in for replies in the next bytes of the prefix
|
/* Put the sockaddr_in for replies in the next bytes of the prefix
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include <gnustep/base/ConnectedCoder.h>
|
#include <gnustep/base/ConnectedCoder.h>
|
||||||
#include <gnustep/base/Array.h>
|
#include <gnustep/base/Array.h>
|
||||||
#include <Foundation/NSLock.h>
|
#include <Foundation/NSLock.h>
|
||||||
#include <assert.h>
|
#include <Foundation/NSException.h>
|
||||||
#ifndef __WIN32__
|
#ifndef __WIN32__
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/param.h> /* for MAXHOSTNAMELEN */
|
#include <sys/param.h> /* for MAXHOSTNAMELEN */
|
||||||
|
@ -105,7 +105,7 @@ static NSMapTable *port_number_2_in_port = NULL;
|
||||||
{
|
{
|
||||||
UdpInPort* p;
|
UdpInPort* p;
|
||||||
|
|
||||||
assert (n > IPPORT_USERRESERVED);
|
NSAssert(n > IPPORT_USERRESERVED, NSInvalidArgumentException);
|
||||||
|
|
||||||
[udp_port_gate lock];
|
[udp_port_gate lock];
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ static NSMapTable *port_number_2_in_port = NULL;
|
||||||
Fix this. Perhaps there is a better way of getting the address
|
Fix this. Perhaps there is a better way of getting the address
|
||||||
of the local host. */
|
of the local host. */
|
||||||
hp = gethostbyname ("localhost");
|
hp = gethostbyname ("localhost");
|
||||||
assert (hp);
|
NSAssert(hp, NSInternalInconsistencyException);
|
||||||
/* Use host's address, and not INADDR_ANY, so that went we
|
/* Use host's address, and not INADDR_ANY, so that went we
|
||||||
encode our _address for a D.O. operation, they get
|
encode our _address for a D.O. operation, they get
|
||||||
our unique host address that can identify us across the network. */
|
our unique host address that can identify us across the network. */
|
||||||
|
@ -172,7 +172,7 @@ static NSMapTable *port_number_2_in_port = NULL;
|
||||||
perror ("[UdpInPort +newForReceivingFromPortNumber] getsockname()");
|
perror ("[UdpInPort +newForReceivingFromPortNumber] getsockname()");
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
assert (p->_address.sin_port);
|
NSAssert(p->_address.sin_port, NSInternalInconsistencyException);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Record it in UdpInPort's map table. */
|
/* Record it in UdpInPort's map table. */
|
||||||
|
@ -418,7 +418,7 @@ static Array *udp_out_port_array;
|
||||||
id reply_port = [packet replyPort];
|
id reply_port = [packet replyPort];
|
||||||
int len = [packet streamEofPosition];
|
int len = [packet streamEofPosition];
|
||||||
|
|
||||||
assert (len < MAX_PACKET_SIZE);
|
NSAssert(len < MAX_PACKET_SIZE, NSInternalInconsistencyException);
|
||||||
|
|
||||||
if ( ! [reply_port isKindOfClass: [UdpInPort class]])
|
if ( ! [reply_port isKindOfClass: [UdpInPort class]])
|
||||||
[self error:"Trying to send to a port that is not a UdpInPort"];
|
[self error:"Trying to send to a port that is not a UdpInPort"];
|
||||||
|
|
|
@ -51,7 +51,6 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <gnustep/base/preface.h>
|
#include <gnustep/base/preface.h>
|
||||||
#include <gnustep/base/behavior.h>
|
#include <gnustep/base/behavior.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
|
|
||||||
static int behavior_debug = 0;
|
static int behavior_debug = 0;
|
||||||
|
@ -80,8 +79,8 @@ behavior_class_add_class (Class class, Class behavior)
|
||||||
{
|
{
|
||||||
Class behavior_super_class = class_get_super_class(behavior);
|
Class behavior_super_class = class_get_super_class(behavior);
|
||||||
|
|
||||||
assert(CLS_ISCLASS(class));
|
NSCAssert(CLS_ISCLASS(class), NSInvalidArgumentException);
|
||||||
assert(CLS_ISCLASS(behavior));
|
NSCAssert(CLS_ISCLASS(behavior), NSInvalidArgumentException);
|
||||||
|
|
||||||
__objc_send_initialize(class);
|
__objc_send_initialize(class);
|
||||||
__objc_send_initialize(behavior);
|
__objc_send_initialize(behavior);
|
||||||
|
@ -89,7 +88,7 @@ behavior_class_add_class (Class class, Class behavior)
|
||||||
/* If necessary, increase instance_size of CLASS. */
|
/* If necessary, increase instance_size of CLASS. */
|
||||||
if (class->instance_size < behavior->instance_size)
|
if (class->instance_size < behavior->instance_size)
|
||||||
{
|
{
|
||||||
NSCAssert (!class->subclass_list,
|
NSCAssert(!class->subclass_list,
|
||||||
@"The behavior-addition code wants to increase the\n"
|
@"The behavior-addition code wants to increase the\n"
|
||||||
@"instance size of a class, but it cannot because you\n"
|
@"instance size of a class, but it cannot because you\n"
|
||||||
@"have subclassed the class. There are two solutions:\n"
|
@"have subclassed the class. There are two solutions:\n"
|
||||||
|
@ -255,7 +254,7 @@ class_add_behavior_method_list (Class class, MethodList_t list)
|
||||||
initialize_sel = sel_register_name ("initialize");
|
initialize_sel = sel_register_name ("initialize");
|
||||||
|
|
||||||
/* Passing of a linked list is not allowed. Do multiple calls. */
|
/* Passing of a linked list is not allowed. Do multiple calls. */
|
||||||
assert (!list->method_next);
|
NSCAssert(!list->method_next, NSInvalidArgumentException);
|
||||||
|
|
||||||
/* Check for duplicates. */
|
/* Check for duplicates. */
|
||||||
for (i = 0; i < list->method_count; ++i)
|
for (i = 0; i < list->method_count; ++i)
|
||||||
|
@ -327,8 +326,8 @@ search_for_method_in_list (MethodList_t list, SEL op)
|
||||||
static void __objc_send_initialize(Class class)
|
static void __objc_send_initialize(Class class)
|
||||||
{
|
{
|
||||||
/* This *must* be a class object */
|
/* This *must* be a class object */
|
||||||
assert(CLS_ISCLASS(class));
|
NSCAssert(CLS_ISCLASS(class), NSInvalidArgumentException);
|
||||||
assert(!CLS_ISMETA(class));
|
NSCAssert(!CLS_ISMETA(class), NSInvalidArgumentException);
|
||||||
|
|
||||||
if (!CLS_ISINITIALIZED(class))
|
if (!CLS_ISINITIALIZED(class))
|
||||||
{
|
{
|
||||||
|
@ -384,10 +383,6 @@ __objc_init_protocols (struct objc_protocol_list* protos)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
assert (protos->next == 0); /* only single ones allowed */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for(i = 0; i < protos->count; i++)
|
for(i = 0; i < protos->count; i++)
|
||||||
{
|
{
|
||||||
struct objc_protocol* aProto = protos->list[i];
|
struct objc_protocol* aProto = protos->list[i];
|
||||||
|
@ -450,7 +445,7 @@ check_class_methods(Class class)
|
||||||
Method_t method = &(mlist->method_list[counter]);
|
Method_t method = &(mlist->method_list[counter]);
|
||||||
IMP imp = sarray_get(class->dtable,
|
IMP imp = sarray_get(class->dtable,
|
||||||
(size_t)method->method_name->sel_id);
|
(size_t)method->method_name->sel_id);
|
||||||
assert((imp == method->method_imp));
|
NSCAssert((imp == method->method_imp), NSInvalidArgumentException);
|
||||||
sarray_at_put_safe (class->dtable,
|
sarray_at_put_safe (class->dtable,
|
||||||
(sidx) method->method_name->sel_id,
|
(sidx) method->method_name->sel_id,
|
||||||
method->method_imp);
|
method->method_imp);
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#include <Foundation/NSData.h>
|
#include <Foundation/NSData.h>
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
/* Deal with strrchr: */
|
/* Deal with strrchr: */
|
||||||
#if STDC_HEADERS || HAVE_STRING_H
|
#if STDC_HEADERS || HAVE_STRING_H
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue