mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-20 10:20:57 +00:00
HV: coding style cleanup in string.c
- replaced blank space with tab - delete some confusing comments Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
parent
2a819366ae
commit
228f4df559
@ -3,11 +3,6 @@
|
|||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* FIXME: It'd be nice to configure around these, but the include files are too
|
|
||||||
* painful. These macros should at least be more portable than hardwired hex
|
|
||||||
* constants.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <hypervisor.h>
|
#include <hypervisor.h>
|
||||||
|
|
||||||
#define ULONG_MAX ((uint64_t)(~0UL)) /* 0xFFFFFFFF */
|
#define ULONG_MAX ((uint64_t)(~0UL)) /* 0xFFFFFFFF */
|
||||||
@ -18,12 +13,8 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert a string to a long integer - decimal support only.
|
* Convert a string to a long integer - decimal support only.
|
||||||
*
|
|
||||||
* Ignores `locale' stuff. Assumes that the upper and lower case
|
|
||||||
* alphabets and digits are each contiguous.
|
|
||||||
*/
|
*/
|
||||||
long
|
long strtol_deci(const char *nptr)
|
||||||
strtol_deci(const char *nptr)
|
|
||||||
{
|
{
|
||||||
const char *s = nptr;
|
const char *s = nptr;
|
||||||
uint64_t acc;
|
uint64_t acc;
|
||||||
@ -34,8 +25,6 @@ strtol_deci(const char *nptr)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Skip white space and pick up leading +/- sign if any.
|
* Skip white space and pick up leading +/- sign if any.
|
||||||
* If base is 0, allow 0x for hex and 0 for octal, else
|
|
||||||
* assume decimal; if base is already 16, allow 0x.
|
|
||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
c = *s++;
|
c = *s++;
|
||||||
@ -89,12 +78,8 @@ strtol_deci(const char *nptr)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert a string to an uint64_t integer - hexadecimal support only.
|
* Convert a string to an uint64_t integer - hexadecimal support only.
|
||||||
*
|
|
||||||
* Ignores `locale' stuff. Assumes that the upper and lower case
|
|
||||||
* alphabets and digits are each contiguous.
|
|
||||||
*/
|
*/
|
||||||
uint64_t
|
uint64_t strtoul_hex(const char *nptr)
|
||||||
strtoul_hex(const char *nptr)
|
|
||||||
{
|
{
|
||||||
const char *s = nptr;
|
const char *s = nptr;
|
||||||
uint64_t acc;
|
uint64_t acc;
|
||||||
@ -142,8 +127,7 @@ strtoul_hex(const char *nptr)
|
|||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int atoi(const char *str)
|
||||||
atoi(const char *str)
|
|
||||||
{
|
{
|
||||||
return (int)strtol_deci(str);
|
return (int)strtol_deci(str);
|
||||||
}
|
}
|
||||||
@ -163,7 +147,6 @@ char *strchr(const char *s, int ch)
|
|||||||
* This function copies the string pointed to by s to a buffer
|
* This function copies the string pointed to by s to a buffer
|
||||||
* pointed by d.
|
* pointed by d.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* input:
|
* input:
|
||||||
* d pointer to dest buffer.
|
* d pointer to dest buffer.
|
||||||
*
|
*
|
||||||
@ -324,7 +307,6 @@ char *strncpy_s(char *d, size_t dmax, const char *s, size_t slen)
|
|||||||
*
|
*
|
||||||
* dmax maximum number of characer to examine.
|
* dmax maximum number of characer to examine.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* return value:
|
* return value:
|
||||||
* string length, excluding the null character.
|
* string length, excluding the null character.
|
||||||
* will return 0 if str is null.
|
* will return 0 if str is null.
|
||||||
@ -370,7 +352,8 @@ int strcmp(const char *s1, const char *s2)
|
|||||||
|
|
||||||
int strncmp(const char *s1, const char *s2, size_t n)
|
int strncmp(const char *s1, const char *s2, size_t n)
|
||||||
{
|
{
|
||||||
while (((n - 1) != 0) && ((*s1) != 0) && ((*s2) != 0) && ((*s1) == (*s2))) {
|
while (((n - 1) != 0) && ((*s1) != 0) && ((*s2) != 0)
|
||||||
|
&& ((*s1) == (*s2))) {
|
||||||
s1++;
|
s1++;
|
||||||
s2++;
|
s2++;
|
||||||
n--;
|
n--;
|
||||||
|
Loading…
Reference in New Issue
Block a user