mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 09:41:15 +00:00
Memory management nad documentation fixes.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35584 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6891e5699d
commit
0138c51065
7 changed files with 189 additions and 159 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2012-09-21 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSArray.m:
|
||||||
|
* Source/NSDate.m:
|
||||||
|
* Source/NSDictionary.m:
|
||||||
|
* Headers/Foundation/NSArray.h:
|
||||||
|
Comment/documentation fixups to avoid warnings etc.
|
||||||
|
* Tools/AGSParser.h:
|
||||||
|
* Tools/AGSParser.m:
|
||||||
|
Fix memory management error causing reference to deallocated object.
|
||||||
|
|
||||||
2012-09-20 Niels Grewe <niels.grewe@halbordnung.de>
|
2012-09-20 Niels Grewe <niels.grewe@halbordnung.de>
|
||||||
|
|
||||||
* Source/GSTimSort.m: A few more timsort bugfixes.
|
* Source/GSTimSort.m: A few more timsort bugfixes.
|
||||||
|
|
|
@ -39,7 +39,26 @@ extern "C" {
|
||||||
@class NSURL;
|
@class NSURL;
|
||||||
@class NSIndexSet;
|
@class NSIndexSet;
|
||||||
|
|
||||||
@interface NSArray : NSObject <NSCoding, NSCopying, NSMutableCopying, NSFastEnumeration>
|
#if OS_API_VERSION(100600, GS_API_LATEST)
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
NSBinarySearchingFirstEqual = (1UL << 8), /** Specifies that the binary
|
||||||
|
* search should find the first object equal in the array.
|
||||||
|
*/
|
||||||
|
NSBinarySearchingLastEqual = (1UL << 9), /** Specifies that the binary
|
||||||
|
* search should find the last object equal in the array.
|
||||||
|
*/
|
||||||
|
NSBinarySearchingInsertionIndex = (1UL << 10), /** Specifies that the binary
|
||||||
|
* search should find the index at which an equal object should be inserted
|
||||||
|
* in order to keep the array sorted
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef NSUInteger NSBinarySearchingOptions;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@interface NSArray : NSObject
|
||||||
|
<NSCoding, NSCopying, NSMutableCopying, NSFastEnumeration>
|
||||||
|
|
||||||
+ (id) array;
|
+ (id) array;
|
||||||
+ (id) arrayWithArray: (NSArray*)array;
|
+ (id) arrayWithArray: (NSArray*)array;
|
||||||
|
@ -54,7 +73,11 @@ extern "C" {
|
||||||
- (NSArray*) arrayByAddingObject: (id)anObject;
|
- (NSArray*) arrayByAddingObject: (id)anObject;
|
||||||
- (NSArray*) arrayByAddingObjectsFromArray: (NSArray*)anotherArray;
|
- (NSArray*) arrayByAddingObjectsFromArray: (NSArray*)anotherArray;
|
||||||
- (BOOL) containsObject: anObject;
|
- (BOOL) containsObject: anObject;
|
||||||
- (NSUInteger) count; // Primitive
|
|
||||||
|
/** <override-subclass />
|
||||||
|
* Returns the number of elements contained in the receiver.
|
||||||
|
*/
|
||||||
|
- (NSUInteger) count;
|
||||||
- (void) getObjects: (__unsafe_unretained id[])aBuffer;
|
- (void) getObjects: (__unsafe_unretained id[])aBuffer;
|
||||||
- (void) getObjects: (__unsafe_unretained id[])aBuffer range: (NSRange)aRange;
|
- (void) getObjects: (__unsafe_unretained id[])aBuffer range: (NSRange)aRange;
|
||||||
- (NSUInteger) indexOfObject: (id)anObject;
|
- (NSUInteger) indexOfObject: (id)anObject;
|
||||||
|
@ -71,10 +94,24 @@ extern "C" {
|
||||||
- (id) initWithContentsOfURL: (NSURL*)aURL;
|
- (id) initWithContentsOfURL: (NSURL*)aURL;
|
||||||
#endif
|
#endif
|
||||||
- (id) initWithObjects: firstObject, ...;
|
- (id) initWithObjects: firstObject, ...;
|
||||||
- (id) initWithObjects: (const id[])objects count: (NSUInteger)count; // Primitive
|
|
||||||
|
|
||||||
|
/** <init /> <override-subclass />
|
||||||
|
* This should initialize the array with count (may be zero) objects.<br />
|
||||||
|
* Retains each object placed in the array.<br />
|
||||||
|
* Calls -init (which does nothing but maintain MacOS-X compatibility),
|
||||||
|
* and needs to be re-implemented in subclasses in order to have all
|
||||||
|
* other initialisers work.
|
||||||
|
*/
|
||||||
|
- (id) initWithObjects: (const id[])objects
|
||||||
|
count: (NSUInteger)count;
|
||||||
- (id) lastObject;
|
- (id) lastObject;
|
||||||
- (id) objectAtIndex: (NSUInteger)index; // Primitive
|
|
||||||
|
/** <override-subclass />
|
||||||
|
* Returns the object at the specified index.
|
||||||
|
* Raises an exception of the index is beyond the array.
|
||||||
|
*/
|
||||||
|
- (id) objectAtIndex: (NSUInteger)index;
|
||||||
|
|
||||||
#if OS_API_VERSION(100400, GS_API_LATEST)
|
#if OS_API_VERSION(100400, GS_API_LATEST)
|
||||||
- (NSArray *) objectsAtIndexes: (NSIndexSet *)indexes;
|
- (NSArray *) objectsAtIndexes: (NSIndexSet *)indexes;
|
||||||
#endif
|
#endif
|
||||||
|
@ -213,35 +250,19 @@ DEFINE_BLOCK_TYPE(GSPredicateBlock, BOOL, id, NSUInteger, BOOL*);
|
||||||
options: (NSEnumerationOptions)opts
|
options: (NSEnumerationOptions)opts
|
||||||
passingTest: (GSPredicateBlock)predicate;
|
passingTest: (GSPredicateBlock)predicate;
|
||||||
|
|
||||||
/**
|
/** Returns a sorted array using the comparator to determine the
|
||||||
* Returns a sorted array using the block to determine the order of objects.
|
* order of objects.
|
||||||
*/
|
*/
|
||||||
- (NSArray *)sortedArrayUsingComparator:(NSComparator)cmptr;
|
- (NSArray *) sortedArrayUsingComparator: (NSComparator)comparator;
|
||||||
|
|
||||||
/**
|
/** Returns a sorted array using the block to determine the order of objects.
|
||||||
* Returns a sorted array using the block to determine the order of objects.
|
|
||||||
*
|
*
|
||||||
* The opts argument is a bitfield. Setting the NSSortConcurrent flag
|
* The opts argument is a bitfield. Setting the NSSortConcurrent flag
|
||||||
* specifies that it is thread-safe. The NSSortStable bit specifies that
|
* specifies that it is thread-safe. The NSSortStable bit specifies that
|
||||||
* it should keep equal objects in the same order.
|
* it should keep equal objects in the same order.
|
||||||
*/
|
*/
|
||||||
- (NSArray *)sortedArrayWithOptions:(NSSortOptions)opts usingComparator:(NSComparator)cmptr;
|
- (NSArray *) sortedArrayWithOptions: (NSSortOptions)options
|
||||||
|
usingComparator: (NSComparator)comparator;
|
||||||
enum
|
|
||||||
{
|
|
||||||
NSBinarySearchingFirstEqual = (1UL << 8), /** Specifies that the binary
|
|
||||||
* search should find the first object equal in the array.
|
|
||||||
*/
|
|
||||||
NSBinarySearchingLastEqual = (1UL << 9), /** Specifies that the binary
|
|
||||||
* search should find the last object equal in the array.
|
|
||||||
*/
|
|
||||||
NSBinarySearchingInsertionIndex = (1UL << 10), /** Specifies that the binary
|
|
||||||
* search should find the index at which an equal object should be inserted
|
|
||||||
* in order to keep the array sorted
|
|
||||||
*/
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef NSUInteger NSBinarySearchingOptions;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a binary search of the array within the specified range for the
|
* Performs a binary search of the array within the specified range for the
|
||||||
|
@ -249,10 +270,10 @@ typedef NSUInteger NSBinarySearchingOptions;
|
||||||
* If NSBinarySearchingInsertionIndex is specified, searches for the index
|
* If NSBinarySearchingInsertionIndex is specified, searches for the index
|
||||||
* at which such an object should be inserted.
|
* at which such an object should be inserted.
|
||||||
*/
|
*/
|
||||||
- (NSUInteger)indexOfObject:(id)obj
|
- (NSUInteger) indexOfObject: (id)key
|
||||||
inSortedRange:(NSRange)r
|
inSortedRange: (NSRange)range
|
||||||
options:(NSBinarySearchingOptions)opts
|
options: (NSBinarySearchingOptions)options
|
||||||
usingComparator:(NSComparator)cmp;
|
usingComparator: (NSComparator)comparator;
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* Accessor for subscripting. This is called by the compiler when you write
|
* Accessor for subscripting. This is called by the compiler when you write
|
||||||
|
@ -266,30 +287,66 @@ typedef NSUInteger NSBinarySearchingOptions;
|
||||||
|
|
||||||
+ (id) arrayWithCapacity: (NSUInteger)numItems;
|
+ (id) arrayWithCapacity: (NSUInteger)numItems;
|
||||||
|
|
||||||
- (void) addObject: (id)anObject; // Primitive
|
/** <override-subclass />
|
||||||
|
* Adds anObject at the end of the array, thus increasing the size of
|
||||||
|
* the array. The object is retained upon addition.
|
||||||
|
*/
|
||||||
|
- (void) addObject: (id)anObject;
|
||||||
- (void) addObjectsFromArray: (NSArray*)otherArray;
|
- (void) addObjectsFromArray: (NSArray*)otherArray;
|
||||||
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
||||||
- (void) exchangeObjectAtIndex: (NSUInteger)i1
|
- (void) exchangeObjectAtIndex: (NSUInteger)i1
|
||||||
withObjectAtIndex: (NSUInteger)i2;
|
withObjectAtIndex: (NSUInteger)i2;
|
||||||
#endif
|
#endif
|
||||||
- (id) initWithCapacity: (NSUInteger)numItems; // Primitive
|
|
||||||
- (void) insertObject: (id)anObject atIndex: (NSUInteger)index; // Primitive
|
/** <init /> <override-subclass />
|
||||||
|
* Initialise the array with the specified capacity ... this
|
||||||
|
* should ensure that the array can have numItems added efficiently.<br />
|
||||||
|
* Calls -init (which does nothing but maintain MacOS-X compatibility),
|
||||||
|
* and needs to be re-implemented in subclasses in order to have all
|
||||||
|
* other initialisers work.
|
||||||
|
*/
|
||||||
|
- (id) initWithCapacity: (NSUInteger)numItems;
|
||||||
|
|
||||||
|
/** <override-subclass />
|
||||||
|
* Inserts an object into the receiver at the specified location.<br />
|
||||||
|
* Raises an exception if given an array index which is too large.<br />
|
||||||
|
* The size of the array increases by one.<br />
|
||||||
|
* The object is retained by the array.
|
||||||
|
*/
|
||||||
|
- (void) insertObject: (id)anObject atIndex: (NSUInteger)index;
|
||||||
#if OS_API_VERSION(100400, GS_API_LATEST)
|
#if OS_API_VERSION(100400, GS_API_LATEST)
|
||||||
- (void) insertObjects: (NSArray *)objects atIndexes: (NSIndexSet *)indexes;
|
- (void) insertObjects: (NSArray *)objects atIndexes: (NSIndexSet *)indexes;
|
||||||
#endif
|
#endif
|
||||||
- (void) removeObjectAtIndex: (NSUInteger)index; // Primitive
|
|
||||||
|
/** <override-subclass />
|
||||||
|
* Removes an object from the receiver at the specified location.<br />
|
||||||
|
* The size of the array decreases by one.<br />
|
||||||
|
* Raises an exception if given an array index which is too large.<br />
|
||||||
|
*/
|
||||||
|
- (void) removeObjectAtIndex: (NSUInteger)index;
|
||||||
|
|
||||||
- (void) removeObjectsAtIndexes: (NSIndexSet *)indexes;
|
- (void) removeObjectsAtIndexes: (NSIndexSet *)indexes;
|
||||||
|
|
||||||
|
/** <override-subclass />
|
||||||
|
* Places an object into the receiver at the specified location.<br />
|
||||||
|
* Raises an exception if given an array index which is too large.<br />
|
||||||
|
* The object is retained by the array.
|
||||||
|
*/
|
||||||
- (void) replaceObjectAtIndex: (NSUInteger)index
|
- (void) replaceObjectAtIndex: (NSUInteger)index
|
||||||
withObject: (id)anObject; // Primitive
|
withObject: (id)anObject;
|
||||||
|
|
||||||
#if OS_API_VERSION(100400, GS_API_LATEST)
|
#if OS_API_VERSION(100400, GS_API_LATEST)
|
||||||
- (void) replaceObjectsAtIndexes: (NSIndexSet *)indexes
|
- (void) replaceObjectsAtIndexes: (NSIndexSet *)indexes
|
||||||
withObjects: (NSArray *)objects;
|
withObjects: (NSArray *)objects;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
- (void) replaceObjectsInRange: (NSRange)aRange
|
- (void) replaceObjectsInRange: (NSRange)aRange
|
||||||
withObjectsFromArray: (NSArray*)anArray;
|
withObjectsFromArray: (NSArray*)anArray;
|
||||||
|
|
||||||
- (void) replaceObjectsInRange: (NSRange)aRange
|
- (void) replaceObjectsInRange: (NSRange)aRange
|
||||||
withObjectsFromArray: (NSArray*)anArray
|
withObjectsFromArray: (NSArray*)anArray
|
||||||
range: (NSRange)anotherRange;
|
range: (NSRange)anotherRange;
|
||||||
|
|
||||||
- (void) setArray: (NSArray *)otherArray;
|
- (void) setArray: (NSArray *)otherArray;
|
||||||
|
|
||||||
- (void) removeAllObjects;
|
- (void) removeAllObjects;
|
||||||
|
|
|
@ -381,9 +381,6 @@ static SEL rlSel;
|
||||||
return [copy initWithArray: self copyItems: YES];
|
return [copy initWithArray: self copyItems: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** <override-subclass />
|
|
||||||
* Returns the number of elements contained in the receiver.
|
|
||||||
*/
|
|
||||||
- (NSUInteger) count
|
- (NSUInteger) count
|
||||||
{
|
{
|
||||||
[self subclassResponsibility: _cmd];
|
[self subclassResponsibility: _cmd];
|
||||||
|
@ -874,13 +871,6 @@ static SEL rlSel;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** <init /> <override-subclass />
|
|
||||||
* This should initialize the array with count (may be zero) objects.<br />
|
|
||||||
* Retains each object placed in the array.<br />
|
|
||||||
* Calls -init (which does nothing but maintain MacOS-X compatibility),
|
|
||||||
* and needs to be re-implemented in subclasses in order to have all
|
|
||||||
* other initialisers work.
|
|
||||||
*/
|
|
||||||
- (id) initWithObjects: (const id[])objects count: (NSUInteger)count
|
- (id) initWithObjects: (const id[])objects count: (NSUInteger)count
|
||||||
{
|
{
|
||||||
self = [self init];
|
self = [self init];
|
||||||
|
@ -912,19 +902,15 @@ static SEL rlSel;
|
||||||
return [copy initWithArray: self copyItems: NO];
|
return [copy initWithArray: self copyItems: NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** <override-subclass />
|
|
||||||
* Returns the object at the specified index.
|
|
||||||
* Raises an exception of the index is beyond the array.
|
|
||||||
*/
|
|
||||||
- (id) objectAtIndex: (NSUInteger)index
|
- (id) objectAtIndex: (NSUInteger)index
|
||||||
{
|
{
|
||||||
[self subclassResponsibility: _cmd];
|
[self subclassResponsibility: _cmd];
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) objectAtIndexedSubscript: (size_t)index
|
- (id) objectAtIndexedSubscript: (size_t)anIndex
|
||||||
{
|
{
|
||||||
return [self objectAtIndex: (NSUInteger)index];
|
return [self objectAtIndex: (NSUInteger)anIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *) objectsAtIndexes: (NSIndexSet *)indexes
|
- (NSArray *) objectsAtIndexes: (NSIndexSet *)indexes
|
||||||
|
@ -1983,23 +1969,12 @@ compare(id elem1, id elem2, void* context)
|
||||||
return NSMutableArrayClass;
|
return NSMutableArrayClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** <init /> <override-subclass />
|
|
||||||
* Initialise the array with the specified capacity ... this
|
|
||||||
* should ensure that the array can have numItems added efficiently.<br />
|
|
||||||
* Calls -init (which does nothing but maintain MacOS-X compatibility),
|
|
||||||
* and needs to be re-implemented in subclasses in order to have all
|
|
||||||
* other initialisers work.
|
|
||||||
*/
|
|
||||||
- (id) initWithCapacity: (NSUInteger)numItems
|
- (id) initWithCapacity: (NSUInteger)numItems
|
||||||
{
|
{
|
||||||
self = [self init];
|
self = [self init];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** <override-subclass />
|
|
||||||
* Adds anObject at the end of the array, thus increasing the size of
|
|
||||||
* the array. The object is retained upon addition.
|
|
||||||
*/
|
|
||||||
- (void) addObject: (id)anObject
|
- (void) addObject: (id)anObject
|
||||||
{
|
{
|
||||||
[self subclassResponsibility: _cmd];
|
[self subclassResponsibility: _cmd];
|
||||||
|
@ -2020,17 +1995,12 @@ compare(id elem1, id elem2, void* context)
|
||||||
RELEASE(tmp);
|
RELEASE(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** <override-subclass />
|
|
||||||
* Places an object into the receiver at the specified location.<br />
|
|
||||||
* Raises an exception if given an array index which is too large.<br />
|
|
||||||
* The object is retained by the array.
|
|
||||||
*/
|
|
||||||
- (void) replaceObjectAtIndex: (NSUInteger)index withObject: (id)anObject
|
- (void) replaceObjectAtIndex: (NSUInteger)index withObject: (id)anObject
|
||||||
{
|
{
|
||||||
[self subclassResponsibility: _cmd];
|
[self subclassResponsibility: _cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setObject: (id)anObject atIndexedSubscript: (size_t)anIndex
|
- (void) setObject: (id)anObject atIndexedSubscript: (size_t)anIndex
|
||||||
{
|
{
|
||||||
[self replaceObjectAtIndex: (NSUInteger)anIndex withObject: anObject];
|
[self replaceObjectAtIndex: (NSUInteger)anIndex withObject: anObject];
|
||||||
}
|
}
|
||||||
|
@ -2083,12 +2053,6 @@ compare(id elem1, id elem2, void* context)
|
||||||
withObjectsFromArray: [anArray subarrayWithRange: anotherRange]];
|
withObjectsFromArray: [anArray subarrayWithRange: anotherRange]];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** <override-subclass />
|
|
||||||
* Inserts an object into the receiver at the specified location.<br />
|
|
||||||
* Raises an exception if given an array index which is too large.<br />
|
|
||||||
* The size of the array increases by one.<br />
|
|
||||||
* The object is retained by the array.
|
|
||||||
*/
|
|
||||||
- (void) insertObject: anObject atIndex: (NSUInteger)index
|
- (void) insertObject: anObject atIndex: (NSUInteger)index
|
||||||
{
|
{
|
||||||
[self subclassResponsibility: _cmd];
|
[self subclassResponsibility: _cmd];
|
||||||
|
@ -2113,11 +2077,6 @@ compare(id elem1, id elem2, void* context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** <override-subclass />
|
|
||||||
* Removes an object from the receiver at the specified location.<br />
|
|
||||||
* The size of the array decreases by one.<br />
|
|
||||||
* Raises an exception if given an array index which is too large.<br />
|
|
||||||
*/
|
|
||||||
- (void) removeObjectAtIndex: (NSUInteger)index
|
- (void) removeObjectAtIndex: (NSUInteger)index
|
||||||
{
|
{
|
||||||
[self subclassResponsibility: _cmd];
|
[self subclassResponsibility: _cmd];
|
||||||
|
|
|
@ -1132,10 +1132,10 @@ otherTime(NSDate* other)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) dateByAddingTimeInterval: (NSTimeInterval)seconds
|
- (id) dateByAddingTimeInterval: (NSTimeInterval)ti
|
||||||
{
|
{
|
||||||
return [[self class] dateWithTimeIntervalSinceReferenceDate:
|
return [[self class] dateWithTimeIntervalSinceReferenceDate:
|
||||||
otherTime(self) + seconds];
|
otherTime(self) + ti];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1006,8 +1006,8 @@ compareIt(id o1, id o2, void* context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSSet*)keysOfEntriesWithOptions: (NSEnumerationOptions)opts
|
- (NSSet*) keysOfEntriesWithOptions: (NSEnumerationOptions)opts
|
||||||
passingTest: (GSKeysAndObjectsPredicateBlock)aPredicate;
|
passingTest: (GSKeysAndObjectsPredicateBlock)aPredicate
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* See -enumerateKeysAndObjectsWithOptions:usingBlock: for note about
|
* See -enumerateKeysAndObjectsWithOptions:usingBlock: for note about
|
||||||
|
@ -1031,8 +1031,9 @@ compareIt(id o1, id o2, void* context)
|
||||||
GS_DISPATCH_CREATE_QUEUE_AND_GROUP_FOR_ENUMERATION(enumQueue, opts)
|
GS_DISPATCH_CREATE_QUEUE_AND_GROUP_FOR_ENUMERATION(enumQueue, opts)
|
||||||
FOR_IN(id, key, enumerator)
|
FOR_IN(id, key, enumerator)
|
||||||
obj = (*objectForKey)(self, objectForKeySelector, key);
|
obj = (*objectForKey)(self, objectForKeySelector, key);
|
||||||
# if (__has_feature(blocks) && (GS_USE_LIBDISPATCH == 1))
|
#if (__has_feature(blocks) && (GS_USE_LIBDISPATCH == 1))
|
||||||
dispatch_group_async(enumQueueGroup, enumQueue, ^(void){if (shouldStop)
|
dispatch_group_async(enumQueueGroup, enumQueue, ^(void){
|
||||||
|
if (shouldStop)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1043,12 +1044,12 @@ compareIt(id o1, id o2, void* context)
|
||||||
[setLock unlock];
|
[setLock unlock];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
# else
|
#else
|
||||||
if (CALL_BLOCK(aPredicate, key, obj, &shouldStop))
|
if (CALL_BLOCK(aPredicate, key, obj, &shouldStop))
|
||||||
{
|
{
|
||||||
addObject(buildSet, addObjectSelector, key);
|
addObject(buildSet, addObjectSelector, key);
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
if (YES == shouldStop)
|
if (YES == shouldStop)
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,10 +44,10 @@
|
||||||
/*
|
/*
|
||||||
* The following items are used for logging/debug purposes.
|
* The following items are used for logging/debug purposes.
|
||||||
*/
|
*/
|
||||||
NSString *fileName; /** Not retained - file being parsed. */
|
NSString *fileName; /** The file being parsed. */
|
||||||
NSString *unitName; /** Not retained - unit being parsed. */
|
NSString *unitName; /** The unit being parsed. */
|
||||||
NSString *itemName; /** Not retained - item being parsed. */
|
NSString *itemName; /** The item being parsed. */
|
||||||
NSArray *lines; /** Not retained - line number mapping. */
|
NSArray *lines; /** The line number mapping. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The next few ivars represent the data currently being parsed.
|
* The next few ivars represent the data currently being parsed.
|
||||||
|
|
|
@ -147,6 +147,8 @@
|
||||||
DESTROY(spaces);
|
DESTROY(spaces);
|
||||||
DESTROY(spacenl);
|
DESTROY(spacenl);
|
||||||
DESTROY(source);
|
DESTROY(source);
|
||||||
|
DESTROY(itemName);
|
||||||
|
DESTROY(unitName);
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1922,7 +1924,7 @@ fail:
|
||||||
inHeader = YES;
|
inHeader = YES;
|
||||||
}
|
}
|
||||||
commentsRead = NO;
|
commentsRead = NO;
|
||||||
fileName = name;
|
ASSIGNCOPY(fileName, name);
|
||||||
if (declared == nil)
|
if (declared == nil)
|
||||||
{
|
{
|
||||||
ASSIGN(declared, [fileName lastPathComponent]);
|
ASSIGN(declared, [fileName lastPathComponent]);
|
||||||
|
@ -1977,8 +1979,8 @@ fail:
|
||||||
[source addObject: path];
|
[source addObject: path];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unitName = nil;
|
DESTROY(unitName);
|
||||||
itemName = nil;
|
DESTROY(itemName);
|
||||||
DESTROY(comment);
|
DESTROY(comment);
|
||||||
|
|
||||||
[self setupBuffer];
|
[self setupBuffer];
|
||||||
|
@ -2153,7 +2155,7 @@ fail:
|
||||||
[self log: @"implementation with bad name"];
|
[self log: @"implementation with bad name"];
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
unitName = name;
|
ASSIGNCOPY(unitName, name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* After the class name, we may have a category name or
|
* After the class name, we may have a category name or
|
||||||
|
@ -2171,7 +2173,7 @@ fail:
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
name = [name stringByAppendingFormat: @"(%@)", category];
|
name = [name stringByAppendingFormat: @"(%@)", category];
|
||||||
unitName = name;
|
ASSIGN(unitName, name);
|
||||||
}
|
}
|
||||||
else if (buffer[pos] == ':')
|
else if (buffer[pos] == ':')
|
||||||
{
|
{
|
||||||
|
@ -2240,13 +2242,13 @@ fail:
|
||||||
|
|
||||||
// [self log: @"Found implementation %@", dict];
|
// [self log: @"Found implementation %@", dict];
|
||||||
|
|
||||||
unitName = nil;
|
DESTROY(unitName);
|
||||||
DESTROY(comment);
|
DESTROY(comment);
|
||||||
[arp drain];
|
[arp drain];
|
||||||
return dict;
|
return dict;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
unitName = nil;
|
DESTROY(unitName);
|
||||||
DESTROY(comment);
|
DESTROY(comment);
|
||||||
[arp drain];
|
[arp drain];
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -2279,7 +2281,7 @@ fail:
|
||||||
[self log: @"interface with bad name"];
|
[self log: @"interface with bad name"];
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
unitName = name;
|
ASSIGNCOPY(unitName, name);
|
||||||
|
|
||||||
[dict setObject: @"class" forKey: @"Type"];
|
[dict setObject: @"class" forKey: @"Type"];
|
||||||
[self setStandards: dict];
|
[self setStandards: dict];
|
||||||
|
@ -2302,7 +2304,7 @@ fail:
|
||||||
[dict setObject: category forKey: @"Category"];
|
[dict setObject: category forKey: @"Category"];
|
||||||
[dict setObject: name forKey: @"BaseClass"];
|
[dict setObject: name forKey: @"BaseClass"];
|
||||||
name = [name stringByAppendingFormat: @"(%@)", category];
|
name = [name stringByAppendingFormat: @"(%@)", category];
|
||||||
unitName = name;
|
ASSIGN(unitName, name);
|
||||||
[dict setObject: @"category" forKey: @"Type"];
|
[dict setObject: @"category" forKey: @"Type"];
|
||||||
if ([category length] >= 7
|
if ([category length] >= 7
|
||||||
&& [category compare: @"Private"
|
&& [category compare: @"Private"
|
||||||
|
@ -2396,13 +2398,13 @@ fail:
|
||||||
|
|
||||||
// [self log: @"Found interface %@", dict];
|
// [self log: @"Found interface %@", dict];
|
||||||
|
|
||||||
unitName = nil;
|
DESTROY(unitName);
|
||||||
DESTROY(comment);
|
DESTROY(comment);
|
||||||
[arp drain];
|
[arp drain];
|
||||||
return dict;
|
return dict;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
unitName = nil;
|
DESTROY(unitName);
|
||||||
DESTROY(comment);
|
DESTROY(comment);
|
||||||
[arp drain];
|
[arp drain];
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -2896,7 +2898,7 @@ fail:
|
||||||
{
|
{
|
||||||
[self setStandards: method];
|
[self setStandards: method];
|
||||||
}
|
}
|
||||||
itemName = mname;
|
ASSIGNCOPY(itemName, mname);
|
||||||
|
|
||||||
if (term == ';')
|
if (term == ';')
|
||||||
{
|
{
|
||||||
|
@ -2946,13 +2948,13 @@ fail:
|
||||||
[self appendComment: c to: method];
|
[self appendComment: c to: method];
|
||||||
}
|
}
|
||||||
|
|
||||||
itemName = nil;
|
DESTROY(itemName);
|
||||||
[arp drain];
|
[arp drain];
|
||||||
IF_NO_GC([method autorelease];)
|
IF_NO_GC([method autorelease];)
|
||||||
return method;
|
return method;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
itemName = nil;
|
DESTROY(itemName);
|
||||||
DESTROY(comment);
|
DESTROY(comment);
|
||||||
[arp drain];
|
[arp drain];
|
||||||
RELEASE(method);
|
RELEASE(method);
|
||||||
|
@ -3062,10 +3064,10 @@ fail:
|
||||||
{
|
{
|
||||||
if ([a0 isEqual: a1] == NO)
|
if ([a0 isEqual: a1] == NO)
|
||||||
{
|
{
|
||||||
itemName = token;
|
ASSIGNCOPY(itemName, token);
|
||||||
[self log: @"method args in interface %@ don't match "
|
[self log: @"method args in interface %@ don't match "
|
||||||
@"those in implementation %@", a0, a1];
|
@"those in implementation %@", a0, a1];
|
||||||
itemName = nil;
|
DESTROY(itemName);
|
||||||
[exist setObject: a1 forKey: @"Args"];
|
[exist setObject: a1 forKey: @"Args"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3076,10 +3078,10 @@ fail:
|
||||||
{
|
{
|
||||||
if ([a0 isEqual: a1] == NO)
|
if ([a0 isEqual: a1] == NO)
|
||||||
{
|
{
|
||||||
itemName = token;
|
ASSIGNCOPY(itemName, token);
|
||||||
[self log: @"method types in interface %@ don't match "
|
[self log: @"method types in interface %@ don't match "
|
||||||
@"those in implementation %@", a0, a1];
|
@"those in implementation %@", a0, a1];
|
||||||
itemName = nil;
|
DESTROY(itemName);
|
||||||
[exist setObject: a1 forKey: @"Types"];
|
[exist setObject: a1 forKey: @"Types"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3601,7 +3603,8 @@ fail:
|
||||||
|
|
||||||
[dict setObject: name forKey: @"Name"];
|
[dict setObject: name forKey: @"Name"];
|
||||||
[self setStandards: dict];
|
[self setStandards: dict];
|
||||||
unitName = [NSString stringWithFormat: @"(%@)", name];
|
DESTROY(unitName);
|
||||||
|
unitName = [[NSString alloc] initWithFormat: @"(%@)", name];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Protocols may themselves conform to protocols.
|
* Protocols may themselves conform to protocols.
|
||||||
|
@ -3655,14 +3658,14 @@ fail:
|
||||||
|
|
||||||
// [self log: @"Found protocol %@", dict];
|
// [self log: @"Found protocol %@", dict];
|
||||||
|
|
||||||
unitName = nil;
|
DESTROY(unitName);
|
||||||
DESTROY(comment);
|
DESTROY(comment);
|
||||||
[arp drain];
|
[arp drain];
|
||||||
IF_NO_GC([dict autorelease];)
|
IF_NO_GC([dict autorelease];)
|
||||||
return dict;
|
return dict;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
unitName = nil;
|
DESTROY(unitName);
|
||||||
DESTROY(comment);
|
DESTROY(comment);
|
||||||
[arp drain];
|
[arp drain];
|
||||||
RELEASE(dict);
|
RELEASE(dict);
|
||||||
|
@ -3854,10 +3857,10 @@ fail:
|
||||||
haveSource = NO;
|
haveSource = NO;
|
||||||
DESTROY(declared);
|
DESTROY(declared);
|
||||||
DESTROY(comment);
|
DESTROY(comment);
|
||||||
fileName = nil;
|
DESTROY(fileName);
|
||||||
unitName = nil;
|
DESTROY(unitName);
|
||||||
itemName = nil;
|
DESTROY(itemName);
|
||||||
lines = nil;
|
DESTROY(lines);
|
||||||
buffer = 0;
|
buffer = 0;
|
||||||
length = 0;
|
length = 0;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
|
@ -4108,9 +4111,8 @@ fail:
|
||||||
[data setLength: length*sizeof(unichar)];
|
[data setLength: length*sizeof(unichar)];
|
||||||
buffer = [data mutableBytes];
|
buffer = [data mutableBytes];
|
||||||
pos = 0;
|
pos = 0;
|
||||||
lines = [[NSArray alloc] initWithArray: a];
|
ASSIGN(lines, [NSArray arrayWithArray: a]);
|
||||||
[arp drain];
|
[arp drain];
|
||||||
IF_NO_GC([lines autorelease];)
|
|
||||||
IF_NO_GC([data autorelease];)
|
IF_NO_GC([data autorelease];)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue