home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ldapsdk.zip / libraries / liblutil / memcmp.c < prev    next >
C/C++ Source or Header  |  2000-06-14  |  417b  |  21 lines

  1. /* $OpenLDAP: pkg/ldap/libraries/liblutil/memcmp.c,v 1.2.8.2 2000/06/13 17:57:25 kurt Exp $ */
  2. #include "portable.h"
  3.  
  4. #include <ac/string.h>
  5.  
  6. /* 
  7.  * Memory Compare
  8.  */
  9. int
  10. (memcmp)(const void *v1, const void *v2, int n) 
  11. {
  12.     if (n != 0) {
  13.         const unsigned char *s1=v1, *s2=v2;
  14.         do {
  15.             if (*s1++ != *s2++)
  16.                 return (*--s1 - *--s2);
  17.         } while (--n != 0);
  18.     }
  19.     return (0);
  20.