Stop using /dev/null to find out the serialized object length

Now the rdbSave* functions return the number of bytes written (or
required to write) in serializing a Redis object, writing to /dev/null
and using ftell (which doesn't work on FreeBSD) isn't needed anymore.
This commit is contained in:
Pieter Noordhuis
2010-11-21 16:27:47 +01:00
parent 9a68cf91f0
commit bd70a5f588
5 changed files with 11 additions and 24 deletions

View File

@ -481,7 +481,6 @@ struct redisServer {
dict *pubsub_channels; /* Map channels to list of subscribed clients */
list *pubsub_patterns; /* A list of pubsub_patterns */
/* Misc */
FILE *devnull;
unsigned lruclock:22; /* clock incrementing every minute, for LRU */
unsigned lruclock_padding:10;
};
@ -743,8 +742,8 @@ int rdbSaveBackground(char *filename);
void rdbRemoveTempFile(pid_t childpid);
int rdbSave(char *filename);
int rdbSaveObject(FILE *fp, robj *o);
off_t rdbSavedObjectPages(robj *o, FILE *fp);
off_t rdbSavedObjectLen(robj *o, FILE *fp);
off_t rdbSavedObjectLen(robj *o);
off_t rdbSavedObjectPages(robj *o);
robj *rdbLoadObject(int type, FILE *fp);
void backgroundSaveDoneHandler(int statloc);