Blame src/proxy.c

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