| 1 |
|
| /* |
| 2 |
|
| * Copyright (C) the libgit2 contributors. All rights reserved. |
| 3 |
|
| * |
| 4 |
|
| * This file is part of libgit2, distributed under the GNU GPL v2 with |
| 5 |
|
| * a Linking Exception. For full terms see the included COPYING file. |
| 6 |
|
| */ |
| 7 |
|
| |
| 8 |
|
| #include "proxy.h" |
| 9 |
|
| |
| 10 |
|
| #include "git2/proxy.h" |
| 11 |
|
| |
| 12 |
0 |
| int git_proxy_options_init(git_proxy_options *opts, unsigned int version) |
| 13 |
|
| { |
| 14 |
0 |
▶ | GIT_INIT_STRUCTURE_FROM_TEMPLATE( |
Branch: 1 branch
| Branch | True | False | Total |
| GIT_INIT_STRUCTURE_FROM_TEMPLATE( |
0 |
0 |
0 |
|
| 15 |
|
| opts, version, git_proxy_options, GIT_PROXY_OPTIONS_INIT); |
| 16 |
0 |
| return 0; |
| 17 |
|
| } |
| 18 |
|
| |
| 19 |
|
| #ifndef GIT_DEPRECATE_HARD |
| 20 |
0 |
| int git_proxy_init_options(git_proxy_options *opts, unsigned int version) |
| 21 |
|
| { |
| 22 |
0 |
| return git_proxy_options_init(opts, version); |
| 23 |
|
| } |
| 24 |
|
| #endif |
| 25 |
|
| |
| 26 |
4 |
| int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src) |
| 27 |
|
| { |
| 28 |
4 |
▶ | if (!src) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!src) { |
0 |
4 |
4 |
|
| 29 |
0 |
| git_proxy_options_init(tgt, GIT_PROXY_OPTIONS_VERSION); |
| 30 |
0 |
| return 0; |
| 31 |
|
| } |
| 32 |
|
| |
| 33 |
4 |
| memcpy(tgt, src, sizeof(git_proxy_options)); |
| 34 |
4 |
▶ | if (src->url) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (src->url) { |
0 |
4 |
4 |
|
| 35 |
0 |
| tgt->url = git__strdup(src->url); |
| 36 |
0 |
▶ | GIT_ERROR_CHECK_ALLOC(tgt->url); |
Branch: 1 branch
| Branch | True | False | Total |
| GIT_ERROR_CHECK_ALLOC(tgt->url); |
0 |
0 |
0 |
|
| 37 |
|
| } |
| 38 |
|
| |
| 39 |
4 |
| return 0; |
| 40 |
|
| } |
| 41 |
|
| |
| 42 |
8 |
| void git_proxy_options_dispose(git_proxy_options *opts) |
| 43 |
|
| { |
| 44 |
8 |
▶ | if (!opts) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!opts) |
0 |
8 |
8 |
|
| 45 |
0 |
| return; |
| 46 |
|
| |
| 47 |
8 |
| git__free((char *) opts->url); |
| 48 |
8 |
| opts->url = NULL; |
| 49 |
|
| } |