mirror of
https://github.com/fluencelabs/redis
synced 2025-06-24 06:21:32 +00:00
rioInitWithFile nad rioInitWithBuffer functions now take a rio structure pointer to avoid copying a structure to return value to the caller.
This commit is contained in:
17
src/rio.c
17
src/rio.c
@ -52,16 +52,15 @@ static const rio rioFileIO = {
|
||||
{ { NULL, 0 } } /* union for io-specific vars */
|
||||
};
|
||||
|
||||
rio rioInitWithFile(FILE *fp) {
|
||||
rio r = rioFileIO;
|
||||
r.io.file.fp = fp;
|
||||
return r;
|
||||
void rioInitWithFile(rio *r, FILE *fp) {
|
||||
*r = rioFileIO;
|
||||
r->io.file.fp = fp;
|
||||
}
|
||||
rio rioInitWithBuffer(sds s) {
|
||||
rio r = rioBufferIO;
|
||||
r.io.buffer.ptr = s;
|
||||
r.io.buffer.pos = 0;
|
||||
return r;
|
||||
|
||||
void rioInitWithBuffer(rio *r, sds s) {
|
||||
*r = rioBufferIO;
|
||||
r->io.buffer.ptr = s;
|
||||
r->io.buffer.pos = 0;
|
||||
}
|
||||
|
||||
/* Write multi bulk count in the format: "*<count>\r\n". */
|
||||
|
Reference in New Issue
Block a user