Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
LSH
lsh
Commits
7c7ba170
Commit
7c7ba170
authored
Aug 31, 1998
by
Niels Möller
Browse files
*** empty log message ***
Rev: src/write_buffer.c:1.2
parent
b1afd313
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/write_buffer.c
View file @
7c7ba170
...
...
@@ -11,7 +11,7 @@ static int do_write(struct write_buffer *closure,
if
(
!
packet
->
length
)
{
lsh_string_free
(
packet
);
return
;
return
1
;
}
/* Enqueue packet */
...
...
@@ -37,17 +37,24 @@ static int do_write(struct write_buffer *closure,
}
#endif
buffer
->
empty
=
0
;
return
1
;
}
/* Copy data as necessary, before writing.
*
* FIXME: Writing of large packets could probably be optimized by
* avoiding copying it into the buffer. */
void
write_buffer_pre_write
(
struct
write_buffer
*
buffer
)
* avoiding copying it into the buffer.
*
* Returns 1 if the buffer is non-empty. */
int
write_buffer_pre_write
(
struct
write_buffer
*
buffer
)
{
UINT32
length
=
buffer
->
end
-
buffer
->
start
;
if
(
buffer
->
empty
)
return
0
;
if
(
buffer
->
start
>
buffer
->
block_size
)
{
/* Copy contents to the start of the buffer */
...
...
@@ -106,9 +113,10 @@ void write_buffer_pre_write(struct write_buffer *buffer)
}
}
buffer
->
empty
=
!
length
;
return
!
buffer
->
empty
;
}
struct
write_buffer
*
write_buffer_alloc
(
UINT32
size
)
struct
abstract_write
*
write_buffer_alloc
(
UINT32
size
)
{
struct
write_buffer
*
res
=
xalloc
(
sizeof
(
write_callback
)
-
1
+
size
*
2
);
...
...
Write
Preview
Supports
Markdown
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