aboutsummaryrefslogtreecommitdiff
path: root/vendor/librune/lib/builder/u8strinit.c
blob: 29947e883c4dcfc4d9335e56f4ccf25575e88ea6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdlib.h>

#include "builder.h"

#include "internal/common.h"

struct u8str *
u8strinit(struct u8str *b, size_t n)
{
	if (n) {
		if (!(b->p = malloc(n)))
			return nullptr;
	} else
		b->p = nullptr;
	b->len = 0;
	b->cap = n;
	return b;
}