From ff0f6bb5b1eb352813cec338e257a3365873cec7 Mon Sep 17 00:00:00 2001 From: "Cindy Wang (CindyLinz)" Date: Sat, 17 May 2014 03:17:51 +0800 Subject: [PATCH] my_strdup / my_strndup size_t -> int --- include/r3_str.h | 2 +- src/str.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/r3_str.h b/include/r3_str.h index 9750cd1..e167f24 100644 --- a/include/r3_str.h +++ b/include/r3_str.h @@ -30,7 +30,7 @@ void print_indent(int level); char *my_strdup(const char *s); -char *my_strndup(const char *s, size_t n); +char *my_strndup(const char *s, int n); #endif /* !STR_H */ diff --git a/src/str.c b/src/str.c index 5d0caf8..02087dd 100644 --- a/src/str.c +++ b/src/str.c @@ -183,7 +183,7 @@ void print_indent(int level) { char *my_strdup(const char *s) { char *out; - size_t count = 0; + int count = 0; while( s[count] ) ++count; ++count; @@ -194,9 +194,9 @@ char *my_strdup(const char *s) { return out; } -char *my_strndup(const char *s, size_t n) { +char *my_strndup(const char *s, int n) { char *out; - size_t count = 0; + int count = 0; while( count < n && s[count] ) ++count; ++count;