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
1d27446c
Commit
1d27446c
authored
May 28, 2011
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move flush-pkt creation into its own function
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
parent
f7fc68df
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
src/pkt.c
+19
-10
No files found.
src/pkt.c
View file @
1d27446c
...
...
@@ -30,6 +30,20 @@
#include "common.h"
#include "util.h"
static
int
flush_pkt
(
git_pkt
**
out
)
{
git_pkt
*
pkt
;
pkt
=
git__malloc
(
sizeof
(
git_pkt
));
if
(
pkt
==
NULL
)
return
GIT_ENOMEM
;
pkt
->
type
=
GIT_PKT_FLUSH
;
*
out
=
pkt
;
return
GIT_SUCCESS
;
}
/*
* As per the documentation, the syntax is:
*
...
...
@@ -54,24 +68,19 @@ int git_pkt_parse_line(git_pkt **head, const char *line, const char **out)
if
(
error
<
GIT_SUCCESS
)
return
error
;
line
=
num_end
;
/*
* TODO: How do we deal with empty lines? Try again? with the next
* line?
*/
if
(
len
==
4
)
{
*
out
=
num_end
;
*
out
=
line
;
return
GIT_SUCCESS
;
}
if
(
len
==
0
)
{
/* Flush, should go into its own fn */
pkt
=
git__malloc
(
sizeof
(
git_pkt
));
if
(
pkt
==
NULL
)
return
GIT_ENOMEM
;
pkt
->
type
=
GIT_PKT_FLUSH
;
*
head
=
pkt
;
*
out
=
num_end
;
return
GIT_SUCCESS
;
if
(
len
==
0
)
{
/* Flush pkt */
*
out
=
line
;
return
flush_pkt
(
head
);
}
/* TODO: Write the rest of this thing */
...
...
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