libc: snprintf/..: match implementation to declaration

The identifiers used in the declaration and definition of a function
shall be identical [MISRAC2012-RULE_8_3-b]

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2021-03-27 10:33:33 -04:00
commit 27af48417e
2 changed files with 14 additions and 14 deletions

View file

@ -32,19 +32,19 @@ typedef int FILE;
#define stderr ((FILE *) 3)
int __printf_like(1, 2) printf(const char *_MLIBC_RESTRICT fmt, ...);
int __printf_like(3, 4) snprintf(char *_MLIBC_RESTRICT s, size_t len,
int __printf_like(3, 4) snprintf(char *_MLIBC_RESTRICT str, size_t len,
const char *_MLIBC_RESTRICT fmt, ...);
int __printf_like(2, 3) sprintf(char *_MLIBC_RESTRICT s,
int __printf_like(2, 3) sprintf(char *_MLIBC_RESTRICT str,
const char *_MLIBC_RESTRICT fmt, ...);
int __printf_like(2, 3) fprintf(FILE * _MLIBC_RESTRICT stream,
const char *_MLIBC_RESTRICT format, ...);
int __printf_like(1, 0) vprintf(const char *_MLIBC_RESTRICT fmt, va_list list);
int __printf_like(3, 0) vsnprintf(char *_MLIBC_RESTRICT s, size_t len,
int __printf_like(3, 0) vsnprintf(char *_MLIBC_RESTRICT str, size_t len,
const char *_MLIBC_RESTRICT fmt,
va_list list);
int __printf_like(2, 0) vsprintf(char *_MLIBC_RESTRICT s,
int __printf_like(2, 0) vsprintf(char *_MLIBC_RESTRICT str,
const char *_MLIBC_RESTRICT fmt, va_list list);
int __printf_like(2, 0) vfprintf(FILE * _MLIBC_RESTRICT stream,
const char *_MLIBC_RESTRICT format,

View file

@ -25,7 +25,7 @@ static int sprintf_out(int c, struct emitter *p)
return 0; /* indicate keep going so we get the total count */
}
int snprintf(char *_MLIBC_RESTRICT s, size_t len,
int snprintf(char *_MLIBC_RESTRICT str, size_t len,
const char *_MLIBC_RESTRICT format, ...)
{
va_list vargs;
@ -35,10 +35,10 @@ int snprintf(char *_MLIBC_RESTRICT s, size_t len,
char dummy;
if (len == 0) {
s = &dummy; /* write final NUL to dummy, can't change *s */
str = &dummy; /* write final NUL to dummy, can't change *s */
}
p.ptr = s;
p.ptr = str;
p.len = (int) len;
va_start(vargs, format);
@ -49,14 +49,14 @@ int snprintf(char *_MLIBC_RESTRICT s, size_t len,
return r;
}
int sprintf(char *_MLIBC_RESTRICT s, const char *_MLIBC_RESTRICT format, ...)
int sprintf(char *_MLIBC_RESTRICT str, const char *_MLIBC_RESTRICT format, ...)
{
va_list vargs;
struct emitter p;
int r;
p.ptr = s;
p.ptr = str;
p.len = (int) 0x7fffffff; /* allow up to "maxint" characters */
va_start(vargs, format);
@ -67,7 +67,7 @@ int sprintf(char *_MLIBC_RESTRICT s, const char *_MLIBC_RESTRICT format, ...)
return r;
}
int vsnprintf(char *_MLIBC_RESTRICT s, size_t len,
int vsnprintf(char *_MLIBC_RESTRICT str, size_t len,
const char *_MLIBC_RESTRICT format, va_list vargs)
{
struct emitter p;
@ -75,10 +75,10 @@ int vsnprintf(char *_MLIBC_RESTRICT s, size_t len,
char dummy;
if (len == 0) {
s = &dummy; /* write final NUL to dummy, can't change * *s */
str = &dummy; /* write final NUL to dummy, can't change * *s */
}
p.ptr = s;
p.ptr = str;
p.len = (int) len;
r = cbvprintf(sprintf_out, (void *) (&p), format, vargs);
@ -87,13 +87,13 @@ int vsnprintf(char *_MLIBC_RESTRICT s, size_t len,
return r;
}
int vsprintf(char *_MLIBC_RESTRICT s, const char *_MLIBC_RESTRICT format,
int vsprintf(char *_MLIBC_RESTRICT str, const char *_MLIBC_RESTRICT format,
va_list vargs)
{
struct emitter p;
int r;
p.ptr = s;
p.ptr = str;
p.len = (int) 0x7fffffff; /* allow up to "maxint" characters */
r = cbvprintf(sprintf_out, (void *) (&p), format, vargs);