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
22bcf86c
Commit
22bcf86c
authored
Dec 10, 2012
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1126 from carlosmn/indexer-buffer
indexer: move the temporary buffers into the indexer object
parents
cbad0270
6481a68d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
src/indexer.c
+9
-10
No files found.
src/indexer.c
View file @
22bcf86c
...
@@ -55,6 +55,7 @@ struct git_indexer_stream {
...
@@ -55,6 +55,7 @@ struct git_indexer_stream {
git_oid
hash
;
git_oid
hash
;
git_transfer_progress_callback
progress_cb
;
git_transfer_progress_callback
progress_cb
;
void
*
progress_payload
;
void
*
progress_payload
;
char
objbuf
[
8
*
1024
];
};
};
struct
delta_info
{
struct
delta_info
{
...
@@ -204,18 +205,17 @@ static void hash_header(git_hash_ctx *ctx, git_off_t len, git_otype type)
...
@@ -204,18 +205,17 @@ static void hash_header(git_hash_ctx *ctx, git_off_t len, git_otype type)
git_hash_update
(
ctx
,
buffer
,
hdrlen
);
git_hash_update
(
ctx
,
buffer
,
hdrlen
);
}
}
static
int
hash_object_stream
(
git_
hash_ctx
*
ct
x
,
git_packfile_stream
*
stream
)
static
int
hash_object_stream
(
git_
indexer_stream
*
id
x
,
git_packfile_stream
*
stream
)
{
{
char
buffer
[
8
*
1024
];
ssize_t
read
;
ssize_t
read
;
assert
(
ct
x
&&
stream
);
assert
(
id
x
&&
stream
);
do
{
do
{
if
((
read
=
git_packfile_stream_read
(
stream
,
buffer
,
sizeof
(
buffer
)))
<
0
)
if
((
read
=
git_packfile_stream_read
(
stream
,
idx
->
objbuf
,
sizeof
(
idx
->
objbuf
)))
<
0
)
break
;
break
;
git_hash_update
(
ctx
,
buffer
,
read
);
git_hash_update
(
&
idx
->
hash_ctx
,
idx
->
objbuf
,
read
);
}
while
(
read
>
0
);
}
while
(
read
>
0
);
if
(
read
<
0
)
if
(
read
<
0
)
...
@@ -244,15 +244,14 @@ static int advance_delta_offset(git_indexer_stream *idx, git_otype type)
...
@@ -244,15 +244,14 @@ static int advance_delta_offset(git_indexer_stream *idx, git_otype type)
}
}
/* Read from the stream and discard any output */
/* Read from the stream and discard any output */
static
int
read_object_stream
(
git_packfile_stream
*
stream
)
static
int
read_object_stream
(
git_
indexer_stream
*
idx
,
git_
packfile_stream
*
stream
)
{
{
char
buffer
[
4
*
1024
];
ssize_t
read
;
ssize_t
read
;
assert
(
stream
);
assert
(
stream
);
do
{
do
{
read
=
git_packfile_stream_read
(
stream
,
buffer
,
sizeof
(
buffer
));
read
=
git_packfile_stream_read
(
stream
,
idx
->
objbuf
,
sizeof
(
idx
->
objbuf
));
}
while
(
read
>
0
);
}
while
(
read
>
0
);
if
(
read
<
0
)
if
(
read
<
0
)
...
@@ -507,9 +506,9 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz
...
@@ -507,9 +506,9 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz
}
}
if
(
idx
->
have_delta
)
{
if
(
idx
->
have_delta
)
{
error
=
read_object_stream
(
stream
);
error
=
read_object_stream
(
idx
,
stream
);
}
else
{
}
else
{
error
=
hash_object_stream
(
&
idx
->
hash_ct
x
,
stream
);
error
=
hash_object_stream
(
id
x
,
stream
);
}
}
idx
->
off
=
stream
->
curpos
;
idx
->
off
=
stream
->
curpos
;
...
...
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