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
1bcb45d1
Commit
1bcb45d1
authored
Apr 09, 2012
by
antirez
Browse files
Fixed compilation of new rio.c changes (typos and so forth.)
parent
b4b923b0
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/rdb.c
View file @
1bcb45d1
...
@@ -717,7 +717,7 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) {
...
@@ -717,7 +717,7 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) {
size_t
len
;
size_t
len
;
unsigned
int
i
;
unsigned
int
i
;
redisLog
(
REDIS_DEBUG
,
"LOADING OBJECT %d (at %d)
\n
"
,
rdbtype
,
r
db
Tell
(
rdb
));
redisLog
(
REDIS_DEBUG
,
"LOADING OBJECT %d (at %d)
\n
"
,
rdbtype
,
r
io
Tell
(
rdb
));
if
(
rdbtype
==
REDIS_RDB_TYPE_STRING
)
{
if
(
rdbtype
==
REDIS_RDB_TYPE_STRING
)
{
/* Read string value */
/* Read string value */
if
((
o
=
rdbLoadEncodedStringObject
(
rdb
))
==
NULL
)
return
NULL
;
if
((
o
=
rdbLoadEncodedStringObject
(
rdb
))
==
NULL
)
return
NULL
;
...
@@ -1039,7 +1039,7 @@ int rdbLoad(char *filename) {
...
@@ -1039,7 +1039,7 @@ int rdbLoad(char *filename) {
/* Serve the clients from time to time */
/* Serve the clients from time to time */
if
(
!
(
loops
++
%
1000
))
{
if
(
!
(
loops
++
%
1000
))
{
loadingProgress
(
r
db
Tell
(
&
rdb
));
loadingProgress
(
r
io
Tell
(
&
rdb
));
aeProcessEvents
(
server
.
el
,
AE_FILE_EVENTS
|
AE_DONT_WAIT
);
aeProcessEvents
(
server
.
el
,
AE_FILE_EVENTS
|
AE_DONT_WAIT
);
}
}
...
...
src/rio.c
View file @
1bcb45d1
...
@@ -18,6 +18,8 @@
...
@@ -18,6 +18,8 @@
#include "rio.h"
#include "rio.h"
#include "util.h"
#include "util.h"
uint64_t
crc64
(
uint64_t
crc
,
const
unsigned
char
*
s
,
uint64_t
l
);
/* Returns 1 or 0 for success/failure. */
/* Returns 1 or 0 for success/failure. */
static
size_t
rioBufferWrite
(
rio
*
r
,
const
void
*
buf
,
size_t
len
)
{
static
size_t
rioBufferWrite
(
rio
*
r
,
const
void
*
buf
,
size_t
len
)
{
r
->
io
.
buffer
.
ptr
=
sdscatlen
(
r
->
io
.
buffer
.
ptr
,(
char
*
)
buf
,
len
);
r
->
io
.
buffer
.
ptr
=
sdscatlen
(
r
->
io
.
buffer
.
ptr
,(
char
*
)
buf
,
len
);
...
@@ -86,7 +88,7 @@ void rioInitWithBuffer(rio *r, sds s) {
...
@@ -86,7 +88,7 @@ void rioInitWithBuffer(rio *r, sds s) {
/* This function can be installed both in memory and file streams when checksum
/* This function can be installed both in memory and file streams when checksum
* computation is needed. */
* computation is needed. */
void
rioGenericUpdateChecksum
(
rio
*
r
,
const
void
*
buf
,
size_t
len
)
{
void
rioGenericUpdateChecksum
(
rio
*
r
,
const
void
*
buf
,
size_t
len
)
{
r
->
che
cksum
=
crc64
(
r
->
che
cksum
,
buf
,
len
);
r
->
cksum
=
crc64
(
r
->
cksum
,
buf
,
len
);
}
}
/* ------------------------------ Higher level interface ---------------------------
/* ------------------------------ Higher level interface ---------------------------
...
...
src/rio.h
View file @
1bcb45d1
...
@@ -16,7 +16,7 @@ struct _rio {
...
@@ -16,7 +16,7 @@ struct _rio {
* data that was read or written so far. The method should be designed so that
* data that was read or written so far. The method should be designed so that
* can be called with the current checksum, and the buf and len fields pointing
* can be called with the current checksum, and the buf and len fields pointing
* to the new block of data to add to the checksum computation. */
* to the new block of data to add to the checksum computation. */
void
(
*
update_cksum
)(
struct
_rio
*
,
void
*
buf
,
size_t
len
);
void
(
*
update_cksum
)(
struct
_rio
*
,
const
void
*
buf
,
size_t
len
);
/* The current checksum */
/* The current checksum */
uint64_t
cksum
;
uint64_t
cksum
;
...
@@ -40,13 +40,13 @@ typedef struct _rio rio;
...
@@ -40,13 +40,13 @@ typedef struct _rio rio;
* if needed. */
* if needed. */
inline
size_t
rioWrite
(
rio
*
r
,
const
void
*
buf
,
size_t
len
)
{
inline
size_t
rioWrite
(
rio
*
r
,
const
void
*
buf
,
size_t
len
)
{
if
(
r
->
u
d
pate_cksum
)
r
->
update_cksum
(
r
,
buf
,
len
);
if
(
r
->
up
d
ate_cksum
)
r
->
update_cksum
(
r
,
buf
,
len
);
return
r
->
write
(
r
,
buf
,
len
);
return
r
->
write
(
r
,
buf
,
len
);
}
}
inline
size_t
rioRead
(
rio
*
r
,
void
*
buf
,
size_t
len
)
{
inline
size_t
rioRead
(
rio
*
r
,
void
*
buf
,
size_t
len
)
{
if
(
r
->
read
(
r
,
buf
,
len
)
==
1
)
{
if
(
r
->
read
(
r
,
buf
,
len
)
==
1
)
{
if
(
r
->
u
d
pate_cksum
)
r
->
update_cksum
(
r
,
buf
,
len
);
if
(
r
->
up
d
ate_cksum
)
r
->
update_cksum
(
r
,
buf
,
len
);
return
1
;
return
1
;
}
}
return
0
;
return
0
;
...
...
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