Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
f3357792
You need to sign in or sign up before continuing.
Commit
f3357792
authored
Sep 16, 2010
by
Pieter Noordhuis
Browse files
Static buffer in client struct has a constant size
parent
9e83ac06
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
f3357792
...
...
@@ -11,11 +11,7 @@ int listMatchObjects(void *a, void *b) {
}
redisClient
*
createClient
(
int
fd
)
{
redisClient
*
c
;
/* Allocate more space to hold a static write buffer. */
c
=
zmalloc
(
sizeof
(
redisClient
)
+
REDIS_REPLY_CHUNK_BYTES
);
c
->
buflen
=
REDIS_REPLY_CHUNK_BYTES
;
redisClient
*
c
=
zmalloc
(
sizeof
(
redisClient
));
c
->
bufpos
=
0
;
anetNonBlock
(
NULL
,
fd
);
...
...
@@ -84,7 +80,7 @@ robj *dupLastObjectIfNeeded(list *reply) {
}
int
_addReplyToBuffer
(
redisClient
*
c
,
char
*
s
,
size_t
len
)
{
size_t
available
=
c
->
buf
len
-
c
->
bufpos
;
size_t
available
=
sizeof
(
c
->
buf
)
-
c
->
bufpos
;
/* If there already are entries in the reply list, we cannot
* add anything more to the static buffer. */
...
...
src/redis.h
View file @
f3357792
...
...
@@ -313,8 +313,7 @@ typedef struct redisClient {
/* Response buffer */
int
bufpos
;
int
buflen
;
char
buf
[];
char
buf
[
REDIS_REPLY_CHUNK_BYTES
];
}
redisClient
;
struct
saveparam
{
...
...
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