Skip to content

Commit

Permalink
Var: Removed unused functions and structure fields
Browse files Browse the repository at this point in the history
  • Loading branch information
hongzhidao committed May 9, 2024
1 parent a96895f commit 9d24e28
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 60 deletions.
49 changes: 0 additions & 49 deletions src/nxt_tstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,8 @@ struct nxt_tstr_query_s {
nxt_tstr_state_t *state;
nxt_tstr_cache_t *cache;

nxt_uint_t waiting;
nxt_uint_t failed; /* 1 bit */

void *ctx;
void *data;

nxt_work_handler_t ready;
nxt_work_handler_t error;
};


Expand Down Expand Up @@ -257,17 +251,12 @@ nxt_tstr_query(nxt_task_t *task, nxt_tstr_query_t *query, nxt_tstr_t *tstr,
return NXT_OK;
}

if (nxt_slow_path(query->failed)) {
return NXT_ERROR;
}

if (tstr->type == NXT_TSTR_VAR) {
ret = nxt_var_interpreter(task, query->state, &query->cache->var,
tstr->u.var, val, query->ctx,
tstr->flags & NXT_TSTR_LOGGING);

if (nxt_slow_path(ret != NXT_OK)) {
query->failed = 1;
return NXT_ERROR;
}

Expand All @@ -277,7 +266,6 @@ nxt_tstr_query(nxt_task_t *task, nxt_tstr_query_t *query, nxt_tstr_t *tstr,
tstr->u.js, val, query->ctx);

if (nxt_slow_path(ret != NXT_OK)) {
query->failed = 1;
return NXT_ERROR;
}
#endif
Expand All @@ -299,43 +287,6 @@ nxt_tstr_query(nxt_task_t *task, nxt_tstr_query_t *query, nxt_tstr_t *tstr,
}


nxt_bool_t
nxt_tstr_query_failed(nxt_tstr_query_t *query)
{
return query->failed;
}


void
nxt_tstr_query_resolve(nxt_task_t *task, nxt_tstr_query_t *query, void *data,
nxt_work_handler_t ready, nxt_work_handler_t error)
{
query->data = data;
query->ready = ready;
query->error = error;

if (query->waiting == 0) {
nxt_work_queue_add(&task->thread->engine->fast_work_queue,
query->failed ? query->error : query->ready,
task, query->ctx, query->data);
}
}


void
nxt_tstr_query_handle(nxt_task_t *task, nxt_tstr_query_t *query,
nxt_bool_t failed)
{
query->failed |= failed;

if (--query->waiting == 0) {
nxt_work_queue_add(&task->thread->engine->fast_work_queue,
query->failed ? query->error : query->ready,
task, query->ctx, query->data);
}
}


void
nxt_tstr_query_release(nxt_tstr_query_t *query)
{
Expand Down
5 changes: 0 additions & 5 deletions src/nxt_tstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ nxt_int_t nxt_tstr_query_init(nxt_tstr_query_t **query_p,
nxt_mp_t *mp);
nxt_int_t nxt_tstr_query(nxt_task_t *task, nxt_tstr_query_t *query,
nxt_tstr_t *tstr, nxt_str_t *val);
nxt_bool_t nxt_tstr_query_failed(nxt_tstr_query_t *query);
void nxt_tstr_query_resolve(nxt_task_t *task, nxt_tstr_query_t *query,
void *data, nxt_work_handler_t ready, nxt_work_handler_t error);
void nxt_tstr_query_handle(nxt_task_t *task, nxt_tstr_query_t *query,
nxt_bool_t failed);
void nxt_tstr_query_release(nxt_tstr_query_t *query);


Expand Down
6 changes: 0 additions & 6 deletions src/nxt_var.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,8 @@ struct nxt_var_query_s {

nxt_var_cache_t cache;

nxt_uint_t waiting;
nxt_uint_t failed; /* 1 bit */

void *ctx;
void *data;

nxt_work_handler_t ready;
nxt_work_handler_t error;
};


Expand Down

0 comments on commit 9d24e28

Please sign in to comment.