Shorten -[XMPPSRVEnumerator XMPP_addEntry:].

This commit is contained in:
Jonathan Schleifer 2011-05-26 18:52:27 +02:00
parent 53a2499381
commit 1337fdded1

View file

@ -270,47 +270,15 @@
break; break;
} }
/* No list with the priority -> create one at the correct place */
for (iter = [list firstListObject]; iter != NULL; iter = iter->next) {
if ([[iter->object firstObject] priority] > [entry priority]) {
OFAutoreleasePool *pool;
pool = [[OFAutoreleasePool alloc] init]; pool = [[OFAutoreleasePool alloc] init];
subList = [OFList list]; subList = [OFList list];
/*
* RFC 2782 says those with weight 0 should be at the
* beginning of the list.
*/
if ([entry weight] > 0)
[subList appendObject: entry]; [subList appendObject: entry];
else
[subList prependObject: entry];
if (iter != NULL)
[list insertObject: subList [list insertObject: subList
beforeListObject: iter]; beforeListObject: iter];
[pool release];
return;
}
}
/* There is no list with a bigger priority -> append */
pool = [[OFAutoreleasePool alloc] init];
subList = [OFList list];
/*
* RFC 2782 says those with weight 0 should be at the beginning of the
* list.
*/
if ([entry weight] > 0)
[subList appendObject: entry];
else else
[subList prependObject: entry];
[list appendObject: subList]; [list appendObject: subList];
[pool release]; [pool release];