[Devel] [PATCH 06/10] get_pagesize(): init var @ declaration and simplify

Kir Kolyshkin kir at openvz.org
Tue May 7 05:09:27 PDT 2013


On 05/06/2013 11:42 PM, Igor Podlesny wrote:
> ---
>   src/lib/util.c |    5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/src/lib/util.c b/src/lib/util.c
> index febb676..9d8912e 100644
> --- a/src/lib/util.c
> +++ b/src/lib/util.c
> @@ -472,11 +472,10 @@ char *subst_VEID(envid_t veid, char *src)
>   
>   int get_pagesize()
>   {
> -	long pagesize;
> +	long pagesize = sysconf(_SC_PAGESIZE);
>   
> -	if ((pagesize = sysconf(_SC_PAGESIZE)) == -1) {
> +	if (-1 == pagesize) {

please no yoda conditions

>   		logger(-1, errno, "Unable to get page size");
> -		return -1;
>   	}
>   	return pagesize;
>   }




More information about the Devel mailing list