diff options
author | Valentin Bartenev <vbart@nginx.com> | 2017-06-27 17:27:18 +0300 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2017-06-27 17:27:18 +0300 |
commit | dfd3cc8c0eb7f3479ee08b5e518abd264da56a29 (patch) | |
tree | b6cdbfab23ce9ea2c498bcb0f540d4847472f067 /src/nxt_vector.c | |
parent | f86c80309885230df2960ef8e1db337f04b11926 (diff) | |
download | unit-dfd3cc8c0eb7f3479ee08b5e518abd264da56a29.tar.gz unit-dfd3cc8c0eb7f3479ee08b5e518abd264da56a29.tar.bz2 |
Applied nxt_pointer_to() and nxt_value_at() where possible.
Diffstat (limited to '')
-rw-r--r-- | src/nxt_vector.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nxt_vector.c b/src/nxt_vector.c index faaf2f54..4737248c 100644 --- a/src/nxt_vector.c +++ b/src/nxt_vector.c @@ -16,7 +16,7 @@ nxt_vector_create(nxt_uint_t items, size_t item_size, vector = proto->alloc(pool, sizeof(nxt_vector_t) + items * item_size); if (nxt_fast_path(vector != NULL)) { - vector->start = (char *) vector + sizeof(nxt_vector_t); + vector->start = nxt_pointer_to(vector, sizeof(nxt_vector_t)); vector->items = 0; vector->item_size = item_size; vector->avalaible = items; @@ -112,7 +112,7 @@ nxt_vector_add(nxt_vector_t *vector, const nxt_mem_proto_t *proto, void *pool) } } - item = (char *) vector->start + vector->item_size * vector->items; + item = nxt_pointer_to(vector->start, vector->item_size * vector->items); vector->items++; @@ -143,11 +143,11 @@ nxt_vector_remove(nxt_vector_t *vector, void *item) uint32_t item_size; item_size = vector->item_size; - end = (u_char *) vector->start + item_size * vector->items; + end = nxt_pointer_to(vector->start, item_size * vector->items); last = end - item_size; if (item != last) { - next = (u_char *) item + item_size; + next = nxt_pointer_to(item, item_size); nxt_memmove(item, next, end - next); } |