From: Alan T. DeKok Date: Tue, 1 Jun 2021 12:08:52 +0000 (-0400) Subject: remove unused functions X-Git-Tag: release_3_0_23~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14f777f4bfc13054e557b6473c64a3aa00843ce1;p=thirdparty%2Ffreeradius-server.git remove unused functions which also make it clearer what the rest of the code does. --- diff --git a/src/include/state.h b/src/include/state.h index 0484b89af5c..d9b47a0605e 100644 --- a/src/include/state.h +++ b/src/include/state.h @@ -40,11 +40,6 @@ void fr_state_discard(REQUEST *request, RADIUS_PACKET *original); void fr_state_get_vps(REQUEST *request, RADIUS_PACKET *packet); bool fr_state_put_vps(REQUEST *request, RADIUS_PACKET *original, RADIUS_PACKET *packet); -void *fr_state_find_data(fr_state_t *state, REQUEST *request, RADIUS_PACKET *packet); -void *fr_state_get_data(fr_state_t *state, REQUEST *request, RADIUS_PACKET *packet); -bool fr_state_put_data(fr_state_t *state, REQUEST *request, RADIUS_PACKET *original, RADIUS_PACKET *packet, - void *data, void (*free_data)(void *)); - #ifdef __cplusplus } #endif diff --git a/src/main/state.c b/src/main/state.c index 366b1a7b203..baf74f528d9 100644 --- a/src/main/state.c +++ b/src/main/state.c @@ -699,97 +699,3 @@ bool fr_state_put_vps(REQUEST *request, RADIUS_PACKET *original, RADIUS_PACKET * VERIFY_REQUEST(request); return true; } - -/* - * Find the opaque data associated with a State attribute. - * Leave the data in the entry. - */ -void *fr_state_find_data(fr_state_t *state, REQUEST *request, RADIUS_PACKET *packet) -{ - void *data; - state_entry_t *entry; - - if (!state) return false; - - PTHREAD_MUTEX_LOCK(&state->mutex); - entry = fr_state_find(state, request->server, packet); - if (!entry) { - PTHREAD_MUTEX_UNLOCK(&state->mutex); - return NULL; - } - - data = entry->opaque; - PTHREAD_MUTEX_UNLOCK(&state->mutex); - - return data; -} - - -/* - * Get the opaque data associated with a State attribute. - * and remove the data from the entry. - */ -void *fr_state_get_data(fr_state_t *state, REQUEST *request, RADIUS_PACKET *packet) -{ - void *data; - state_entry_t *entry; - - if (!state) return NULL; - - PTHREAD_MUTEX_LOCK(&state->mutex); - entry = fr_state_find(state, request->server, packet); - if (!entry) { - PTHREAD_MUTEX_UNLOCK(&state->mutex); - return NULL; - } - - data = entry->opaque; - entry->opaque = NULL; - PTHREAD_MUTEX_UNLOCK(&state->mutex); - - return data; -} - - -/* - * Get the opaque data associated with a State attribute. - * and remove the data from the entry. - */ -bool fr_state_put_data(fr_state_t *state, REQUEST *request, RADIUS_PACKET *original, RADIUS_PACKET *packet, - void *data, void (*free_data)(void *)) -{ - state_entry_t *entry, *old; - - if (!state) return false; - - PTHREAD_MUTEX_LOCK(&state->mutex); - - if (original) { - old = fr_state_find(state, request->server, original); - } else { - old = NULL; - } - - /* - * Create a new entry and add it to the list. - */ - entry = fr_state_entry_create(state, request, packet, old); - if (!entry) { - PTHREAD_MUTEX_UNLOCK(&state->mutex); - return false; - } - - /* - * If we're moving the data, ensure that we delete it - * from the old state. - */ - if (old && (old->opaque == data)) { - old->opaque = NULL; - } - - entry->opaque = data; - entry->free_opaque = free_data; - - PTHREAD_MUTEX_UNLOCK(&state->mutex); - return true; -}