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
a37624ec
Commit
a37624ec
authored
Jul 24, 2016
by
Edward Thomson
Committed by
GitHub
Jul 24, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3815 from pks-t/pks/coverity-model
Coverity user model
parents
76cfdd46
4d8fe1cd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
script/user_model.c
+75
-0
No files found.
script/user_model.c
0 → 100644
View file @
a37624ec
/*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
void
*
realloc
(
void
*
ptr
,
size_t
size
);
void
*
memmove
(
void
*
dest
,
const
void
*
src
,
size_t
n
);
size_t
strlen
(
const
char
*
s
);
typedef
struct
va_list_str
*
va_list
;
typedef
struct
git_vector
{
void
**
contents
;
size_t
length
;
}
git_vector
;
typedef
struct
git_buf
{
char
*
ptr
;
size_t
asize
,
size
;
}
git_buf
;
int
git_vector_insert
(
git_vector
*
v
,
void
*
element
)
{
if
(
!
v
)
__coverity_panic__
();
v
->
contents
=
realloc
(
v
->
contents
,
++
v
->
length
);
if
(
!
v
->
contents
)
__coverity_panic__
();
v
->
contents
[
v
->
length
]
=
element
;
return
0
;
}
int
git_buf_len
(
const
struct
git_buf
*
buf
)
{
return
strlen
(
buf
->
ptr
);
}
int
git_buf_vprintf
(
git_buf
*
buf
,
const
char
*
format
,
va_list
ap
)
{
char
ch
,
*
s
;
size_t
len
;
__coverity_string_null_sink__
(
format
);
__coverity_string_size_sink__
(
format
);
ch
=
*
format
;
ch
=
*
(
char
*
)
ap
;
buf
->
ptr
=
__coverity_alloc__
(
len
);
__coverity_writeall__
(
buf
->
ptr
);
buf
->
size
=
len
;
return
0
;
}
int
git_buf_put
(
git_buf
*
buf
,
const
char
*
data
,
size_t
len
)
{
buf
->
ptr
=
__coverity_alloc__
(
buf
->
size
+
len
+
1
);
memmove
(
buf
->
ptr
+
buf
->
size
,
data
,
len
);
buf
->
size
+=
len
;
buf
->
ptr
[
buf
->
size
+
len
]
=
0
;
return
0
;
}
int
git_buf_set
(
git_buf
*
buf
,
const
void
*
data
,
size_t
len
)
{
buf
->
ptr
=
__coverity_alloc__
(
len
+
1
);
memmove
(
buf
->
ptr
,
data
,
len
);
buf
->
size
=
len
+
1
;
return
0
;
}
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