Explicitly roll over to zero when the element isn't found.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26870 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2008-09-24 12:29:15 +00:00
parent 3d16dda1a5
commit 4052779063
2 changed files with 10 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2008-09-24 08:25-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSUserDefaults.m: -addSuiteNamed change so that we don't
rely on the value of NSNotFound being -(2^32)-1 and a rollover to
0.
2008-09-23 20:31-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* config.mak.in: Added reference to HAVE_OBJC_SYNC_ENTER

View file

@ -925,7 +925,10 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
if (self == sharedDefaults) invalidatedLanguages = YES;
[_searchList removeObject: aName];
index = [_searchList indexOfObject: processName];
index++; // NSNotFound wraps to zero ... insert at start.
if(index == NSNotFound)
{
index = 0; // NSNotFound, insert at start.
}
aName = [aName copy];
[_searchList insertObject: aName atIndex: index];
[_lock unlock];