hv:Clear up printf related definition

In hypervisor, all the parameter and return value printf related are
unsigned int, this patch is used to fix the function definitions.

v1->v2:
  *Modify the return value of various functions, such as printf(),
   vprintf(), charout(), do_printf(), charmem, print_pow2(),
   print_decimal to void due to never used, no necessary to use,
   or has already returned by param.
  *Delete the impossible judgement of param->emit due to the type
   is unsigned.

Tracked-On: #861
Signed-off-by: Junjun Shan <junjun.shan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Junjun Shan
2018-09-17 17:42:03 +08:00
committed by Wang, Minxia
parent ed06b8a7ca
commit 7ce0e6a395
4 changed files with 60 additions and 124 deletions

View File

@@ -6,15 +6,15 @@
#include <hypervisor.h>
static int charout(int cmd, const char *s_arg, uint32_t sz_arg, void *hnd)
static void charout(size_t cmd, const char *s_arg, uint32_t sz_arg, void *hnd)
{
const char *s = s_arg;
uint32_t sz = sz_arg;
/* pointer to an integer to store the number of characters */
int *nchars = (int *)hnd;
size_t *nchars = (size_t *)hnd;
/* working pointer */
const char *p = s;
int len;
size_t len;
/* copy mode ? */
if (cmd == PRINT_CMD_COPY) {
@@ -33,17 +33,15 @@ static int charout(int cmd, const char *s_arg, uint32_t sz_arg, void *hnd)
}
}
return *nchars;
}
int vprintf(const char *fmt, va_list args)
void vprintf(const char *fmt, va_list args)
{
/* struct to store all necessary parameters */
struct print_param param;
/* the result of this function */
int res = 0;
/* argument fo charout() */
int nchars = 0;
size_t nchars = 0;
/* initialize parameters */
(void)memset(&param, 0U, sizeof(param));
@@ -51,27 +49,19 @@ int vprintf(const char *fmt, va_list args)
param.data = &nchars;
/* execute the printf() */
res = do_print(fmt, &param, args);
/* done */
return res;
do_print(fmt, &param, args);
}
int printf(const char *fmt, ...)
void printf(const char *fmt, ...)
{
/* variable argument list needed for do_print() */
va_list args;
/* the result of this function */
int res;
va_start(args, fmt);
/* execute the printf() */
res = vprintf(fmt, args);
vprintf(fmt, args);
/* destroy parameter list */
va_end(args);
/* done */
return res;
}