Exemple #1
0
int report_error(const char *fmt, ...)
{
	struct membuffer *buf = &error_string_buffer;

	/* Previous unprinted errors? Add a newline in between */
	if (buf->len)
		put_bytes(buf, "\n", 1);
	VA_BUF(buf, fmt);
	mb_cstring(buf);
	return -1;
}
Exemple #2
0
int report_error(const char *fmt, ...)
{
	struct membuffer buf = { 0 };

	/* if there is no error callback registered, don't produce errors */
	if (!error_cb)
		return -1;

	VA_BUF(&buf, fmt);
	mb_cstring(&buf);
	error_cb(detach_buffer(&buf));

	return -1;
}
Exemple #3
0
/*
 * Write a membuffer to the git repo, and free it
 */
static int blob_insert(git_repository *repo, struct dir *tree, struct membuffer *b, const char *fmt, ...)
{
	int ret;
	git_oid blob_id;
	struct membuffer name = { 0 };

	ret = git_blob_create_frombuffer(&blob_id, repo, b->buffer, b->len);
	free_buffer(b);
	if (ret)
		return ret;

	VA_BUF(&name, fmt);
	ret = tree_insert(tree->files, mb_cstring(&name), 1, &blob_id, GIT_FILEMODE_BLOB);
	free_buffer(&name);
	return ret;
}
Exemple #4
0
static void cond_put_format(int cond, struct membuffer *b, const char *fmt, ...)
{
	if (cond) {
		VA_BUF(b, fmt);
	}
}