summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http_static.c
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2021-12-09 02:46:20 +0100
committerAlejandro Colomar <alx.manpages@gmail.com>2022-05-16 10:27:07 +0200
commit5302faace297f2e9b104fbebafb46cc0521d2a5a (patch)
tree79b074afca91c54ba9f24383f7c3eb03bc789b7a /src/nxt_http_static.c
parentfa42d858a2967d49e1ee832b145dfcace89aeed7 (diff)
downloadunit-5302faace297f2e9b104fbebafb46cc0521d2a5a.tar.gz
unit-5302faace297f2e9b104fbebafb46cc0521d2a5a.tar.bz2
Renamed nxt_http_static_ctx_t field 'index' to 'share_idx'.
Having a configurable index filename will require adding an index field to this structure. The most natural name for that field is 'index', so the current index field should be renamed to allow for that. A sensible name is 'share_idx', since it's the index of the shares array in 'nxt_http_static_conf_t'. Instead of 'share_index' I opted for the shorter 'share_idx'. Also, when 'index' allows an array of filenames in a following commit, another similar variable 'index_idx' should be created, and having a different prefix and suffix seems more readable than for example 'index_index'.
Diffstat (limited to 'src/nxt_http_static.c')
-rw-r--r--src/nxt_http_static.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nxt_http_static.c b/src/nxt_http_static.c
index 5231f98e..c9483b63 100644
--- a/src/nxt_http_static.c
+++ b/src/nxt_http_static.c
@@ -33,7 +33,7 @@ typedef struct {
#if (NXT_HAVE_OPENAT2)
nxt_str_t chroot;
#endif
- uint32_t index;
+ uint32_t share_idx;
uint8_t need_body; /* 1 bit */
} nxt_http_static_ctx_t;
@@ -218,7 +218,7 @@ nxt_http_static_iterate(nxt_task_t *task, nxt_http_request_t *r,
conf = ctx->action->u.conf;
- share = &conf->shares[ctx->index];
+ share = &conf->shares[ctx->share_idx];
#if (NXT_DEBUG)
nxt_str_t shr;
@@ -245,7 +245,7 @@ nxt_http_static_iterate(nxt_task_t *task, nxt_http_request_t *r,
nxt_var_raw(share->var, &ctx->share);
#if (NXT_HAVE_OPENAT2)
- if (conf->chroot != NULL && ctx->index == 0) {
+ if (conf->chroot != NULL && ctx->share_idx == 0) {
nxt_var_raw(conf->chroot, &ctx->chroot);
}
#endif
@@ -262,7 +262,7 @@ nxt_http_static_iterate(nxt_task_t *task, nxt_http_request_t *r,
nxt_var_query(task, r->var_query, share->var, &ctx->share);
#if (NXT_HAVE_OPENAT2)
- if (conf->chroot != NULL && ctx->index == 0) {
+ if (conf->chroot != NULL && ctx->share_idx == 0) {
nxt_var_query(task, r->var_query, conf->chroot, &ctx->chroot);
}
#endif
@@ -357,7 +357,7 @@ nxt_http_static_send_ready(nxt_task_t *task, void *obj, void *data)
nxt_uint_t resolve;
nxt_http_static_share_t *share;
- share = &conf->shares[ctx->index];
+ share = &conf->shares[ctx->share_idx];
resolve = conf->resolve;
chr = &ctx->chroot;
@@ -659,9 +659,9 @@ nxt_http_static_next(nxt_task_t *task, nxt_http_request_t *r,
action = ctx->action;
conf = action->u.conf;
- ctx->index++;
+ ctx->share_idx++;
- if (ctx->index < conf->nshares) {
+ if (ctx->share_idx < conf->nshares) {
nxt_http_static_iterate(task, r, ctx);
return;
}