mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-20 12:16:40 +00:00
Encourage better coding by warning about attempts to remove nil objects
from arrays. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@5131 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b9fe4e75e2
commit
11d14c597d
6 changed files with 88 additions and 32 deletions
|
@ -877,8 +877,14 @@ static NSString *indentStrings[] = {
|
|||
|
||||
- (void) removeObjectIdenticalTo: (id)anObject
|
||||
{
|
||||
unsigned i = [self count];
|
||||
unsigned i;
|
||||
|
||||
if (anObject == nil)
|
||||
{
|
||||
NSLog(@"attempt to remove nil object");
|
||||
return;
|
||||
}
|
||||
i = [self count];
|
||||
if (i > 0)
|
||||
{
|
||||
IMP rem = 0;
|
||||
|
@ -900,13 +906,22 @@ static NSString *indentStrings[] = {
|
|||
|
||||
- (void) removeObject: (id)anObject inRange: (NSRange)aRange
|
||||
{
|
||||
unsigned c = [self count];
|
||||
unsigned s = aRange.location;
|
||||
unsigned i = aRange.location + aRange.length;
|
||||
unsigned c;
|
||||
unsigned s;
|
||||
unsigned i;
|
||||
|
||||
if (anObject == nil)
|
||||
{
|
||||
NSLog(@"attempt to remove nil object");
|
||||
return;
|
||||
}
|
||||
c = [self count];
|
||||
s = aRange.location;
|
||||
i = aRange.location + aRange.length;
|
||||
if (i > c)
|
||||
i = c;
|
||||
|
||||
{
|
||||
i = c;
|
||||
}
|
||||
if (i > s)
|
||||
{
|
||||
IMP rem = 0;
|
||||
|
@ -930,13 +945,22 @@ static NSString *indentStrings[] = {
|
|||
|
||||
- (void) removeObjectIdenticalTo: (id)anObject inRange: (NSRange)aRange
|
||||
{
|
||||
unsigned c = [self count];
|
||||
unsigned s = aRange.location;
|
||||
unsigned i = aRange.location + aRange.length;
|
||||
unsigned c;
|
||||
unsigned s;
|
||||
unsigned i;
|
||||
|
||||
if (anObject == nil)
|
||||
{
|
||||
NSLog(@"attempt to remove nil object");
|
||||
return;
|
||||
}
|
||||
c = [self count];
|
||||
s = aRange.location;
|
||||
i = aRange.location + aRange.length;
|
||||
if (i > c)
|
||||
i = c;
|
||||
|
||||
{
|
||||
i = c;
|
||||
}
|
||||
if (i > s)
|
||||
{
|
||||
IMP rem = 0;
|
||||
|
@ -958,8 +982,14 @@ static NSString *indentStrings[] = {
|
|||
|
||||
- (void) removeObject: (id)anObject
|
||||
{
|
||||
unsigned i = [self count];
|
||||
unsigned i;
|
||||
|
||||
if (anObject == nil)
|
||||
{
|
||||
NSLog(@"attempt to remove nil object");
|
||||
return;
|
||||
}
|
||||
i = [self count];
|
||||
if (i > 0)
|
||||
{
|
||||
IMP rem = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue