Changeset df24ec3 in mainline


Ignore:
Timestamp:
2007-01-17T21:45:15Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c7611b3
Parents:
df4ed85
Message:

Add bcmp() to libc.

Location:
uspace/libc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/libc/generic/string.c

    rdf4ed85 rdf24ec3  
    103103}
    104104
     105/** Compare two memory areas.
     106 *
     107 * @param s1    Pointer to the first area to compare.
     108 * @param s2    Pointer to the second area to compare.
     109 * @param len   Size of the first area in bytes. Both areas must have the same
     110 *              length.
     111 * @return      If len is 0, return zero. If the areas match, return zero.
     112 *              Otherwise return non-zero.
     113 */
     114int bcmp(const char *s1, const char *s2, size_t len)
     115{
     116        for (; len && *s1++ == *s2++; len--)
     117                ;
     118        return len;
     119}
    105120
    106121/** Count the number of characters in the string, not including terminating 0.
  • uspace/libc/include/string.h

    rdf4ed85 rdf24ec3  
    4444void * memmove(void *dest, const void *src, size_t n);
    4545
     46int bcmp(const char *s1, const char *s2, size_t n);
     47
    4648int strcmp(const char *, const char *);
    4749
Note: See TracChangeset for help on using the changeset viewer.