diff options
author | Stef <stef@memberwebs.com> | 2010-11-27 15:50:58 +0000 |
---|---|---|
committer | Stef Walter <stef@thewalter.net> | 2010-12-01 03:56:37 +0000 |
commit | 0ce28cbfed5d711405dbfd85f7321b824842e47a (patch) | |
tree | 16f78de36a76676adfcdb6adf1e4f50f1575fe75 /src/misc.c | |
parent | a05ea615bf3d3a4a98b4abed83b51e2c6653d886 (diff) |
Redo raw scrounge so that it's faster.
Diffstat (limited to 'src/misc.c')
-rw-r--r-- | src/misc.c | 32 |
1 files changed, 17 insertions, 15 deletions
@@ -60,25 +60,27 @@ void addLocationLock(drivelocks* locks, uint64 beg, uint64 end) } } -bool checkLocationLock(drivelocks* locks, uint64 sec) +uint64 checkLocationLock(drivelocks* locks, uint64 sec) { - uint32 i; + uint64 locked; + uint32 i; - if(locks->_locks) - { - /* Go through and check for a lock */ - for(i = 0; i < locks->_current; i++) - { - if(sec >= locks->_locks[i].beg && - sec < locks->_locks[i].end) - { - sec = locks->_locks[i].end; - return true; - } - } + if(locks->_locks) + { + /* Go through and check for a lock */ + for(i = 0; i < locks->_current; i++) + { + if(sec >= locks->_locks[i].beg && + sec < locks->_locks[i].end) + { + locked = locks->_locks[i].end - sec; + assert(locked != 0); + return locked; + } + } } - return false; + return 0; } #ifdef _DEBUG |