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

#include "builder.h"

#include "internal/common.h"

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