Improve local variable naming in SSL session cache implementation

Signed-off-by: Hanno Becker <hanno.becker@arm.com>
This commit is contained in:
Hanno Becker 2021-05-14 14:54:00 +01:00
parent 5cf6f7eafe
commit 466ed6fd08

View file

@ -135,17 +135,17 @@ static int ssl_cache_pick_writing_slot( mbedtls_ssl_cache_context *cache,
mbedtls_ssl_cache_entry *old = NULL; mbedtls_ssl_cache_entry *old = NULL;
int count = 0; int count = 0;
mbedtls_ssl_cache_entry *cur, *prv; mbedtls_ssl_cache_entry *cur, *last;
cur = cache->chain; cur = cache->chain;
prv = NULL; last = NULL;
/* Check 1: Is there already an entry with the given session ID? /* Check 1: Is there already an entry with the given session ID?
* *
* If yes, overwrite it. * If yes, overwrite it.
* *
* If not, `count` will hold the size of the session cache * If not, `count` will hold the size of the session cache
* at the end of this loop, and `prv` will point to the last * at the end of this loop, and `last` will point to the last
* entry, both of which will be used later. */ * entry, both of which will be used later. */
while( cur != NULL ) while( cur != NULL )
@ -158,7 +158,7 @@ static int ssl_cache_pick_writing_slot( mbedtls_ssl_cache_context *cache,
goto found; goto found;
} }
prv = cur; last = cur;
cur = cur->next; cur = cur->next;
} }
@ -184,7 +184,7 @@ static int ssl_cache_pick_writing_slot( mbedtls_ssl_cache_context *cache,
old = cur; old = cur;
} }
prv = cur; last = cur;
cur = cur->next; cur = cur->next;
} }
#endif /* MBEDTLS_HAVE_TIME */ #endif /* MBEDTLS_HAVE_TIME */
@ -199,10 +199,10 @@ static int ssl_cache_pick_writing_slot( mbedtls_ssl_cache_context *cache,
return( 1 ); return( 1 );
/* Append to the end of the linked list. */ /* Append to the end of the linked list. */
if( prv == NULL ) if( last == NULL )
cache->chain = cur; cache->chain = cur;
else else
prv->next = cur; last->next = cur;
goto found; goto found;
} }
@ -226,7 +226,7 @@ static int ssl_cache_pick_writing_slot( mbedtls_ssl_cache_context *cache,
old = cache->chain; old = cache->chain;
cache->chain = old->next; cache->chain = old->next;
old->next = NULL; old->next = NULL;
prv->next = old; last->next = old;
#endif /* MBEDTLS_HAVE_TIME */ #endif /* MBEDTLS_HAVE_TIME */
/* Now `old` points to the oldest entry to be overwritten. */ /* Now `old` points to the oldest entry to be overwritten. */