Welcome! Log In Create A New Profile

Advanced

[PATCH] CORE: array, reduce var declaration

Ranier Vilela
March 01, 2020 03:00PM
Hi,
Is it in the interest of the nginx team, patches that promote the reduction
of variable declaration?

regards,
Ranier Vilela

--- \dll\nginx-1.17.8\a\core\ngx_array.c 2020-01-21 10:39:42.000000000 -0300
+++ ngx_array.c 2020-03-01 10:51:56.769840300 -0300
@@ -48,10 +48,10 @@
ngx_array_push(ngx_array_t *a)
{
void *elt, *new;
- size_t size;
- ngx_pool_t *p;

if (a->nelts == a->nalloc) {
+ size_t size;
+ ngx_pool_t *p;

/* the array is full */

@@ -94,14 +94,13 @@
void *
ngx_array_push_n(ngx_array_t *a, ngx_uint_t n)
{
- void *elt, *new;
+ void *elt;
size_t size;
- ngx_uint_t nalloc;
- ngx_pool_t *p;

size = n * a->size;

if (a->nelts + n > a->nalloc) {
+ ngx_pool_t *p;

/* the array is full */

@@ -119,6 +118,9 @@
a->nalloc += n;

} else {
+ void *new;
+ ngx_uint_t nalloc;
+
/* allocate a new array */

nalloc = 2 * ((n >= a->nalloc) ? n : a->nalloc);
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] CORE: array, reduce var declaration

Ranier Vilela 272 March 01, 2020 03:00PM

Re: [PATCH] CORE: array, reduce var declaration

Maxim Dounin 185 March 02, 2020 07:26AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 303
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready