hw/drivers/gps/src/nmea.c
static int
_split_string_by_comma(char *string, char **values, int max_values)
{
	int i = 0;

    char *end = strchr(string, '*');
	values[i++] = string;
	while (i < max_values && NULL != (string = strchr(string, ','))) {
        if (string > end)    break; // End of checksum
		*string = '\0';
		values[i++] = ++string;
        if (*string == '\r') break; // End of CR
        if (*string == '\n') break; // End of NL
	}

	return i;
}
/**
 * Splits a string by comma.
 *
 * string is the string to split, will be manipulated. Needs to be
 *        null-terminated.
 * values is a char pointer array that will be filled with pointers to the
 *        splitted values in the string.
 * max_values is the maximum number of values to be parsed.
 *
 * Returns the number of values found in string.
 */
Splits a string by comma.
string is the string to split, will be manipulated. Needs to be
null-terminated.
values is a char pointer array that will be filled with pointers to the
splitted values in the string.
max_values is the maximum number of values to be parsed.

Returns the number of values found in string.
Splits a string by comma . string is the string to split will be manipulated . Needs to be null - terminated . values is a char pointer array that will be filled with pointers to the splitted values in the string . max_values is the maximum number of values to be parsed . Returns the number of values found in string .
static int
_split_string_by_comma(char *string, char **values, int max_values)
{
	int i = 0;
    char *end = strchr(string, '*');
	values[i++] = string;
	while (i < max_values && NULL != (string = strchr(string, ','))) {
        if (string > end)    break; 
		*string = '\0';
		values[i++] = ++string;
        if (*string == '\r') break; 
        if (*string == '\n') break; 
	}
	return i;
}
static int _split_string_by_comma ( char * string , char * * values , int max_values ) { int i = 0 ; char * end = strchr ( string , ' ' ) ; values [ i ++ ] = string ; while ( i < max_values && NULL != ( string = strchr ( string , ' ' ) ) ) { if ( string > end ) break ; * string = ' \0 ' ; values [ i ++ ] = ++ string ; if ( * string == ' \r ' ) break ; if ( * string == ' \n ' ) break ; } return i ; }
Splits a string by comma.
Splits a string by comma .
// End of checksum // End of CR // End of NL