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
cf42c48a
Commit
cf42c48a
authored
Feb 18, 2016
by
antirez
Browse files
addReplyHumanLongDouble() API added.
Send a long double or double as a bulk reply, in a human friendly format.
parent
f4befcc0
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
cf42c48a
...
@@ -455,6 +455,15 @@ void addReplyDouble(client *c, double d) {
...
@@ -455,6 +455,15 @@ void addReplyDouble(client *c, double d) {
}
}
}
}
/* Add a long double as a bulk reply, but uses a human readable formatting
* of the double instead of exposing the crude behavior of doubles to the
* dear user. */
void addReplyHumanLongDouble(client *c, long double d) {
robj *o = createStringObjectFromLongDouble(d,1);
addReplyBulk(c,o);
decrRefCount(o);
}
/* Add a long long as integer reply or bulk len / multi bulk count.
/* Add a long long as integer reply or bulk len / multi bulk count.
* Basically this is used to output <prefix><long long><crlf>. */
* Basically this is used to output <prefix><long long><crlf>. */
void addReplyLongLongWithPrefix(client *c, long long ll, char prefix) {
void addReplyLongLongWithPrefix(client *c, long long ll, char prefix) {
...
...
src/server.h
View file @
cf42c48a
...
@@ -1123,6 +1123,7 @@ void addReplyBulkSds(client *c, sds s);
...
@@ -1123,6 +1123,7 @@ void addReplyBulkSds(client *c, sds s);
void addReplyError(client *c, const char *err);
void addReplyError(client *c, const char *err);
void addReplyStatus(client *c, const char *status);
void addReplyStatus(client *c, const char *status);
void addReplyDouble(client *c, double d);
void addReplyDouble(client *c, double d);
void addReplyHumanLongDouble(client *c, long double d);
void addReplyLongLong(client *c, long long ll);
void addReplyLongLong(client *c, long long ll);
void addReplyMultiBulkLen(client *c, long length);
void addReplyMultiBulkLen(client *c, long length);
void copyClientOutputBuffer(client *dst, client *src);
void copyClientOutputBuffer(client *dst, client *src);
...
...
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