1/* $OpenLDAP$ */
2/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3 *
4 * Copyright 1998-2011 The OpenLDAP Foundation.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted only as authorized by the OpenLDAP
9 * Public License.
10 *
11 * A copy of this license is available in the file LICENSE in the
12 * top-level directory of the distribution or, alternatively, at
13 * <http://www.OpenLDAP.org/license.html>.
14 */
15
16#include "portable.h"
17
18#include <ac/string.h>
19
20/*
21 * Memory Compare
22 */
23int
24(lutil_memcmp)(const void *v1, const void *v2, size_t n)
25{
26    if (n != 0) {
27		const unsigned char *s1=v1, *s2=v2;
28        do {
29            if (*s1++ != *s2++) return *--s1 - *--s2;
30        } while (--n != 0);
31    }
32    return 0;
33}
34