/* Read the rest of the sentence (until linefeed).  */
static int read_until_sentence_end(struct gnss_driver_t *self_p)
/* Read the rest of the sentence (until linefeed).  */
static int read_until_sentence_end(struct gnss_driver_t *self_p)
{
    int res;
    char byte;
    while (1) {
        res = read_byte(self_p, &byte);
        if (res != sizeof(byte)) {
            return (res);
        }
        if ((self_p->nmea.input.size + 1) == sizeof(self_p->nmea.input.buf)) {
            self_p->nmea.input.size = 0;
            return (-ENOMEM);
        }
        self_p->nmea.input.buf[self_p->nmea.input.size] = byte;
        self_p->nmea.input.size++;
        if (byte == '\n') {
            self_p->nmea.input.buf[self_p->nmea.input.size] = '\0';
            break;
        }
    }
    return (0);
}