attempt tweak to avoid clang/llvm problem

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/performance/trunk@33794 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2011-08-29 05:30:50 +00:00
parent 03479ac8b8
commit c0888bae6e
2 changed files with 7 additions and 1 deletions

View file

@ -1,3 +1,7 @@
2011-08-29 Richard Frith-Macdonald <rfm@gnu.org>
* GSCache.m: Try to fool clang/llvm to avoid useless warning/error.
2011-08-24 Richard Frith-Macdonald <rfm@gnu.org> 2011-08-24 Richard Frith-Macdonald <rfm@gnu.org>
* GSFIFO.h: * GSFIFO.h:

View file

@ -96,6 +96,7 @@
static NSHashTable *allCaches = 0; static NSHashTable *allCaches = 0;
static NSLock *allCachesLock = nil; static NSLock *allCachesLock = nil;
static int itemOffset = 0;
typedef struct { typedef struct {
id delegate; id delegate;
@ -114,7 +115,7 @@ typedef struct {
NSMutableSet *exclude; NSMutableSet *exclude;
NSRecursiveLock *lock; NSRecursiveLock *lock;
} Item; } Item;
#define my ((Item*)&self[1]) #define my ((Item*)((void*)self + itemOffset))
/* /*
* Add item to linked list starting at *first * Add item to linked list starting at *first
@ -201,6 +202,7 @@ static void removeItem(GSCacheItem *item, GSCacheItem **first)
{ {
if (allCaches == 0) if (allCaches == 0)
{ {
itemOffset = class_getInstanceSize(self);
allCaches allCaches
= NSCreateHashTable(NSNonRetainedObjectHashCallBacks, 0); = NSCreateHashTable(NSNonRetainedObjectHashCallBacks, 0);
if ([NSThread isMultiThreaded] == YES) if ([NSThread isMultiThreaded] == YES)