Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. #include <string.h>
  3.  
  4. #undef bcmp
  5.  
  6. int
  7. bcmp(const void *ptr1, const void *ptr2, int length)
  8. {
  9.   if (ptr1 == ptr2)
  10.     return 0;
  11.  
  12.   if (ptr1 == 0 || ptr2 == 0)
  13.     return -1;
  14.  
  15.   const char* arg1 = ptr1;
  16.   const char* arg2 = ptr2;
  17.  
  18.   while (length)
  19.   {
  20.     if (*arg1++ != *arg2++)
  21.       return length;
  22.     length--;
  23.   }
  24.  
  25.   return 0;
  26. }
  27.