aboutsummaryrefslogblamecommitdiffstats
path: root/libpatch_next_line__.c
blob: 0762262b68bc4db1604f68c746cf448137415cff (plain) (tree)


















                                                                        
/* See LICENSE file for copyright and license details. */
#include "common.h"


size_t
libpatch_next_line__(const char **text, size_t *textlen, size_t lastlen)
{
	size_t len;

	while (lastlen < *textlen && (*text)[lastlen] == '\n')
		lastlen += 1;
	*text = &(*text)[lastlen];
	*textlen -= lastlen;

	len = 0;
	while (len < *textlen && (*text)[len] != '\n')
		len += 1;
	return len;
}