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
6762fe08
Commit
6762fe08
authored
Nov 29, 2012
by
Philip Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove casts of return values of type void *
parent
ac22d08f
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
32 additions
and
32 deletions
+32
-32
src/transports/cred.c
+1
-1
src/transports/git.c
+2
-2
src/transports/http.c
+3
-3
src/transports/local.c
+2
-2
src/transports/smart.c
+1
-1
src/transports/smart_pkt.c
+16
-16
src/transports/smart_protocol.c
+2
-2
src/transports/winhttp.c
+5
-5
No files found.
src/transports/cred.c
View file @
6762fe08
...
...
@@ -34,7 +34,7 @@ int git_cred_userpass_plaintext_new(
if
(
!
cred
)
return
-
1
;
c
=
(
git_cred_userpass_plaintext
*
)
git__malloc
(
sizeof
(
git_cred_userpass_plaintext
));
c
=
git__malloc
(
sizeof
(
git_cred_userpass_plaintext
));
GITERR_CHECK_ALLOC
(
c
);
c
->
parent
.
credtype
=
GIT_CREDTYPE_USERPASS_PLAINTEXT
;
...
...
src/transports/git.c
View file @
6762fe08
...
...
@@ -154,7 +154,7 @@ static int git_stream_alloc(
if
(
!
stream
)
return
-
1
;
s
=
(
git_stream
*
)
git__calloc
(
sizeof
(
git_stream
),
1
);
s
=
git__calloc
(
sizeof
(
git_stream
),
1
);
GITERR_CHECK_ALLOC
(
s
);
s
->
parent
.
subtransport
=
&
t
->
parent
;
...
...
@@ -335,7 +335,7 @@ int git_smart_subtransport_git(git_smart_subtransport **out, git_transport *owne
if
(
!
out
)
return
-
1
;
t
=
(
git_subtransport
*
)
git__calloc
(
sizeof
(
git_subtransport
),
1
);
t
=
git__calloc
(
sizeof
(
git_subtransport
),
1
);
GITERR_CHECK_ALLOC
(
t
);
t
->
owner
=
owner
;
...
...
src/transports/http.c
View file @
6762fe08
...
...
@@ -545,7 +545,7 @@ static int http_stream_write_chunked(
int
count
=
MIN
(
CHUNK_SIZE
-
s
->
chunk_buffer_len
,
len
);
if
(
!
s
->
chunk_buffer
)
s
->
chunk_buffer
=
(
char
*
)
git__malloc
(
CHUNK_SIZE
);
s
->
chunk_buffer
=
git__malloc
(
CHUNK_SIZE
);
memcpy
(
s
->
chunk_buffer
+
s
->
chunk_buffer_len
,
buffer
,
count
);
s
->
chunk_buffer_len
+=
count
;
...
...
@@ -626,7 +626,7 @@ static int http_stream_alloc(http_subtransport *t,
if
(
!
stream
)
return
-
1
;
s
=
(
http_stream
*
)
git__calloc
(
sizeof
(
http_stream
),
1
);
s
=
git__calloc
(
sizeof
(
http_stream
),
1
);
GITERR_CHECK_ALLOC
(
s
);
s
->
parent
.
subtransport
=
&
t
->
parent
;
...
...
@@ -838,7 +838,7 @@ int git_smart_subtransport_http(git_smart_subtransport **out, git_transport *own
if
(
!
out
)
return
-
1
;
t
=
(
http_subtransport
*
)
git__calloc
(
sizeof
(
http_subtransport
),
1
);
t
=
git__calloc
(
sizeof
(
http_subtransport
),
1
);
GITERR_CHECK_ALLOC
(
t
);
t
->
owner
=
(
transport_smart
*
)
owner
;
...
...
src/transports/local.c
View file @
6762fe08
...
...
@@ -43,7 +43,7 @@ static int add_ref(transport_local *t, const char *name)
git_object
*
obj
=
NULL
,
*
target
=
NULL
;
git_buf
buf
=
GIT_BUF_INIT
;
head
=
(
git_remote_head
*
)
git__calloc
(
1
,
sizeof
(
git_remote_head
));
head
=
git__calloc
(
1
,
sizeof
(
git_remote_head
));
GITERR_CHECK_ALLOC
(
head
);
head
->
name
=
git__strdup
(
name
);
...
...
@@ -78,7 +78,7 @@ static int add_ref(transport_local *t, const char *name)
}
/* And if it's a tag, peel it, and add it to the list */
head
=
(
git_remote_head
*
)
git__calloc
(
1
,
sizeof
(
git_remote_head
));
head
=
git__calloc
(
1
,
sizeof
(
git_remote_head
));
GITERR_CHECK_ALLOC
(
head
);
if
(
git_buf_join
(
&
buf
,
0
,
name
,
peeled
)
<
0
)
return
-
1
;
...
...
src/transports/smart.c
View file @
6762fe08
...
...
@@ -300,7 +300,7 @@ int git_transport_smart(git_transport **out, git_remote *owner, void *param)
if
(
!
param
)
return
-
1
;
t
=
(
transport_smart
*
)
git__calloc
(
sizeof
(
transport_smart
),
1
);
t
=
git__calloc
(
sizeof
(
transport_smart
),
1
);
GITERR_CHECK_ALLOC
(
t
);
t
->
parent
.
set_callbacks
=
git_smart__set_callbacks
;
...
...
src/transports/smart_pkt.c
View file @
6762fe08
...
...
@@ -30,7 +30,7 @@ static int flush_pkt(git_pkt **out)
{
git_pkt
*
pkt
;
pkt
=
(
git_pkt
*
)
git__malloc
(
sizeof
(
git_pkt
));
pkt
=
git__malloc
(
sizeof
(
git_pkt
));
GITERR_CHECK_ALLOC
(
pkt
);
pkt
->
type
=
GIT_PKT_FLUSH
;
...
...
@@ -46,7 +46,7 @@ static int ack_pkt(git_pkt **out, const char *line, size_t len)
GIT_UNUSED
(
line
);
GIT_UNUSED
(
len
);
pkt
=
(
git_pkt_ack
*
)
git__calloc
(
1
,
sizeof
(
git_pkt_ack
));
pkt
=
git__calloc
(
1
,
sizeof
(
git_pkt_ack
));
GITERR_CHECK_ALLOC
(
pkt
);
pkt
->
type
=
GIT_PKT_ACK
;
...
...
@@ -73,7 +73,7 @@ static int nak_pkt(git_pkt **out)
{
git_pkt
*
pkt
;
pkt
=
(
git_pkt
*
)
git__malloc
(
sizeof
(
git_pkt
));
pkt
=
git__malloc
(
sizeof
(
git_pkt
));
GITERR_CHECK_ALLOC
(
pkt
);
pkt
->
type
=
GIT_PKT_NAK
;
...
...
@@ -86,7 +86,7 @@ static int pack_pkt(git_pkt **out)
{
git_pkt
*
pkt
;
pkt
=
(
git_pkt
*
)
git__malloc
(
sizeof
(
git_pkt
));
pkt
=
git__malloc
(
sizeof
(
git_pkt
));
GITERR_CHECK_ALLOC
(
pkt
);
pkt
->
type
=
GIT_PKT_PACK
;
...
...
@@ -99,7 +99,7 @@ static int comment_pkt(git_pkt **out, const char *line, size_t len)
{
git_pkt_comment
*
pkt
;
pkt
=
(
git_pkt_comment
*
)
git__malloc
(
sizeof
(
git_pkt_comment
)
+
len
+
1
);
pkt
=
git__malloc
(
sizeof
(
git_pkt_comment
)
+
len
+
1
);
GITERR_CHECK_ALLOC
(
pkt
);
pkt
->
type
=
GIT_PKT_COMMENT
;
...
...
@@ -118,7 +118,7 @@ static int err_pkt(git_pkt **out, const char *line, size_t len)
/* Remove "ERR " from the line */
line
+=
4
;
len
-=
4
;
pkt
=
(
git_pkt_err
*
)
git__malloc
(
sizeof
(
git_pkt_err
)
+
len
+
1
);
pkt
=
git__malloc
(
sizeof
(
git_pkt_err
)
+
len
+
1
);
GITERR_CHECK_ALLOC
(
pkt
);
pkt
->
type
=
GIT_PKT_ERR
;
...
...
@@ -136,7 +136,7 @@ static int data_pkt(git_pkt **out, const char *line, size_t len)
line
++
;
len
--
;
pkt
=
(
git_pkt_data
*
)
git__malloc
(
sizeof
(
git_pkt_data
)
+
len
);
pkt
=
git__malloc
(
sizeof
(
git_pkt_data
)
+
len
);
GITERR_CHECK_ALLOC
(
pkt
);
pkt
->
type
=
GIT_PKT_DATA
;
...
...
@@ -154,7 +154,7 @@ static int progress_pkt(git_pkt **out, const char *line, size_t len)
line
++
;
len
--
;
pkt
=
(
git_pkt_progress
*
)
git__malloc
(
sizeof
(
git_pkt_progress
)
+
len
);
pkt
=
git__malloc
(
sizeof
(
git_pkt_progress
)
+
len
);
GITERR_CHECK_ALLOC
(
pkt
);
pkt
->
type
=
GIT_PKT_PROGRESS
;
...
...
@@ -174,7 +174,7 @@ static int ref_pkt(git_pkt **out, const char *line, size_t len)
int
error
;
git_pkt_ref
*
pkt
;
pkt
=
(
git_pkt_ref
*
)
git__malloc
(
sizeof
(
git_pkt_ref
));
pkt
=
git__malloc
(
sizeof
(
git_pkt_ref
));
GITERR_CHECK_ALLOC
(
pkt
);
memset
(
pkt
,
0x0
,
sizeof
(
git_pkt_ref
));
...
...
@@ -196,7 +196,7 @@ static int ref_pkt(git_pkt **out, const char *line, size_t len)
if
(
line
[
len
-
1
]
==
'\n'
)
--
len
;
pkt
->
head
.
name
=
(
char
*
)
git__malloc
(
len
+
1
);
pkt
->
head
.
name
=
git__malloc
(
len
+
1
);
GITERR_CHECK_ALLOC
(
pkt
->
head
.
name
);
memcpy
(
pkt
->
head
.
name
,
line
,
len
);
...
...
@@ -219,7 +219,7 @@ static int ok_pkt(git_pkt **out, const char *line, size_t len)
git_pkt_ok
*
pkt
;
const
char
*
ptr
;
pkt
=
(
git_pkt_ok
*
)
git__malloc
(
sizeof
(
*
pkt
));
pkt
=
git__malloc
(
sizeof
(
*
pkt
));
GITERR_CHECK_ALLOC
(
pkt
);
pkt
->
type
=
GIT_PKT_OK
;
...
...
@@ -228,7 +228,7 @@ static int ok_pkt(git_pkt **out, const char *line, size_t len)
ptr
=
strchr
(
line
,
'\n'
);
len
=
ptr
-
line
;
pkt
->
ref
=
(
char
*
)
git__malloc
(
len
+
1
);
pkt
->
ref
=
git__malloc
(
len
+
1
);
GITERR_CHECK_ALLOC
(
pkt
->
ref
);
memcpy
(
pkt
->
ref
,
line
,
len
);
...
...
@@ -243,7 +243,7 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
git_pkt_ng
*
pkt
;
const
char
*
ptr
;
pkt
=
(
git_pkt_ng
*
)
git__malloc
(
sizeof
(
*
pkt
));
pkt
=
git__malloc
(
sizeof
(
*
pkt
));
GITERR_CHECK_ALLOC
(
pkt
);
pkt
->
type
=
GIT_PKT_NG
;
...
...
@@ -252,7 +252,7 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
ptr
=
strchr
(
line
,
' '
);
len
=
ptr
-
line
;
pkt
->
ref
=
(
char
*
)
git__malloc
(
len
+
1
);
pkt
->
ref
=
git__malloc
(
len
+
1
);
GITERR_CHECK_ALLOC
(
pkt
->
ref
);
memcpy
(
pkt
->
ref
,
line
,
len
);
...
...
@@ -262,7 +262,7 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
ptr
=
strchr
(
line
,
'\n'
);
len
=
ptr
-
line
;
pkt
->
msg
=
(
char
*
)
git__malloc
(
len
+
1
);
pkt
->
msg
=
git__malloc
(
len
+
1
);
GITERR_CHECK_ALLOC
(
pkt
->
msg
);
memcpy
(
pkt
->
msg
,
line
,
len
);
...
...
@@ -278,7 +278,7 @@ static int unpack_pkt(git_pkt **out, const char *line, size_t len)
GIT_UNUSED
(
len
);
pkt
=
(
git_pkt_unpack
*
)
git__malloc
(
sizeof
(
*
pkt
));
pkt
=
git__malloc
(
sizeof
(
*
pkt
));
GITERR_CHECK_ALLOC
(
pkt
);
pkt
->
type
=
GIT_PKT_UNPACK
;
...
...
src/transports/smart_protocol.c
View file @
6762fe08
...
...
@@ -597,7 +597,7 @@ static int parse_report(gitno_buffer *buf, git_push *push)
gitno_consume
(
buf
,
line_end
);
if
(
pkt
->
type
==
GIT_PKT_OK
)
{
push_status
*
status
=
(
push_status
*
)
git__malloc
(
sizeof
(
push_status
));
push_status
*
status
=
git__malloc
(
sizeof
(
push_status
));
GITERR_CHECK_ALLOC
(
status
);
status
->
ref
=
git__strdup
(((
git_pkt_ok
*
)
pkt
)
->
ref
);
status
->
msg
=
NULL
;
...
...
@@ -610,7 +610,7 @@ static int parse_report(gitno_buffer *buf, git_push *push)
}
if
(
pkt
->
type
==
GIT_PKT_NG
)
{
push_status
*
status
=
(
push_status
*
)
git__malloc
(
sizeof
(
push_status
));
push_status
*
status
=
git__malloc
(
sizeof
(
push_status
));
GITERR_CHECK_ALLOC
(
status
);
status
->
ref
=
git__strdup
(((
git_pkt_ng
*
)
pkt
)
->
ref
);
status
->
msg
=
git__strdup
(((
git_pkt_ng
*
)
pkt
)
->
msg
);
...
...
src/transports/winhttp.c
View file @
6762fe08
...
...
@@ -104,7 +104,7 @@ static int apply_basic_credential(HINTERNET request, git_cred *cred)
goto
on_error
;
}
wide
=
(
wchar_t
*
)
git__malloc
(
wide_len
*
sizeof
(
wchar_t
));
wide
=
git__malloc
(
wide_len
*
sizeof
(
wchar_t
));
if
(
!
wide
)
goto
on_error
;
...
...
@@ -389,7 +389,7 @@ replay:
return
-
1
;
}
buffer
=
(
char
*
)
git__malloc
(
CACHED_POST_BODY_BUF_SIZE
);
buffer
=
git__malloc
(
CACHED_POST_BODY_BUF_SIZE
);
while
(
len
>
0
)
{
DWORD
bytes_written
;
...
...
@@ -702,7 +702,7 @@ static int winhttp_stream_write_chunked(
int
count
=
MIN
(
CACHED_POST_BODY_BUF_SIZE
-
s
->
chunk_buffer_len
,
len
);
if
(
!
s
->
chunk_buffer
)
s
->
chunk_buffer
=
(
char
*
)
git__malloc
(
CACHED_POST_BODY_BUF_SIZE
);
s
->
chunk_buffer
=
git__malloc
(
CACHED_POST_BODY_BUF_SIZE
);
memcpy
(
s
->
chunk_buffer
+
s
->
chunk_buffer_len
,
buffer
,
count
);
s
->
chunk_buffer_len
+=
count
;
...
...
@@ -756,7 +756,7 @@ static int winhttp_stream_alloc(winhttp_subtransport *t, winhttp_stream **stream
if
(
!
stream
)
return
-
1
;
s
=
(
winhttp_stream
*
)
git__calloc
(
sizeof
(
winhttp_stream
),
1
);
s
=
git__calloc
(
sizeof
(
winhttp_stream
),
1
);
GITERR_CHECK_ALLOC
(
s
);
s
->
parent
.
subtransport
=
&
t
->
parent
;
...
...
@@ -988,7 +988,7 @@ int git_smart_subtransport_http(git_smart_subtransport **out, git_transport *own
if
(
!
out
)
return
-
1
;
t
=
(
winhttp_subtransport
*
)
git__calloc
(
sizeof
(
winhttp_subtransport
),
1
);
t
=
git__calloc
(
sizeof
(
winhttp_subtransport
),
1
);
GITERR_CHECK_ALLOC
(
t
);
t
->
owner
=
(
transport_smart
*
)
owner
;
...
...
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