idx variable name

This commit is contained in:
Garretonzo 2025-06-09 10:04:14 -07:00
parent c6bbe8031a
commit 2f15e1e3b3

View File

@ -325,9 +325,9 @@ static uint16_t keycode_cache_count = 0;
* returns index of keycode_cache for given key * returns index of keycode_cache for given key
*/ */
static int16_t find_keycode_cache_index(keypos_t key) { static int16_t find_keycode_cache_index(keypos_t key) {
for (uint16_t i = 0; i < keycode_cache_count; ++i) { for (uint16_t keycode_cache_idx = 0; keycode_cache_idx < keycode_cache_count; ++keycode_cache_idx) {
if (keycode_cache[i].row == key.row && keycode_cache[i].col == key.col) { if (keycode_cache[keycode_cache_idx].row == key.row && keycode_cache[keycode_cache_idx].col == key.col) {
return i; return keycode_cache_idx;
} }
} }
return -1; return -1;
@ -338,9 +338,9 @@ static int16_t find_keycode_cache_index(keypos_t key) {
* add to cache of keycodes after a key is pressed down * add to cache of keycodes after a key is pressed down
*/ */
static void add_keycode_cache(keypos_t key, uint16_t keycode) { static void add_keycode_cache(keypos_t key, uint16_t keycode) {
int16_t idx = find_keycode_cache_index(key); int16_t keycode_cache_idx = find_keycode_cache_index(key);
if (idx >= 0) { if (keycode_cache_idx >= 0) {
keycode_cache[idx].keycode = keycode; keycode_cache[keycode_cache_idx].keycode = keycode;
return; return;
} }
if (keycode_cache_count < KEYCODE_CACHE_LIMIT) { if (keycode_cache_count < KEYCODE_CACHE_LIMIT) {
@ -356,9 +356,9 @@ static void add_keycode_cache(keypos_t key, uint16_t keycode) {
* remove from cache of keycodes after a key is released * remove from cache of keycodes after a key is released
*/ */
static void remove_keycode_cache(keypos_t key) { static void remove_keycode_cache(keypos_t key) {
int16_t idx = find_keycode_cache_index(key); int16_t keycode_cache_idx = find_keycode_cache_index(key);
if (idx >= 0) { if (keycode_cache_idx >= 0) {
keycode_cache[idx] = keycode_cache[keycode_cache_count - 1]; keycode_cache[keycode_cache_idx] = keycode_cache[keycode_cache_count - 1];
keycode_cache_count--; keycode_cache_count--;
} }
} }
@ -368,9 +368,9 @@ static void remove_keycode_cache(keypos_t key) {
* reads from cache of keycodes for when a key is releasing * reads from cache of keycodes for when a key is releasing
*/ */
static uint16_t read_keycode_cache(keypos_t key) { static uint16_t read_keycode_cache(keypos_t key) {
int16_t idx = find_keycode_cache_index(key); int16_t keycode_cache_idx = find_keycode_cache_index(key);
if (idx >= 0) { if (keycode_cache_idx >= 0) {
return keycode_cache[idx].keycode; return keycode_cache[keycode_cache_idx].keycode;
} }
return KC_NO; return KC_NO;
} }