[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#3583) memcmp.c

Regardless of the libc or implementation of memcmp, the standard C library
repeatedly uses size_t as the type for the third parameter to memcmp.
Sometimes size_t is int, sometimes it is long, but to guarantee
compatibility with the rest of the system libraries, I would think using
size_t instead of some other type would be best.

The compiler error I had was because Sun's Forte C compiler (Sun ONE
Studio 8 or some such)  /opt/SUNWspro/cc found size_t to be defined as

On Fri, 4 Mar 2005, Kurt D. Zeilenga wrote:

>The code exists as some libc's memcmp are not 8-bit
>clean.  Apparently the memcmp on your libc suffers from
>this problem.
>Anyways, I'll commit a more complete fix (providing the
>replacement function in a manner not dependent on the
>system headers) in a bit.
>At 11:49 AM 3/4/2005, erici@motown.cc.utexas.edu wrote:
>>Full_Name: Eric Irrgang
>>Version: 2.2.23
>>OS: Solaris 9
>>Submission from: (NULL) (
>>openldap-2.2.23/libraries/liblutil/memcmp.c either should not exist or should
>>use a more flexible definition to be compliant with standard C:
>>-- openldap-2.2.23.orig/libraries/liblutil/memcmp.c     Thu Jan 20 11:01:04
>>+++ openldap-2.2.23/libraries/liblutil/memcmp.c Thu Mar  3 18:57:03 2005
>>@@ -21,7 +21,7 @@
>>  * Memory Compare
>>  */
>> int
>>-(memcmp)(const void *v1, const void *v2, int n)
>>+(memcmp)(const void *v1, const void *v2, size_t n)
>> {
>>     if (n != 0) {
>>                const unsigned char *s1=v1, *s2=v2;

Eric Irrgang - UT Austin ITS Unix Systems - (512)475-9342