diff options
| author | Edward Thomson <ethomson@github.com> | 2016-04-19 19:48:52 -0400 |
|---|---|---|
| committer | Edward Thomson <ethomson@github.com> | 2016-04-19 19:48:52 -0400 |
| commit | 1dc449105b329ea4f8ea9982bc2da869d231c04a (patch) | |
| tree | 3dede94adc9297468b3f5b2294b300b028a0b34f /src/proxy.c | |
| parent | 95fbc81dafd64400d51637a27ecd49de5ea63145 (diff) | |
| parent | 2638df771172a18dc5da89f039076fcc05ceb4ac (diff) | |
| download | libgit2-1dc449105b329ea4f8ea9982bc2da869d231c04a.tar.gz | |
Merge pull request #3110 from libgit2/cmn/proxy-config
Proxy configuration
Diffstat (limited to 'src/proxy.c')
| -rw-r--r-- | src/proxy.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/proxy.c b/src/proxy.c new file mode 100644 index 000000000..f53ac1151 --- /dev/null +++ b/src/proxy.c @@ -0,0 +1,32 @@ +/* + * Copyright (C) the libgit2 contributors. All rights reserved. + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ + +#include "common.h" +#include "git2/proxy.h" + +int git_proxy_init_options(git_proxy_options *opts, unsigned int version) +{ + GIT_INIT_STRUCTURE_FROM_TEMPLATE( + opts, version, git_proxy_options, GIT_PROXY_OPTIONS_INIT); + return 0; +} + +int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src) +{ + if (!src) { + git_proxy_init_options(tgt, GIT_PROXY_OPTIONS_VERSION); + return 0; + } + + memcpy(tgt, src, sizeof(git_proxy_options)); + if (src->url) { + tgt->url = git__strdup(src->url); + GITERR_CHECK_ALLOC(tgt->url); + } + + return 0; +} |
