diff options
Diffstat (limited to 'src/memset_s.c')
-rw-r--r-- | src/memset_s.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/memset_s.c b/src/memset_s.c index 8b4d342..74c0025 100644 --- a/src/memset_s.c +++ b/src/memset_s.c @@ -7,25 +7,25 @@ #include <errno.h> errno_t -memset_s(void *s, rsize_t smax, int c, rsize_t n) +memset_s (void *s, rsize_t smax, int c, rsize_t n) { - volatile unsigned char *dest = (unsigned char *) s; - errno_t ret = EINVAL; - rsize_t limit = n < smax ? n : smax; + volatile unsigned char *dest = (unsigned char *) s; + errno_t ret = EINVAL; + rsize_t limit = n < smax ? n : smax; - if (!s) - throw_constraint_handler_s("memset_s: s = NULL", ret); - else if (n > RSIZE_MAX) - throw_constraint_handler_s("memset_s: n > RSIZE_MAX", ret); - else if (smax > RSIZE_MAX) - throw_constraint_handler_s("memset_s: smax > RSIZE_MAX", ret); - else if (n > smax) - throw_constraint_handler_s("memset_s: n > smax", ret); - else { - while (limit > 0) - dest[--limit] = (unsigned char)c; - ret = 0; - } - return ret; + if (!s) + throw_constraint_handler_s ("memset_s: s = NULL", ret); + else if (n > RSIZE_MAX) + throw_constraint_handler_s ("memset_s: n > RSIZE_MAX", ret); + else if (smax > RSIZE_MAX) + throw_constraint_handler_s ("memset_s: smax > RSIZE_MAX", ret); + else if (n > smax) + throw_constraint_handler_s ("memset_s: n > smax", ret); + else + { + while (limit > 0) + dest[--limit] = (unsigned char) c; + ret = 0; + } + return ret; } - |