aboutsummaryrefslogtreecommitdiff
path: root/vendor/librune/lib/builder/u8strpushr.c
blob: 60c1d50af9aea7f7a2bb75a5f3a47c631957e28b (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 u8str *
u8strpushr(struct u8str *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;
}