mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
tweaks for clang static analyser warningS
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32048 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7deeb174a4
commit
9eb046056c
6 changed files with 34 additions and 19 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2011-02-11 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSUserDefaults.m:
|
||||
* Source/NSArray.m:
|
||||
* Source/NSString.m:
|
||||
* Source/NSPointerArray.m:
|
||||
* Tools/AGSParser.m:
|
||||
Tweaks to try to avoid clang analyser warnings.
|
||||
* Source/NSPropertyList.m:
|
||||
Revert last change.
|
||||
|
||||
2011-02-11 Stefan Bidigaray <stefanbidi@gmail.com>
|
||||
|
||||
* Source/NSDateFormatter.m: Avoid multiple memory copy operations.
|
||||
|
|
|
@ -1093,11 +1093,11 @@ compare(id elem1, id elem2, void* context)
|
|||
{
|
||||
NSMutableArray *sortedArray;
|
||||
|
||||
sortedArray = [[NSMutableArrayClass allocWithZone:
|
||||
NSDefaultMallocZone()] initWithArray: self copyItems: NO];
|
||||
sortedArray = [[[NSMutableArrayClass allocWithZone:
|
||||
NSDefaultMallocZone()] initWithArray: self copyItems: NO] autorelease];
|
||||
[sortedArray sortUsingFunction: comparator context: context];
|
||||
|
||||
return AUTORELEASE([sortedArray makeImmutableCopyOnFail: NO]);
|
||||
return [sortedArray makeImmutableCopyOnFail: NO];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1107,8 +1107,9 @@ compare(id elem1, id elem2, void* context)
|
|||
- (NSString*) componentsJoinedByString: (NSString*)separator
|
||||
{
|
||||
unsigned int c = [self count];
|
||||
NSMutableString *s = [[NSMutableString alloc] initWithCapacity: c];
|
||||
NSMutableString *s;
|
||||
|
||||
s = [[[NSMutableString alloc] initWithCapacity: c] autorelease];
|
||||
if (c > 0)
|
||||
{
|
||||
unsigned l = [separator length];
|
||||
|
@ -1124,7 +1125,7 @@ compare(id elem1, id elem2, void* context)
|
|||
[s appendString: [[self objectAtIndex: i] description]];
|
||||
}
|
||||
}
|
||||
return AUTORELEASE([s makeImmutableCopyOnFail: NO]);
|
||||
return [s makeImmutableCopyOnFail: NO];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1135,7 +1136,7 @@ compare(id elem1, id elem2, void* context)
|
|||
- (NSArray*) pathsMatchingExtensions: (NSArray*)extensions
|
||||
{
|
||||
unsigned i, c = [self count];
|
||||
NSMutableArray *a = [[NSMutableArray alloc] initWithCapacity: 1];
|
||||
NSMutableArray *a = [[[NSMutableArray alloc] initWithCapacity: 1] autorelease];
|
||||
Class cls = [NSString class];
|
||||
IMP get = [self methodForSelector: oaiSel];
|
||||
IMP add = [a methodForSelector: addSel];
|
||||
|
@ -1152,7 +1153,7 @@ compare(id elem1, id elem2, void* context)
|
|||
}
|
||||
}
|
||||
}
|
||||
return AUTORELEASE([a makeImmutableCopyOnFail: NO]);
|
||||
return [a makeImmutableCopyOnFail: NO];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -261,8 +261,7 @@ static Class concreteClass = Nil;
|
|||
[a addObject: (id)_contents[i]];
|
||||
}
|
||||
}
|
||||
[a makeImmutableCopyOnFail: NO];
|
||||
return a;
|
||||
return [a makeImmutableCopyOnFail: NO];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1781,13 +1781,13 @@ handle_printf_atsign (FILE *stream,
|
|||
{
|
||||
id copy;
|
||||
|
||||
copy = [[GSMutableStringClass allocWithZone: NSDefaultMallocZone()]
|
||||
initWithString: self];
|
||||
copy = [[[GSMutableStringClass allocWithZone: NSDefaultMallocZone()]
|
||||
initWithString: self] autorelease];
|
||||
[copy replaceOccurrencesOfString: replace
|
||||
withString: by
|
||||
options: opts
|
||||
range: searchRange];
|
||||
return [[copy makeImmutableCopyOnFail: NO] autorelease];
|
||||
return [copy makeImmutableCopyOnFail: NO];
|
||||
}
|
||||
|
||||
- (NSString*) stringByReplacingOccurrencesOfString: (NSString*)replace
|
||||
|
@ -1809,10 +1809,10 @@ handle_printf_atsign (FILE *stream,
|
|||
{
|
||||
id copy;
|
||||
|
||||
copy = [[GSMutableStringClass allocWithZone: NSDefaultMallocZone()]
|
||||
initWithString: self];
|
||||
copy = [[[GSMutableStringClass allocWithZone: NSDefaultMallocZone()]
|
||||
initWithString: self] autorelease];
|
||||
[copy replaceCharactersInRange: aRange withString: by];
|
||||
return [[copy makeImmutableCopyOnFail: NO] autorelease];
|
||||
return [copy makeImmutableCopyOnFail: NO];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1908,7 +1908,7 @@ NSLog(@"Creating empty user defaults database");
|
|||
[_lock lock];
|
||||
NS_DURING
|
||||
{
|
||||
if (_dictionaryRep == nil)
|
||||
if (nil == _dictionaryRep)
|
||||
{
|
||||
NSEnumerator *enumerator;
|
||||
NSMutableDictionary *dictRep;
|
||||
|
@ -1925,8 +1925,8 @@ NSLog(@"Creating empty user defaults database");
|
|||
enumerator = [_searchList reverseObjectEnumerator];
|
||||
nImp = [enumerator methodForSelector: nextObjectSel];
|
||||
|
||||
dictRep = [NSMutableDictionaryClass allocWithZone: NSDefaultMallocZone()];
|
||||
dictRep = [dictRep initWithCapacity: 512];
|
||||
dictRep = [NSMutableDictionaryClass alloc];
|
||||
dictRep = [[dictRep initWithCapacity: 512] autorelease];
|
||||
addImp = [dictRep methodForSelector: addSel];
|
||||
|
||||
while ((obj = (*nImp)(enumerator, nextObjectSel)) != nil)
|
||||
|
@ -1939,7 +1939,10 @@ NSLog(@"Creating empty user defaults database");
|
|||
}
|
||||
_dictionaryRep = [dictRep makeImmutableCopyOnFail: NO];
|
||||
}
|
||||
rep = [[_dictionaryRep retain] autorelease];
|
||||
else
|
||||
{
|
||||
rep = [[_dictionaryRep retain] autorelease];
|
||||
}
|
||||
[_lock unlock];
|
||||
}
|
||||
NS_HANDLER
|
||||
|
|
|
@ -2189,6 +2189,7 @@ fail:
|
|||
*/
|
||||
[self skipUnit];
|
||||
DESTROY(comment);
|
||||
RELEASE(arp);
|
||||
return [NSMutableDictionary dictionary];
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue