| 637 | } |
| 638 | |
| 639 | void incrbyfloatCommand(client *c) { |
| 640 | long double incr, value; |
| 641 | robj *o, *new; |
| 642 | |
| 643 | o = lookupKeyWrite(c->db,c->argv[1]); |
| 644 | if (checkType(c,o,OBJ_STRING)) return; |
| 645 | if (getLongDoubleFromObjectOrReply(c,o,&value,NULL) != C_OK || |
| 646 | getLongDoubleFromObjectOrReply(c,c->argv[2],&incr,NULL) != C_OK) |
| 647 | return; |
| 648 | |
| 649 | value += incr; |
| 650 | if (isnan(value) || isinf(value)) { |
| 651 | addReplyError(c,"increment would produce NaN or Infinity"); |
| 652 | return; |
| 653 | } |
| 654 | new = createStringObjectFromLongDouble(value,1); |
| 655 | if (o) |
| 656 | dbOverwrite(c->db,c->argv[1],new); |
| 657 | else |
| 658 | dbAdd(c->db,c->argv[1],new); |
| 659 | signalModifiedKey(c,c->db,c->argv[1]); |
| 660 | notifyKeyspaceEvent(NOTIFY_STRING,"incrbyfloat",c->argv[1],c->db->id); |
| 661 | server.dirty++; |
| 662 | addReplyBulk(c,new); |
| 663 | |
| 664 | /* Always replicate INCRBYFLOAT as a SET command with the final value |
| 665 | * in order to make sure that differences in float precision or formatting |
| 666 | * will not create differences in replicas or after an AOF restart. */ |
| 667 | rewriteClientCommandArgument(c,0,shared.set); |
| 668 | rewriteClientCommandArgument(c,2,new); |
| 669 | rewriteClientCommandArgument(c,3,shared.keepttl); |
| 670 | } |
| 671 | |
| 672 | void appendCommand(client *c) { |
| 673 | size_t totlen; |
nothing calls this directly
no test coverage detected