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
821f6bc7
Commit
821f6bc7
authored
Apr 26, 2012
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Win32 warnings
parent
631ba94e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
18 deletions
+20
-18
src/attr_file.c
+2
-1
src/diff.c
+2
-1
src/indexer.c
+1
-1
src/khash.h
+8
-8
src/pool.c
+6
-6
src/revwalk.c
+1
-1
No files found.
src/attr_file.c
View file @
821f6bc7
...
@@ -403,7 +403,8 @@ int git_attr_fnmatch__parse(
...
@@ -403,7 +403,8 @@ int git_attr_fnmatch__parse(
/* given an unrooted fullpath match from a file inside a repo,
/* given an unrooted fullpath match from a file inside a repo,
* prefix the pattern with the relative directory of the source file
* prefix the pattern with the relative directory of the source file
*/
*/
spec
->
pattern
=
git_pool_malloc
(
pool
,
sourcelen
+
spec
->
length
+
1
);
spec
->
pattern
=
git_pool_malloc
(
pool
,
(
uint32_t
)(
sourcelen
+
spec
->
length
+
1
));
if
(
spec
->
pattern
)
{
if
(
spec
->
pattern
)
{
memcpy
(
spec
->
pattern
,
source
,
sourcelen
);
memcpy
(
spec
->
pattern
,
source
,
sourcelen
);
memcpy
(
spec
->
pattern
+
sourcelen
,
pattern
,
spec
->
length
);
memcpy
(
spec
->
pattern
+
sourcelen
,
pattern
,
spec
->
length
);
...
...
src/diff.c
View file @
821f6bc7
...
@@ -313,7 +313,8 @@ static git_diff_list *git_diff_list_alloc(
...
@@ -313,7 +313,8 @@ static git_diff_list *git_diff_list_alloc(
if
(
!
diff_pathspec_is_interesting
(
&
opts
->
pathspec
))
if
(
!
diff_pathspec_is_interesting
(
&
opts
->
pathspec
))
return
diff
;
return
diff
;
if
(
git_vector_init
(
&
diff
->
pathspec
,
opts
->
pathspec
.
count
,
NULL
)
<
0
)
if
(
git_vector_init
(
&
diff
->
pathspec
,
(
unsigned
int
)
opts
->
pathspec
.
count
,
NULL
)
<
0
)
goto
fail
;
goto
fail
;
for
(
i
=
0
;
i
<
opts
->
pathspec
.
count
;
++
i
)
{
for
(
i
=
0
;
i
<
opts
->
pathspec
.
count
;
++
i
)
{
...
...
src/indexer.c
View file @
821f6bc7
...
@@ -376,7 +376,7 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz
...
@@ -376,7 +376,7 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz
git__free
(
obj
.
data
);
git__free
(
obj
.
data
);
stats
->
processed
=
++
processed
;
stats
->
processed
=
(
unsigned
int
)
++
processed
;
}
}
return
0
;
return
0
;
...
...
src/khash.h
View file @
821f6bc7
...
@@ -196,8 +196,8 @@ static const double __ac_HASH_UPPER = 0.77;
...
@@ -196,8 +196,8 @@ static const double __ac_HASH_UPPER = 0.77;
SCOPE void kh_destroy_##name(kh_##name##_t *h) \
SCOPE void kh_destroy_##name(kh_##name##_t *h) \
{ \
{ \
if (h) { \
if (h) { \
kfree(
h->keys); kfree(h->flags);
\
kfree(
(void *)h->keys); kfree(h->flags);
\
kfree(
h->vals);
\
kfree(
(void *)h->vals);
\
kfree(h); \
kfree(h); \
} \
} \
} \
} \
...
@@ -235,11 +235,11 @@ static const double __ac_HASH_UPPER = 0.77;
...
@@ -235,11 +235,11 @@ static const double __ac_HASH_UPPER = 0.77;
if (!new_flags) return -1; \
if (!new_flags) return -1; \
memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \
memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \
if (h->n_buckets < new_n_buckets) {
/* expand */
\
if (h->n_buckets < new_n_buckets) {
/* expand */
\
khkey_t *new_keys = (khkey_t*)krealloc(h->keys, new_n_buckets * sizeof(khkey_t)); \
khkey_t *new_keys = (khkey_t*)krealloc(
(void *)
h->keys, new_n_buckets * sizeof(khkey_t)); \
if (!new_keys) return -1; \
if (!new_keys) return -1; \
h->keys = new_keys; \
h->keys = new_keys; \
if (kh_is_map) { \
if (kh_is_map) { \
khval_t *new_vals = (khval_t*)krealloc(h->vals, new_n_buckets * sizeof(khval_t)); \
khval_t *new_vals = (khval_t*)krealloc(
(void *)
h->vals, new_n_buckets * sizeof(khval_t)); \
if (!new_vals) return -1; \
if (!new_vals) return -1; \
h->vals = new_vals; \
h->vals = new_vals; \
} \
} \
...
@@ -275,8 +275,8 @@ static const double __ac_HASH_UPPER = 0.77;
...
@@ -275,8 +275,8 @@ static const double __ac_HASH_UPPER = 0.77;
} \
} \
} \
} \
if (h->n_buckets > new_n_buckets) {
/* shrink the hash table */
\
if (h->n_buckets > new_n_buckets) {
/* shrink the hash table */
\
h->keys = (khkey_t*)krealloc(h->keys, new_n_buckets * sizeof(khkey_t)); \
h->keys = (khkey_t*)krealloc(
(void *)
h->keys, new_n_buckets * sizeof(khkey_t)); \
if (kh_is_map) h->vals = (khval_t*)krealloc(h->vals, new_n_buckets * sizeof(khval_t)); \
if (kh_is_map) h->vals = (khval_t*)krealloc(
(void *)
h->vals, new_n_buckets * sizeof(khval_t)); \
} \
} \
kfree(h->flags);
/* free the working space */
\
kfree(h->flags);
/* free the working space */
\
h->flags = new_flags; \
h->flags = new_flags; \
...
@@ -376,8 +376,8 @@ static const double __ac_HASH_UPPER = 0.77;
...
@@ -376,8 +376,8 @@ static const double __ac_HASH_UPPER = 0.77;
*/
*/
static
inline
khint_t
__ac_X31_hash_string
(
const
char
*
s
)
static
inline
khint_t
__ac_X31_hash_string
(
const
char
*
s
)
{
{
khint_t
h
=
*
s
;
khint_t
h
=
(
khint_t
)
*
s
;
if
(
h
)
for
(
++
s
;
*
s
;
++
s
)
h
=
(
h
<<
5
)
-
h
+
*
s
;
if
(
h
)
for
(
++
s
;
*
s
;
++
s
)
h
=
(
h
<<
5
)
-
h
+
(
khint_t
)
*
s
;
return
h
;
return
h
;
}
}
/*! @function
/*! @function
...
...
src/pool.c
View file @
821f6bc7
...
@@ -190,7 +190,7 @@ char *git_pool_strndup(git_pool *pool, const char *str, size_t n)
...
@@ -190,7 +190,7 @@ char *git_pool_strndup(git_pool *pool, const char *str, size_t n)
assert
(
pool
&&
str
&&
pool
->
item_size
==
sizeof
(
char
));
assert
(
pool
&&
str
&&
pool
->
item_size
==
sizeof
(
char
));
if
((
ptr
=
git_pool_malloc
(
pool
,
n
+
1
))
!=
NULL
)
{
if
((
ptr
=
git_pool_malloc
(
pool
,
(
uint32_t
)(
n
+
1
)
))
!=
NULL
)
{
memcpy
(
ptr
,
str
,
n
);
memcpy
(
ptr
,
str
,
n
);
*
(((
char
*
)
ptr
)
+
n
)
=
'\0'
;
*
(((
char
*
)
ptr
)
+
n
)
=
'\0'
;
}
}
...
@@ -216,7 +216,7 @@ char *git_pool_strcat(git_pool *pool, const char *a, const char *b)
...
@@ -216,7 +216,7 @@ char *git_pool_strcat(git_pool *pool, const char *a, const char *b)
len_a
=
a
?
strlen
(
a
)
:
0
;
len_a
=
a
?
strlen
(
a
)
:
0
;
len_b
=
b
?
strlen
(
b
)
:
0
;
len_b
=
b
?
strlen
(
b
)
:
0
;
if
((
ptr
=
git_pool_malloc
(
pool
,
len_a
+
len_b
+
1
))
!=
NULL
)
{
if
((
ptr
=
git_pool_malloc
(
pool
,
(
uint32_t
)(
len_a
+
len_b
+
1
)
))
!=
NULL
)
{
if
(
len_a
)
if
(
len_a
)
memcpy
(
ptr
,
a
,
len_a
);
memcpy
(
ptr
,
a
,
len_a
);
if
(
len_b
)
if
(
len_b
)
...
@@ -256,12 +256,12 @@ bool git_pool__ptr_in_pool(git_pool *pool, void *ptr)
...
@@ -256,12 +256,12 @@ bool git_pool__ptr_in_pool(git_pool *pool, void *ptr)
{
{
git_pool_page
*
scan
;
git_pool_page
*
scan
;
for
(
scan
=
pool
->
open
;
scan
!=
NULL
;
scan
=
scan
->
next
)
for
(
scan
=
pool
->
open
;
scan
!=
NULL
;
scan
=
scan
->
next
)
if
(
((
void
*
)
scan
->
data
)
<=
ptr
&&
if
(
(
void
*
)
scan
->
data
<=
ptr
&&
(
((
void
*
)
scan
->
data
)
+
scan
->
size
)
>
ptr
)
(
void
*
)(((
char
*
)
scan
->
data
)
+
scan
->
size
)
>
ptr
)
return
true
;
return
true
;
for
(
scan
=
pool
->
full
;
scan
!=
NULL
;
scan
=
scan
->
next
)
for
(
scan
=
pool
->
full
;
scan
!=
NULL
;
scan
=
scan
->
next
)
if
(
((
void
*
)
scan
->
data
)
<=
ptr
&&
if
(
(
void
*
)
scan
->
data
<=
ptr
&&
(
((
void
*
)
scan
->
data
)
+
scan
->
size
)
>
ptr
)
(
void
*
)(((
char
*
)
scan
->
data
)
+
scan
->
size
)
>
ptr
)
return
true
;
return
true
;
return
false
;
return
false
;
}
}
...
...
src/revwalk.c
View file @
821f6bc7
...
@@ -141,7 +141,7 @@ static commit_object **alloc_parents(
...
@@ -141,7 +141,7 @@ static commit_object **alloc_parents(
return
(
commit_object
**
)((
char
*
)
commit
+
sizeof
(
commit_object
));
return
(
commit_object
**
)((
char
*
)
commit
+
sizeof
(
commit_object
));
return
(
commit_object
**
)
git_pool_malloc
(
return
(
commit_object
**
)
git_pool_malloc
(
&
walk
->
commit_pool
,
n_parents
*
sizeof
(
commit_object
*
));
&
walk
->
commit_pool
,
(
uint32_t
)(
n_parents
*
sizeof
(
commit_object
*
)
));
}
}
...
...
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