X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/2e4b0e7727743cf03d25da0f535ecc02aad82d1f..61c0e893aad4ba476aa9e001a3df10844972b901:/src/rio.h diff --git a/src/rio.h b/src/rio.h index fe863cb5..2a830eb5 100644 --- a/src/rio.h +++ b/src/rio.h @@ -5,8 +5,9 @@ #include "sds.h" struct _rio { - /* Backend functions. Both read and write should return 0 for short reads - * or writes, identical to the return values of fread/fwrite. */ + /* Backend functions. + * Since this functions do not tolerate short writes or reads the return + * value is simplified to: zero on error, non zero on complete success. */ size_t (*read)(struct _rio *, void *buf, size_t len); size_t (*write)(struct _rio *, const void *buf, size_t len); off_t (*tell)(struct _rio *); @@ -28,8 +29,8 @@ typedef struct _rio rio; #define rioWrite(rio,buf,len) ((rio)->write((rio),(buf),(len))) #define rioRead(rio,buf,len) ((rio)->read((rio),(buf),(len))) -rio rioInitWithFile(FILE *fp); -rio rioInitWithBuffer(sds s); +void rioInitWithFile(rio *r, FILE *fp); +void rioInitWithBuffer(rio *r, sds s); size_t rioWriteBulkCount(rio *r, char prefix, int count); size_t rioWriteBulkString(rio *r, const char *buf, size_t len);