my_strdup / my_strndup size_t -> int
This commit is contained in:
parent
9e7a1313bc
commit
ff0f6bb5b1
2 changed files with 4 additions and 4 deletions
|
@ -30,7 +30,7 @@ void print_indent(int level);
|
||||||
|
|
||||||
char *my_strdup(const char *s);
|
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 */
|
#endif /* !STR_H */
|
||||||
|
|
|
@ -183,7 +183,7 @@ void print_indent(int level) {
|
||||||
|
|
||||||
char *my_strdup(const char *s) {
|
char *my_strdup(const char *s) {
|
||||||
char *out;
|
char *out;
|
||||||
size_t count = 0;
|
int count = 0;
|
||||||
while( s[count] )
|
while( s[count] )
|
||||||
++count;
|
++count;
|
||||||
++count;
|
++count;
|
||||||
|
@ -194,9 +194,9 @@ char *my_strdup(const char *s) {
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *my_strndup(const char *s, size_t n) {
|
char *my_strndup(const char *s, int n) {
|
||||||
char *out;
|
char *out;
|
||||||
size_t count = 0;
|
int count = 0;
|
||||||
while( count < n && s[count] )
|
while( count < n && s[count] )
|
||||||
++count;
|
++count;
|
||||||
++count;
|
++count;
|
||||||
|
|
Loading…
Reference in a new issue