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
645073b7
Commit
645073b7
authored
Jan 26, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2848 from JIghtuse/describe_mem_fix
describe example: fix memory allocation size
parents
f101a7d4
36e13399
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
examples/describe.c
+4
-2
No files found.
examples/describe.c
View file @
645073b7
...
...
@@ -96,7 +96,8 @@ static void parse_options(describe_options *opts, int argc, char **argv)
const
char
*
curr
=
argv
[
args
.
pos
];
if
(
curr
[
0
]
!=
'-'
)
{
opts
->
commits
=
(
const
char
**
)
realloc
((
void
*
)
opts
->
commits
,
++
opts
->
commit_count
);
size_t
newsz
=
++
opts
->
commit_count
*
sizeof
(
opts
->
commits
[
0
]);
opts
->
commits
=
(
const
char
**
)
realloc
((
void
*
)
opts
->
commits
,
newsz
);
opts
->
commits
[
opts
->
commit_count
-
1
]
=
curr
;
}
else
if
(
!
strcmp
(
curr
,
"--all"
))
{
opts
->
describe_options
.
describe_strategy
=
GIT_DESCRIBE_ALL
;
...
...
@@ -123,7 +124,8 @@ static void parse_options(describe_options *opts, int argc, char **argv)
}
else
{
if
(
!
opts
->
format_options
.
dirty_suffix
||
!
opts
->
format_options
.
dirty_suffix
[
0
])
{
opts
->
commits
=
(
const
char
**
)
malloc
(
++
opts
->
commit_count
);
size_t
sz
=
++
opts
->
commit_count
*
sizeof
(
opts
->
commits
[
0
]);
opts
->
commits
=
(
const
char
**
)
malloc
(
sz
);
opts
->
commits
[
0
]
=
"HEAD"
;
}
}
...
...
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