aboutsummaryrefslogtreecommitdiff
path: root/lib/bob/u8strpushr.c
blob: 6fe5fd9e1b17155e0b1122455d173d50336d079d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
#include "bob.h"
#include "mbstring.h"

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