Revision: 6461
http://skim-app.svn.sourceforge.net/skim-app/?rev=6461&view=rev
Author: hofman
Date: 2010-04-16 09:28:04 +0000 (Fri, 16 Apr 2010)
Log Message:
-----------
add mutations ivar to array
Modified Paths:
--------------
trunk/SKIBArray.h
trunk/SKIBArray.m
Modified: trunk/SKIBArray.h
===================================================================
--- trunk/SKIBArray.h 2010-04-15 11:16:24 UTC (rev 6460)
+++ trunk/SKIBArray.h 2010-04-16 09:28:04 UTC (rev 6461)
@@ -41,6 +41,7 @@
@interface SKIBArray : NSArray {
id object[9];
+ unsigned long mutations;
}
@property (nonatomic, retain) IBOutlet id object1, object2, object3, object4,
object5, object6, object7, object8, object9;
@end
Modified: trunk/SKIBArray.m
===================================================================
--- trunk/SKIBArray.m 2010-04-15 11:16:24 UTC (rev 6460)
+++ trunk/SKIBArray.m 2010-04-16 09:28:04 UTC (rev 6461)
@@ -41,17 +41,18 @@
@implementation SKIBArray
-static void setObjectAtIndex(id *object, id obj, NSUInteger i) {
+static void setObjectAtIndex(id *object, id obj, NSUInteger i, unsigned long
*mutationsPtr) {
if (object[i] != obj) {
[object[i] release];
object[i] = [obj retain];
+ (*mutationsPtr)++;
}
}
#define SYNTHESIZE_OBJECT_ACCESSORS(i) \
@dynamic object##i; \
- (id)object##i { return object[i-1]; } \
-- (void)setObject##i:(id)obj { setObjectAtIndex(object, obj, i-1); }
+- (void)setObject##i:(id)obj { setObjectAtIndex(object, obj, i-1, &mutations);
}
SYNTHESIZE_OBJECT_ACCESSORS(1)
SYNTHESIZE_OBJECT_ACCESSORS(2)
@@ -66,7 +67,7 @@
- (void)dealloc {
NSUInteger i;
for (i = 0; i < 9; i++)
- setObjectAtIndex(object, nil, i);
+ setObjectAtIndex(object, nil, i, &mutations);
[super dealloc];
}
@@ -82,12 +83,10 @@
}
- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
objects:(id *)stackbuf count:(NSUInteger)len {
- enum { ATSTART = 0, ATEND = 1 };
- if (state->state == ATSTART) {
- static const unsigned long const_mu = 1;
- state->state = ATEND;
+ if (state->state == 0) {
+ state->state = 1;
state->itemsPtr = object;
- state->mutationsPtr = (unsigned long *)&const_mu;
+ state->mutationsPtr = &mutations;
return [self count];
}
return 0;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit