mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-07 16:01:30 +00:00
Replace strnlen with c_strnlen
PUBLISHED_FROM=815cfaea77171761c952966e98466b87b719de06
This commit is contained in:
1 parent
4ca73566b6
commit
e95c074965
4 files changed
+5
-15
No files matched your search
+2
-4
@@ -1751,14 +1751,12 @@ void cs_hmac_sha1(const unsigned char *key, size_t keylen,
|
||||
/* Amalgamated: #include "common/platform.h" */
|
||||
/* Amalgamated: #include "common/str_util.h" */
|
||||
|
||||
#ifdef _MG_PROVIDE_STRNLEN
|
||||
size_t strnlen(const char *s, size_t maxlen) {
|
||||
size_t c_strnlen(const char *s, size_t maxlen) {
|
||||
size_t l = 0;
|
||||
for (; l < maxlen && s[l] != '\0'; l++) {
|
||||
}
|
||||
return l;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define C_SNPRINTF_APPEND_CHAR(ch) \
|
||||
do { \
|
||||
@@ -1887,7 +1885,7 @@ int c_vsnprintf(char *buf, size_t buf_size, const char *fmt, va_list ap) {
|
||||
if (ch == 's') {
|
||||
const char *s = va_arg(ap, const char *); /* Always fetch parameter */
|
||||
int j;
|
||||
int pad = field_width - (precision >= 0 ? strnlen(s, precision) : 0);
|
||||
int pad = field_width - (precision >= 0 ? c_strnlen(s, precision) : 0);
|
||||
for (j = 0; j < pad; j++) {
|
||||
C_SNPRINTF_APPEND_CHAR(' ');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user