On Wed, Apr 05, 2017 at 11:21:00PM -0700, Christopher Hettrick wrote:

> Hi tech@
> 
> The arguments to malloc() in the EXAMPLE section are not consistent.
> Make a couple other consistency fixes as well.

Committed, thanks,

        -Otto

> 
> Index: malloc.3
> ===================================================================
> RCS file: /cvs/src/lib/libc/stdlib/malloc.3,v
> retrieving revision 1.108
> diff -u -p -r1.108 malloc.3
> --- malloc.3  29 Mar 2017 17:38:37 -0000      1.108
> +++ malloc.3  6 Apr 2017 03:18:49 -0000
> @@ -177,9 +177,9 @@ is set to
>  .Er ENOMEM .
>  .Pp
>  If
> -.Fa size
> -or
>  .Fa nmemb
> +or
> +.Fa size
>  is equal to 0, a unique pointer to an access protected,
>  zero sized object is returned.
>  Access via this pointer will generate a
> @@ -346,7 +346,7 @@ size_t num, size;
>  if (size && num > SIZE_MAX / size)
>       errc(1, EOVERFLOW, "overflow");
>  
> -if ((p = malloc(size * num)) == NULL)
> +if ((p = malloc(num * size)) == NULL)
>       err(1, NULL);
>  .Ed
>  .Pp
> @@ -364,7 +364,7 @@ if (size < 0 || num < 0)
>  if (size && num > INT_MAX / size)
>       errc(1, EOVERFLOW, "overflow");
>  
> -if ((p = malloc(size * num)) == NULL)
> +if ((p = malloc(num * size)) == NULL)
>       err(1, NULL);
>  .Ed
>  .Pp
> @@ -471,9 +471,9 @@ functions conform to
>  .St -ansiC .
>  .Pp
>  If
> -.Fa size
> -or
>  .Fa nmemb
> +or
> +.Fa size
>  are 0, the return value is implementation defined;
>  other conforming implementations may return
>  .Dv NULL

Reply via email to