Changeset 92fd52d7 in mainline for uspace/lib/libc/generic/string.c
- Timestamp:
- 2009-04-09T21:16:50Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7afb4a5
- Parents:
- a2c58f6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/string.c
ra2c58f6 r92fd52d7 607 607 } 608 608 609 /** Count the number of characters in the string, not including terminating 0.610 *611 * @param str String.612 * @return Number of characters in string.613 */614 size_t strlen(const char *str)615 {616 size_t counter = 0;617 618 while (str[counter] != 0)619 counter++;620 621 return counter;622 }623 624 int strcmp(const char *a, const char *b)625 {626 int c = 0;627 628 while (a[c] && b[c] && (!(a[c] - b[c])))629 c++;630 631 return (a[c] - b[c]);632 }633 634 609 int strncmp(const char *a, const char *b, size_t n) 635 610 { … … 871 846 char * strdup(const char *s1) 872 847 { 873 size_t len = str len(s1) + 1;848 size_t len = str_size(s1) + 1; 874 849 void *ret = malloc(len); 875 850
Note:
See TracChangeset
for help on using the changeset viewer.