Blame src/proxy.c

Packit ae9e2a
/*
Packit ae9e2a
 * Copyright (C) the libgit2 contributors. All rights reserved.
Packit ae9e2a
 *
Packit ae9e2a
 * This file is part of libgit2, distributed under the GNU GPL v2 with
Packit ae9e2a
 * a Linking Exception. For full terms see the included COPYING file.
Packit ae9e2a
 */
Packit ae9e2a
Packit ae9e2a
#include "common.h"
Packit ae9e2a
#include "git2/proxy.h"
Packit ae9e2a
Packit ae9e2a
int git_proxy_init_options(git_proxy_options *opts, unsigned int version)
Packit ae9e2a
{
Packit ae9e2a
	GIT_INIT_STRUCTURE_FROM_TEMPLATE(
Packit ae9e2a
		opts, version, git_proxy_options, GIT_PROXY_OPTIONS_INIT);
Packit ae9e2a
	return 0;
Packit ae9e2a
}
Packit ae9e2a
Packit ae9e2a
int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src)
Packit ae9e2a
{
Packit ae9e2a
	if (!src) {
Packit ae9e2a
		git_proxy_init_options(tgt, GIT_PROXY_OPTIONS_VERSION);
Packit ae9e2a
		return 0;
Packit ae9e2a
	}
Packit ae9e2a
Packit ae9e2a
	memcpy(tgt, src, sizeof(git_proxy_options));
Packit ae9e2a
	if (src->url) {
Packit ae9e2a
		tgt->url = git__strdup(src->url);
Packit ae9e2a
		GITERR_CHECK_ALLOC(tgt->url);
Packit ae9e2a
	}
Packit ae9e2a
Packit ae9e2a
	return 0;
Packit ae9e2a
}
Packit ae9e2a
Packit ae9e2a
void git_proxy_options_clear(git_proxy_options *opts)
Packit ae9e2a
{
Packit ae9e2a
	git__free((char *) opts->url);
Packit ae9e2a
	opts->url = NULL;
Packit ae9e2a
}