File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
src/modules/systemlib/param Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ param_for_used_index(unsigned index)
287
287
/* we found the right used count,
288
288
* return the param value
289
289
*/
290
- if (i == count ) {
290
+ if (index == count ) {
291
291
return (param_t )i ;
292
292
}
293
293
@@ -303,16 +303,19 @@ param_for_used_index(unsigned index)
303
303
int
304
304
param_get_index (param_t param )
305
305
{
306
- if (handle_in_range (param ))
306
+ if (handle_in_range (param )) {
307
307
return (unsigned )param ;
308
+ }
308
309
309
310
return -1 ;
310
311
}
311
312
312
313
int
313
314
param_get_used_index (param_t param )
314
315
{
315
- if (!handle_in_range (param )) {
316
+ int param_storage_index = param_get_index (param );
317
+
318
+ if (param_storage_index < 0 ) {
316
319
return -1 ;
317
320
}
318
321
@@ -322,12 +325,17 @@ param_get_used_index(param_t param)
322
325
for (unsigned i = 0 ; i < (unsigned )param + 1 ; i ++ ) {
323
326
for (unsigned j = 0 ; j < 8 ; j ++ ) {
324
327
if (param_changed_storage [i ] & (1 << j )) {
328
+
329
+ if (param_storage_index == i ) {
330
+ return count ;
331
+ }
332
+
325
333
count ++ ;
326
334
}
327
335
}
328
336
}
329
337
330
- return count ;
338
+ return -1 ;
331
339
}
332
340
333
341
const char *
You can’t perform that action at this time.
0 commit comments