summaryrefslogtreecommitdiff
path: root/dynamicdevice.c
diff options
context:
space:
mode:
authorLars Hanisch <dvb@flensrocker.de>2011-06-15 23:42:08 +0200
committerLars Hanisch <dvb@flensrocker.de>2011-06-15 23:42:08 +0200
commitcfce06eb88d88e84b363cefd4826ac7aa44bbfd6 (patch)
treea26bf54e6883089ad65746a4ce31cf6a6cae2261 /dynamicdevice.c
parent41adafa231a3130288c7140449c02a3608c6599c (diff)
downloadvdr-plugin-dynamite-cfce06eb88d88e84b363cefd4826ac7aa44bbfd6.tar.gz
vdr-plugin-dynamite-cfce06eb88d88e84b363cefd4826ac7aa44bbfd6.tar.bz2
exit loop while search for free index as soon as possiblev0.0.6d
Diffstat (limited to 'dynamicdevice.c')
-rw-r--r--dynamicdevice.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/dynamicdevice.c b/dynamicdevice.c
index 0c290cd..4910f9b 100644
--- a/dynamicdevice.c
+++ b/dynamicdevice.c
@@ -17,12 +17,15 @@ int cDynamicDevice::IndexOf(const char *DevPath, int &NextFreeIndex, int WishInd
cMutexLock lock(&arrayMutex);
NextFreeIndex = -1;
int index = -1;
- for (int i = 0; (i < numDynamicDevices) && ((index < 0) || (NextFreeIndex < 0) || ((WishIndex >= 0) && (dynamicdevice[i]->CardIndex() != WishIndex))); i++) {
+ for (int i = 0; (i < numDynamicDevices) && ((index < 0) || (NextFreeIndex < 0) || (WishIndex >= 0)); i++) {
if (dynamicdevice[i]->devpath == NULL) {
if (WishIndex >= 0)
isyslog("dynamite: device at slot %d has cardindex %d", i + 1, dynamicdevice[i]->CardIndex());
- if ((NextFreeIndex < 0) || ((WishIndex >= 0) && (dynamicdevice[i]->CardIndex() == WishIndex)))
+ if ((NextFreeIndex < 0) || ((WishIndex >= 0) && (dynamicdevice[i]->CardIndex() == WishIndex))) {
NextFreeIndex = i;
+ if (dynamicdevice[i]->CardIndex() == WishIndex)
+ break;
+ }
}
else if (index < 0) {
if (strcmp(DevPath, **dynamicdevice[i]->devpath) == 0)