diff options
| author | armink <[email protected]> | 2019-03-09 15:46:56 +0800 |
|---|---|---|
| committer | armink <[email protected]> | 2019-03-09 15:46:56 +0800 |
| commit | b2c338970f6332f916ef132f838f6d1f1d52d118 (patch) | |
| tree | b98e5987b2c26f1e45e2905af498ad30ff8b3cd2 /src | |
| parent | 7f3f8d8352218f879b460894b6401c036156a93f (diff) | |
[kservice] Update the rt_strnlen function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/kservice.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/kservice.c b/src/kservice.c index b640107a33..3663766225 100644 --- a/src/kservice.c +++ b/src/kservice.c @@ -461,6 +461,7 @@ rt_int32_t rt_strcmp(const char *cs, const char *ct) return (*cs - *ct); } RTM_EXPORT(rt_strcmp); + /** * The strnlen() function returns the number of characters in the * string pointed to by s, excluding the terminating null byte ('\0'), @@ -476,11 +477,13 @@ rt_size_t rt_strnlen(const char *s, rt_ubase_t maxlen) { const char *sc; - for (sc = s; *sc != '\0' && sc - s < (int)maxlen; ++sc) /* nothing */ + for (sc = s; *sc != '\0' && (rt_ubase_t)(sc - s) < maxlen; ++sc) /* nothing */ ; return sc - s; } +RTM_EXPORT(rt_strnlen); + /** * This function will return the length of a string, which terminate will * null character. |
