aboutsummaryrefslogtreecommitdiff
path: root/vendor/librune/lib/builder/u8strpushr.c
blob: 89bb64f322983d789c75986a91dd1d0157a6e80c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "builder.h"
#include "utf8.h"

#include "internal/common.h"

struct u8buf *
u8strpushr(struct u8buf *b, rune ch)
{
	if (!u8strgrow(b, b->len + u8wdth(ch)))
		return nullptr;
	b->len += rtou8(b->p + b->len, ch, b->cap - b->len);
	return b;
}