summaryrefslogtreecommitdiff
path: root/src/hyperloglog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hyperloglog.c')
-rw-r--r--src/hyperloglog.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/hyperloglog.c b/src/hyperloglog.c
index d018e975e..75a04227c 100644
--- a/src/hyperloglog.c
+++ b/src/hyperloglog.c
@@ -205,7 +205,7 @@ struct hllhdr {
#define HLL_RAW 255 /* Only used internally, never exposed. */
#define HLL_MAX_ENCODING 1
-static char *invalid_hll_err = "-INVALIDOBJ Corrupted HLL object detected\r\n";
+static char *invalid_hll_err = "-INVALIDOBJ Corrupted HLL object detected";
/* =========================== Low level bit macros ========================= */
@@ -1171,9 +1171,8 @@ int isHLLObjectOrReply(client *c, robj *o) {
return C_OK;
invalid:
- addReplySds(c,
- sdsnew("-WRONGTYPE Key is not a valid "
- "HyperLogLog string value.\r\n"));
+ addReplyError(c,"-WRONGTYPE Key is not a valid "
+ "HyperLogLog string value.");
return C_ERR;
}
@@ -1203,7 +1202,7 @@ void pfaddCommand(client *c) {
updated++;
break;
case -1:
- addReplySds(c,sdsnew(invalid_hll_err));
+ addReplyError(c,invalid_hll_err);
return;
}
}
@@ -1211,7 +1210,7 @@ void pfaddCommand(client *c) {
if (updated) {
signalModifiedKey(c,c->db,c->argv[1]);
notifyKeyspaceEvent(NOTIFY_STRING,"pfadd",c->argv[1],c->db->id);
- server.dirty++;
+ server.dirty += updated;
HLL_INVALIDATE_CACHE(hdr);
}
addReply(c, updated ? shared.cone : shared.czero);
@@ -1245,7 +1244,7 @@ void pfcountCommand(client *c) {
/* Merge with this HLL with our 'max' HLL by setting max[i]
* to MAX(max[i],hll[i]). */
if (hllMerge(registers,o) == C_ERR) {
- addReplySds(c,sdsnew(invalid_hll_err));
+ addReplyError(c,invalid_hll_err);
return;
}
}
@@ -1285,7 +1284,7 @@ void pfcountCommand(client *c) {
/* Recompute it and update the cached value. */
card = hllCount(hdr,&invalid);
if (invalid) {
- addReplySds(c,sdsnew(invalid_hll_err));
+ addReplyError(c,invalid_hll_err);
return;
}
hdr->card[0] = card & 0xff;
@@ -1332,7 +1331,7 @@ void pfmergeCommand(client *c) {
/* Merge with this HLL with our 'max' HLL by setting max[i]
* to MAX(max[i],hll[i]). */
if (hllMerge(max,o) == C_ERR) {
- addReplySds(c,sdsnew(invalid_hll_err));
+ addReplyError(c,invalid_hll_err);
return;
}
}
@@ -1355,7 +1354,7 @@ void pfmergeCommand(client *c) {
/* Convert the destination object to dense representation if at least
* one of the inputs was dense. */
if (use_dense && hllSparseToDense(o) == C_ERR) {
- addReplySds(c,sdsnew(invalid_hll_err));
+ addReplyError(c,invalid_hll_err);
return;
}
@@ -1512,7 +1511,7 @@ void pfdebugCommand(client *c) {
if (hdr->encoding == HLL_SPARSE) {
if (hllSparseToDense(o) == C_ERR) {
- addReplySds(c,sdsnew(invalid_hll_err));
+ addReplyError(c,invalid_hll_err);
return;
}
server.dirty++; /* Force propagation on encoding change. */
@@ -1577,7 +1576,7 @@ void pfdebugCommand(client *c) {
if (hdr->encoding == HLL_SPARSE) {
if (hllSparseToDense(o) == C_ERR) {
- addReplySds(c,sdsnew(invalid_hll_err));
+ addReplyError(c,invalid_hll_err);
return;
}
conv = 1;