From dff002032c99d94b1b128202b84f84265220462c Mon Sep 17 00:00:00 2001 From: yeoncheol-kim Date: Thu, 24 Jul 2025 11:45:06 +0900 Subject: [PATCH] INTERNAL: Remove the suffixcurr variable from conn structure --- memcached.c | 15 ++++----------- memcached.h | 1 - 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/memcached.c b/memcached.c index 83eeada6..795b0f34 100644 --- a/memcached.c +++ b/memcached.c @@ -658,7 +658,6 @@ conn *conn_new(const int sfd, STATE_FUNC init_state, c->pcurr = c->ilist; #endif c->icurr = c->ilist; - c->suffixcurr = c->suffixlist; #ifdef SCAN_COMMAND c->pleft = 0; #endif @@ -858,10 +857,9 @@ static void conn_cleanup(conn *c) } #endif - if (c->suffixleft != 0) { - for (; c->suffixleft > 0; c->suffixleft--, c->suffixcurr++) { - cache_free(c->thread->suffix_cache, *(c->suffixcurr)); - } + while (c->suffixleft > 0) { + c->suffixleft--; + cache_free(c->thread->suffix_cache, c->suffixlist[c->suffixleft]); } if (c->write_and_free) { @@ -3117,7 +3115,6 @@ static void process_mget_complete(conn *c, bool return_cas) * To release the items and free the suffixes, the below code is needed. */ c->icurr = c->ilist; - c->suffixcurr = c->suffixlist; if (ret != ENGINE_SUCCESS) { /* Releasing items on ilist and freeing suffixes will be @@ -3273,7 +3270,6 @@ static void process_sasl_auth_complete(conn *c) } else { conn_set_state(c, conn_mwrite); } - c->suffixcurr = c->suffixlist; } else { out_string(c, "AUTH_ERROR"); STATS_ERRORS_NOKEY(c, auth); @@ -8577,7 +8573,6 @@ static inline void process_get_command(conn *c, token_t *tokens, size_t ntokens, * To release the items and free the suffixes, the below code is needed. */ c->icurr = c->ilist; - c->suffixcurr = c->suffixlist; if (ret != ENGINE_SUCCESS) { /* Releasing items on ilist and freeing suffixes will be @@ -14246,10 +14241,8 @@ bool conn_mwrite(conn *c) } #endif while (c->suffixleft > 0) { - char *suffix = *(c->suffixcurr); - cache_free(c->thread->suffix_cache, suffix); - c->suffixcurr++; c->suffixleft--; + cache_free(c->thread->suffix_cache, c->suffixlist[c->suffixleft]); } if (c->coll_eitem != NULL) { conn_coll_eitem_free(c); diff --git a/memcached.h b/memcached.h index a857408d..12c1f412 100644 --- a/memcached.h +++ b/memcached.h @@ -380,7 +380,6 @@ struct conn { char **suffixlist; int suffixsize; - char **suffixcurr; int suffixleft; enum protocol protocol; /* which protocol this connection speaks */