[PATCH: libXdmcp 2/4] XdmcpARRAY8Equal: Use memcmp instead of rolling our own

Matt Turner mattst88 at gmail.com
Wed May 5 13:04:07 PDT 2010


On Wed, May 5, 2010 at 3:47 PM, Alan Coopersmith
<alan.coopersmith at oracle.com> wrote:
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
>  A8Eq.c |    7 ++-----
>  1 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/A8Eq.c b/A8Eq.c
> index 241d953..cf833d1 100644
> --- a/A8Eq.c
> +++ b/A8Eq.c
> @@ -38,12 +38,9 @@ in this Software without prior written authorization from The Open Group.
>  int
>  XdmcpARRAY8Equal (const ARRAY8Ptr array1, const ARRAY8Ptr array2)
>  {
> -    int        i;
> -
>     if (array1->length != array2->length)
>        return FALSE;
> -    for (i = 0; i < (int)array1->length; i++)
> -       if (array1->data[i] != array2->data[i])
> -           return FALSE;
> +    if (memcmp(array1->data, array2->data, array1->length) != 0)
> +       return FALSE;
>     return TRUE;
>  }
> --
> 1.5.6.5
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>

Reviewed-by: Matt Turner <mattst88 at gmail.com>


More information about the xorg-devel mailing list