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
679b69c4
Commit
679b69c4
authored
Nov 28, 2011
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve remaining feedback
* replace some ints with size_ts * update NULL checks in various places
parent
3aa294fd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
21 deletions
+15
-21
src/buffer.c
+13
-15
tests-clay/core/buffer.c
+2
-6
No files found.
src/buffer.c
View file @
679b69c4
...
...
@@ -79,8 +79,8 @@ void git_buf_put(git_buf *buf, const char *data, size_t len)
void
git_buf_puts
(
git_buf
*
buf
,
const
char
*
string
)
{
if
(
string
!=
NULL
)
git_buf_put
(
buf
,
string
,
strlen
(
string
));
assert
(
string
);
git_buf_put
(
buf
,
string
,
strlen
(
string
));
}
void
git_buf_printf
(
git_buf
*
buf
,
const
char
*
format
,
...)
...
...
@@ -121,12 +121,10 @@ const char *git_buf_cstr(git_buf *buf)
void
git_buf_free
(
git_buf
*
buf
)
{
assert
(
buf
)
;
if
(
!
buf
)
return
;
if
(
buf
->
ptr
)
{
git__free
(
buf
->
ptr
);
buf
->
ptr
=
NULL
;
}
git__free
(
buf
->
ptr
);
buf
->
ptr
=
NULL
;
buf
->
asize
=
0
;
buf
->
size
=
0
;
}
...
...
@@ -179,7 +177,7 @@ void git_buf_join_n(git_buf *buf, char separator, int nbuf, ...)
va_list
ap
;
int
i
;
in
t
total_size
=
0
;
size_
t
total_size
=
0
;
char
*
out
;
if
(
buf
->
size
>
0
&&
buf
->
ptr
[
buf
->
size
-
1
]
!=
separator
)
...
...
@@ -188,7 +186,7 @@ void git_buf_join_n(git_buf *buf, char separator, int nbuf, ...)
va_start
(
ap
,
nbuf
);
for
(
i
=
0
;
i
<
nbuf
;
++
i
)
{
const
char
*
segment
;
in
t
segment_len
;
size_
t
segment_len
;
segment
=
va_arg
(
ap
,
const
char
*
);
if
(
!
segment
)
...
...
@@ -212,7 +210,7 @@ void git_buf_join_n(git_buf *buf, char separator, int nbuf, ...)
va_start
(
ap
,
nbuf
);
for
(
i
=
0
;
i
<
nbuf
;
++
i
)
{
const
char
*
segment
;
in
t
segment_len
;
size_
t
segment_len
;
segment
=
va_arg
(
ap
,
const
char
*
);
if
(
!
segment
)
...
...
@@ -245,11 +243,11 @@ void git_buf_join(
const
char
*
str_a
,
const
char
*
str_b
)
{
in
t
add_size
=
0
;
in
t
sep_a
=
0
;
in
t
strlen_a
=
0
;
in
t
sep_b
=
0
;
in
t
strlen_b
=
0
;
size_
t
add_size
=
0
;
size_
t
sep_a
=
0
;
size_
t
strlen_a
=
0
;
size_
t
sep_b
=
0
;
size_
t
strlen_b
=
0
;
char
*
ptr
;
/* calculate string lengths and need for added separators */
...
...
tests-clay/core/buffer.c
View file @
679b69c4
...
...
@@ -257,12 +257,9 @@ check_buf_append_abc(
/* more variations on append tests */
void
test_core_buffer__5
(
void
)
{
check_buf_append
(
NULL
,
NULL
,
NULL
,
0
,
0
);
check_buf_append
(
NULL
,
""
,
""
,
0
,
8
);
check_buf_append
(
""
,
NULL
,
""
,
0
,
8
);
check_buf_append
(
""
,
""
,
""
,
0
,
8
);
check_buf_append
(
"a"
,
NULL
,
"a"
,
1
,
8
);
check_buf_append
(
NULL
,
"a"
,
"a"
,
1
,
8
);
check_buf_append
(
"a"
,
""
,
"a"
,
1
,
8
);
check_buf_append
(
""
,
"a"
,
"a"
,
1
,
8
);
check_buf_append
(
""
,
"a"
,
"a"
,
1
,
8
);
check_buf_append
(
"a"
,
""
,
"a"
,
1
,
8
);
check_buf_append
(
"a"
,
"b"
,
"ab"
,
2
,
8
);
...
...
@@ -287,7 +284,6 @@ void test_core_buffer__5(void)
check_buf_append
(
REP16
(
"x"
),
REP16
(
"o"
),
REP16
(
"x"
)
REP16
(
"o"
),
32
,
40
);
check_buf_append
(
test_4096
,
NULL
,
test_4096
,
4096
,
6144
);
check_buf_append
(
test_4096
,
""
,
test_4096
,
4096
,
6144
);
check_buf_append
(
test_4096
,
test_4096
,
test_8192
,
8192
,
9216
);
...
...
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