summaryrefslogtreecommitdiff
path: root/src/rio.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2011-09-22 16:00:40 +0200
committerantirez <antirez@gmail.com>2011-09-22 16:00:40 +0200
commitf96a8a8054b3b699c2fba797bdcd203dda1168ce (patch)
treeff487b6d6a7ec118c2095df73e8c523f76b42de9 /src/rio.c
parent69cecb511fef03795e94ba819308262ea44b2a18 (diff)
downloadredis-f96a8a8054b3b699c2fba797bdcd203dda1168ce.tar.gz
rioInitWithFile nad rioInitWithBuffer functions now take a rio structure pointer to avoid copying a structure to return value to the caller.
Diffstat (limited to 'src/rio.c')
-rw-r--r--src/rio.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/rio.c b/src/rio.c
index ebe24a3d7..f695a4824 100644
--- a/src/rio.c
+++ b/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". */