[PATCH] Core: add support for expressing size in gigabytes

Maxim Dounin mdounin at mdounin.ru
Fri Aug 1 03:47:15 UTC 2014


Hello!

On Thu, Jul 31, 2014 at 03:41:30AM -0700, Piotr Sikora wrote:

> # HG changeset patch
> # User Piotr Sikora <piotr at cloudflare.com>
> # Date 1406803246 25200
> #      Thu Jul 31 03:40:46 2014 -0700
> # Node ID c1aeec0f33fe6a42fde0a1851228a130f5ab12a1
> # Parent  e0eaf2d92a8cee90abe592d7ac01d3118cb0853a
> Core: add support for expressing size in gigabytes.
> 
> Signed-off-by: Piotr Sikora <piotr at cloudflare.com>
> 
> diff -r e0eaf2d92a8c -r c1aeec0f33fe src/core/ngx_parse.c
> --- a/src/core/ngx_parse.c	Wed Jul 30 04:32:16 2014 -0700
> +++ b/src/core/ngx_parse.c	Thu Jul 31 03:40:46 2014 -0700
> @@ -33,6 +33,12 @@ ngx_parse_size(ngx_str_t *line)
>          scale = 1024 * 1024;
>          break;
>  
> +    case 'G':
> +    case 'g':
> +        len--;
> +        scale = 1024 * 1024 * 1024;
> +        break;
> +
>      default:
>          scale = 1;
>      }

Memory sizes in gigabytes are almost always wrong, and we 
intentionally don't understand gigabytes here as an additional 
safety belt.

I don't think this should be added.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx-devel mailing list