From 5ea77a75dd2d2158401331879f3c8f47940a732c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 18:35:32 +0200 Subject: Adding upstream version 2.5.13+dfsg. Signed-off-by: Daniel Baumann --- libraries/liblutil/memcmp.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 libraries/liblutil/memcmp.c (limited to 'libraries/liblutil/memcmp.c') diff --git a/libraries/liblutil/memcmp.c b/libraries/liblutil/memcmp.c new file mode 100644 index 0000000..8068de3 --- /dev/null +++ b/libraries/liblutil/memcmp.c @@ -0,0 +1,33 @@ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software . + * + * Copyright 1998-2022 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in the file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * . + */ + +#include "portable.h" + +#include + +/* + * Memory Compare + */ +int +(lutil_memcmp)(const void *v1, const void *v2, size_t n) +{ + if (n != 0) { + const unsigned char *s1=v1, *s2=v2; + do { + if (*s1++ != *s2++) return *--s1 - *--s2; + } while (--n != 0); + } + return 0; +} -- cgit v1.2.3