Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4262 → Rev 4264

/trunk/uspace/lib/libc/include/string.h
45,8 → 45,8
/**< No size limit constant */
#define STR_NO_LIMIT ((size_t) -1)
 
/**< Maximum size of a string containing cnt characters */
#define STR_BOUNDS(cnt) (cnt << 2)
/**< Maximum size of a string containing @c length characters */
#define STR_BOUNDS(length) ((length) << 2)
 
extern wchar_t str_decode(const char *str, size_t *offset, size_t sz);
extern int chr_encode(const wchar_t ch, char *str, size_t *offset, size_t sz);
81,7 → 81,6
* TODO: Get rid of this.
*/
 
extern int strcmp(const char *, const char *);
extern int strncmp(const char *, const char *, size_t);
extern int stricmp(const char *, const char *);
 
90,8 → 89,6
 
extern char *strcat(char *, const char *);
 
extern size_t strlen(const char *);
 
extern char *strdup(const char *);
 
extern char *strchr(const char *, int);
/trunk/uspace/lib/libc/include/stdio.h
49,7 → 49,7
int n; \
n = snprintf(buf, sizeof(buf), fmt, ##__VA_ARGS__); \
if (n > 0) \
(void) __SYSCALL3(SYS_KLOG, 1, (sysarg_t) buf, strlen(buf)); \
(void) __SYSCALL3(SYS_KLOG, 1, (sysarg_t) buf, str_size(buf)); \
}
 
typedef struct {
/trunk/uspace/lib/libc/generic/console.c
219,7 → 219,7
size_t len;
ssize_t rc;
 
len = strlen(s);
len = str_size(s);
while (len > 0) {
rc = console_write(s, len);
if (rc < 0)
/trunk/uspace/lib/libc/generic/getopt.c
382,7 → 382,7
current_argv_len = has_equal - current_argv;
has_equal++;
} else
current_argv_len = strlen(current_argv);
current_argv_len = str_size(current_argv);
for (i = 0; long_options[i].name; i++) {
/* find matching long option */
390,7 → 390,7
current_argv_len))
continue;
 
if (strlen(long_options[i].name) ==
if (str_size(long_options[i].name) ==
(unsigned)current_argv_len) {
/* exact match */
match = i;
/trunk/uspace/lib/libc/generic/string.c
606,31 → 606,6
return true;
}
 
/** Count the number of characters in the string, not including terminating 0.
*
* @param str String.
* @return Number of characters in string.
*/
size_t strlen(const char *str)
{
size_t counter = 0;
 
while (str[counter] != 0)
counter++;
 
return counter;
}
 
int strcmp(const char *a, const char *b)
{
int c = 0;
while (a[c] && b[c] && (!(a[c] - b[c])))
c++;
return (a[c] - b[c]);
}
 
int strncmp(const char *a, const char *b, size_t n)
{
size_t c = 0;
870,7 → 845,7
 
char * strdup(const char *s1)
{
size_t len = strlen(s1) + 1;
size_t len = str_size(s1) + 1;
void *ret = malloc(len);
 
if (ret == NULL)