src/backend/utils/misc/guc.c
static bool
parse_real(const char *value, double *result, int flags)
{
	double		val;
	char	   *endptr;

	errno = 0;
	val = strtod(value, &endptr);

	if ((flags & GUC_UNIT_MEMORY) && endptr != value)
	{
		bool		used = false;

		while (*endptr == ' ')
			endptr++;

		if (strcmp(endptr, "kB") == 0)
		{
			used = true;
			endptr += 2;
		}
		else if (strcmp(endptr, "MB") == 0)
		{
			val *= KB_PER_MB;
			used = true;
			endptr += 2;
		}
		else if (strcmp(endptr, "GB") == 0)
		{
			val *= KB_PER_GB;
			used = true;
			endptr += 2;
		}

		if (used)
		{
			switch (flags & GUC_UNIT_MEMORY)
			{
				case GUC_UNIT_BLOCKS:
					val /= (BLCKSZ / 1024);
					break;
				case GUC_UNIT_XBLOCKS:
					val /= (XLOG_BLCKSZ / 1024);
					break;
			}
		}
	}

    if (endptr == value || *endptr != '\0' || errno == ERANGE)
	{
		if (result)
			*result = 0;		/* suppress compiler warning */
		return false;
	}
	if (result)
		*result = val;
	return true;
}
/*
 * Try to parse value as a floating point constant in the usual
 * format.	If the value parsed okay return true, else false.  If
 * result is not NULL, return the semantic value there.
 */
Try to parse value as a floating point constant in the usual
format.      If the value parsed okay return true, else false.  If
result is not NULL, return the semantic value there.
Try to parse value as a floating point constant in the usual format . If the value parsed okay return true else false . If result is not NULL return the semantic value there .
static bool
parse_real(const char *value, double *result, int flags)
{
	double		val;
	char	   *endptr;
	errno = 0;
	val = strtod(value, &endptr);
	if ((flags & GUC_UNIT_MEMORY) && endptr != value)
	{
		bool		used = false;
		while (*endptr == ' ')
			endptr++;
		if (strcmp(endptr, "kB") == 0)
		{
			used = true;
			endptr += 2;
		}
		else if (strcmp(endptr, "MB") == 0)
		{
			val *= KB_PER_MB;
			used = true;
			endptr += 2;
		}
		else if (strcmp(endptr, "GB") == 0)
		{
			val *= KB_PER_GB;
			used = true;
			endptr += 2;
		}
		if (used)
		{
			switch (flags & GUC_UNIT_MEMORY)
			{
				case GUC_UNIT_BLOCKS:
					val /= (BLCKSZ / 1024);
					break;
				case GUC_UNIT_XBLOCKS:
					val /= (XLOG_BLCKSZ / 1024);
					break;
			}
		}
	}
    if (endptr == value || *endptr != '\0' || errno == ERANGE)
	{
		if (result)
			*result = 0;		
		return false;
	}
	if (result)
		*result = val;
	return true;
}
static bool parse_real ( const char * value , double * result , int flags ) { double val ; char * endptr ; errno = 0 ; val = strtod ( value , & endptr ) ; if ( ( flags & GUC_UNIT_MEMORY ) && endptr != value ) { bool used = false ; while ( * endptr == ' ' ) endptr ++ ; if ( strcmp ( endptr , " " ) == 0 ) { used = true ; endptr += 2 ; } else if ( strcmp ( endptr , " " ) == 0 ) { val *= KB_PER_MB ; used = true ; endptr += 2 ; } else if ( strcmp ( endptr , " " ) == 0 ) { val *= KB_PER_GB ; used = true ; endptr += 2 ; } if ( used ) { switch ( flags & GUC_UNIT_MEMORY ) { case GUC_UNIT_BLOCKS : val /= ( BLCKSZ / 1024 ) ; break ; case GUC_UNIT_XBLOCKS : val /= ( XLOG_BLCKSZ / 1024 ) ; break ; } } } if ( endptr == value || * endptr != ' \0 ' || errno == ERANGE ) { if ( result ) * result = 0 ; return false ; } if ( result ) * result = val ; return true ; }
Try to parse value as a floating point constant in the usual
 format.
Try to parse value as a floating point constant in the usual format .
/* suppress compiler warning */