src/dpdk/lib/librte_eal/include/rte_common.h
static inline uint64_t
rte_str_to_size(const char *str)
{
	char *endptr;
	unsigned long long size;

	while (isspace((int)*str))
		str++;
	if (*str == '-')
		return 0;

	errno = 0;
	size = strtoull(str, &endptr, 0);
	if (errno)
		return 0;

	if (*endptr == ' ')
		endptr++; /* allow 1 space gap */

	switch (*endptr){
	case 'G': case 'g': size *= 1024; /* fall-through */
	case 'M': case 'm': size *= 1024; /* fall-through */
	case 'K': case 'k': size *= 1024; /* fall-through */
	default:
		break;
	}
	return size;
}
/**
 * Converts a numeric string to the equivalent uint64_t value.
 * As well as straight number conversion, also recognises the suffixes
 * k, m and g for kilobytes, megabytes and gigabytes respectively.
 *
 * If a negative number is passed in  i.e. a string with the first non-black
 * character being "-", zero is returned. Zero is also returned in the case of
 * an error with the strtoull call in the function.
 *
 * @param str
 *     String containing number to convert.
 * @return
 *     Number.
 */
Converts a numeric string to the equivalent uint64_t value.
As well as straight number conversion, also recognises the suffixes
k, m and g for kilobytes, megabytes and gigabytes respectively.

If a negative number is passed in  i.e. a string with the first non-black
character being "-", zero is returned. Zero is also returned in the case of
an error with the strtoull call in the function.

@param str
String containing number to convert.
@return
Number.
Converts a numeric string to the equivalent uint64_t value . As well as straight number conversion also recognises the suffixes k m and g for kilobytes megabytes and gigabytes respectively . If a negative number is passed in i . e . a string with the first non - black character being " - " zero is returned . Zero is also returned in the case of an error with the strtoull call in the function . @param str String containing number to convert . @return Number .
static inline uint64_t
rte_str_to_size(const char *str)
{
	char *endptr;
	unsigned long long size;
	while (isspace((int)*str))
		str++;
	if (*str == '-')
		return 0;
	errno = 0;
	size = strtoull(str, &endptr, 0);
	if (errno)
		return 0;
	if (*endptr == ' ')
		endptr++; 
	switch (*endptr){
	case 'G': case 'g': size *= 1024; 
	case 'M': case 'm': size *= 1024; 
	case 'K': case 'k': size *= 1024; 
	default:
		break;
	}
	return size;
}
static inline uint64_t rte_str_to_size ( const char * str ) { char * endptr ; unsigned long long size ; while ( isspace ( ( int ) * str ) ) str ++ ; if ( * str == ' ' ) return 0 ; errno = 0 ; size = strtoull ( str , & endptr , 0 ) ; if ( errno ) return 0 ; if ( * endptr == ' ' ) endptr ++ ; switch ( * endptr ) { case ' ' : case ' ' : size *= 1024 ; case ' ' : case ' ' : size *= 1024 ; case ' ' : case ' ' : size *= 1024 ; default : break ; } return size ; }
Converts a numeric string to the equivalent uint64_t value.
Converts a numeric string to the equivalent uint64_t value .
/* allow 1 space gap */ /* fall-through */ /* fall-through */ /* fall-through */