Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
f89dc917
Commit
f89dc917
authored
Sep 01, 2021
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
url: introduce `git_net_url_dup`
parent
9e98e443
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
src/net.c
+40
-0
src/net.h
+3
-0
No files found.
src/net.c
View file @
f89dc917
...
@@ -35,6 +35,46 @@ static const char *default_port_for_scheme(const char *scheme)
...
@@ -35,6 +35,46 @@ static const char *default_port_for_scheme(const char *scheme)
return
NULL
;
return
NULL
;
}
}
int
git_net_url_dup
(
git_net_url
*
out
,
git_net_url
*
in
)
{
if
(
in
->
scheme
)
{
out
->
scheme
=
git__strdup
(
in
->
scheme
);
GIT_ERROR_CHECK_ALLOC
(
out
->
scheme
);
}
if
(
in
->
host
)
{
out
->
host
=
git__strdup
(
in
->
host
);
GIT_ERROR_CHECK_ALLOC
(
out
->
host
);
}
if
(
in
->
port
)
{
out
->
port
=
git__strdup
(
in
->
port
);
GIT_ERROR_CHECK_ALLOC
(
out
->
port
);
}
if
(
in
->
path
)
{
out
->
path
=
git__strdup
(
in
->
path
);
GIT_ERROR_CHECK_ALLOC
(
out
->
path
);
}
if
(
in
->
query
)
{
out
->
query
=
git__strdup
(
in
->
query
);
GIT_ERROR_CHECK_ALLOC
(
out
->
query
);
}
if
(
in
->
username
)
{
out
->
username
=
git__strdup
(
in
->
username
);
GIT_ERROR_CHECK_ALLOC
(
out
->
username
);
}
if
(
in
->
password
)
{
out
->
password
=
git__strdup
(
in
->
password
);
GIT_ERROR_CHECK_ALLOC
(
out
->
password
);
}
return
0
;
}
int
git_net_url_parse
(
git_net_url
*
url
,
const
char
*
given
)
int
git_net_url_parse
(
git_net_url
*
url
,
const
char
*
given
)
{
{
struct
http_parser_url
u
=
{
0
};
struct
http_parser_url
u
=
{
0
};
...
...
src/net.h
View file @
f89dc917
...
@@ -21,6 +21,9 @@ typedef struct git_net_url {
...
@@ -21,6 +21,9 @@ typedef struct git_net_url {
#define GIT_NET_URL_INIT { NULL }
#define GIT_NET_URL_INIT { NULL }
/** Duplicate a URL */
extern
int
git_net_url_dup
(
git_net_url
*
out
,
git_net_url
*
in
);
/** Parses a string containing a URL into a structure. */
/** Parses a string containing a URL into a structure. */
extern
int
git_net_url_parse
(
git_net_url
*
url
,
const
char
*
str
);
extern
int
git_net_url_parse
(
git_net_url
*
url
,
const
char
*
str
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment