Lines Matching refs:c

103     unsigned char *c;  in redisBitpos()  local
119 c = (unsigned char*) s; in redisBitpos()
120 while((unsigned long)c & (sizeof(*l)-1) && count) { in redisBitpos()
121 if (*c != skipval) break; in redisBitpos()
122 c++; in redisBitpos()
129 l = (unsigned long*) c; in redisBitpos()
144 c = (unsigned char*)l; in redisBitpos()
148 word |= *c; in redisBitpos()
149 c++; in redisBitpos()
354 uint64_t a = value, b = incr, c; in checkSignedBitfieldOverflow() local
355 c = a+b; /* Perform addition as unsigned so that's defined. */ in checkSignedBitfieldOverflow()
360 if (c & msb) { in checkSignedBitfieldOverflow()
361 c |= mask; in checkSignedBitfieldOverflow()
363 c &= ~mask; in checkSignedBitfieldOverflow()
365 *limit = c; in checkSignedBitfieldOverflow()
404 int getBitOffsetFromArgument(client *c, robj *o, size_t *offset, int hash, int bits) { in getBitOffsetFromArgument() argument
415 addReplyError(c,err); in getBitOffsetFromArgument()
425 addReplyError(c,err); in getBitOffsetFromArgument()
440 int getBitfieldTypeFromArgument(client *c, robj *o, int *sign, int *bits) { in getBitfieldTypeFromArgument() argument
450 addReplyError(c,err); in getBitfieldTypeFromArgument()
459 addReplyError(c,err); in getBitfieldTypeFromArgument()
471 robj *lookupStringForBitCommand(client *c, size_t maxbit) { in lookupStringForBitCommand() argument
473 robj *o = lookupKeyWrite(c->db,c->argv[1]); in lookupStringForBitCommand()
477 dbAdd(c->db,c->argv[1],o); in lookupStringForBitCommand()
479 if (checkType(c,o,OBJ_STRING)) return NULL; in lookupStringForBitCommand()
480 o = dbUnshareStringValue(c->db,c->argv[1],o); in lookupStringForBitCommand()
518 void setbitCommand(client *c) { in setbitCommand() argument
526 if (getBitOffsetFromArgument(c,c->argv[2],&bitoffset,0,0) != C_OK) in setbitCommand()
529 if (getLongFromObjectOrReply(c,c->argv[3],&on,err) != C_OK) in setbitCommand()
534 addReplyError(c,err); in setbitCommand()
538 if ((o = lookupStringForBitCommand(c,bitoffset)) == NULL) return; in setbitCommand()
550 signalModifiedKey(c->db,c->argv[1]); in setbitCommand()
551 notifyKeyspaceEvent(NOTIFY_STRING,"setbit",c->argv[1],c->db->id); in setbitCommand()
553 addReply(c, bitval ? shared.cone : shared.czero); in setbitCommand()
557 void getbitCommand(client *c) { in getbitCommand() argument
564 if (getBitOffsetFromArgument(c,c->argv[2],&bitoffset,0,0) != C_OK) in getbitCommand()
567 if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL || in getbitCommand()
568 checkType(c,o,OBJ_STRING)) return; in getbitCommand()
580 addReply(c, bitval ? shared.cone : shared.czero); in getbitCommand()
584 void bitopCommand(client *c) { in bitopCommand() argument
585 char *opname = c->argv[1]->ptr; in bitopCommand()
586 robj *o, *targetkey = c->argv[2]; in bitopCommand()
605 addReply(c,shared.syntaxerr); in bitopCommand()
610 if (op == BITOP_NOT && c->argc != 4) { in bitopCommand()
611 addReplyError(c,"BITOP NOT must be called with a single source key."); in bitopCommand()
616 numkeys = c->argc - 3; in bitopCommand()
621 o = lookupKeyRead(c->db,c->argv[j+3]); in bitopCommand()
631 if (checkType(c,o,OBJ_STRING)) { in bitopCommand()
746 setKey(c->db,targetkey,o); in bitopCommand()
747 notifyKeyspaceEvent(NOTIFY_STRING,"set",targetkey,c->db->id); in bitopCommand()
749 } else if (dbDelete(c->db,targetkey)) { in bitopCommand()
750 signalModifiedKey(c->db,targetkey); in bitopCommand()
751 notifyKeyspaceEvent(NOTIFY_GENERIC,"del",targetkey,c->db->id); in bitopCommand()
754 addReplyLongLong(c,maxlen); /* Return the output string length in bytes. */ in bitopCommand()
758 void bitcountCommand(client *c) { in bitcountCommand() argument
765 if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL || in bitcountCommand()
766 checkType(c,o,OBJ_STRING)) return; in bitcountCommand()
770 if (c->argc == 4) { in bitcountCommand()
771 if (getLongFromObjectOrReply(c,c->argv[2],&start,NULL) != C_OK) in bitcountCommand()
773 if (getLongFromObjectOrReply(c,c->argv[3],&end,NULL) != C_OK) in bitcountCommand()
777 addReply(c,shared.czero); in bitcountCommand()
785 } else if (c->argc == 2) { in bitcountCommand()
791 addReply(c,shared.syntaxerr); in bitcountCommand()
798 addReply(c,shared.czero); in bitcountCommand()
802 addReplyLongLong(c,redisPopcount(p+start,bytes)); in bitcountCommand()
807 void bitposCommand(client *c) { in bitposCommand() argument
816 if (getLongFromObjectOrReply(c,c->argv[2],&bit,NULL) != C_OK) in bitposCommand()
819 addReplyError(c, "The bit argument must be 1 or 0."); in bitposCommand()
826 if ((o = lookupKeyRead(c->db,c->argv[1])) == NULL) { in bitposCommand()
827 addReplyLongLong(c, bit ? -1 : 0); in bitposCommand()
830 if (checkType(c,o,OBJ_STRING)) return; in bitposCommand()
834 if (c->argc == 4 || c->argc == 5) { in bitposCommand()
835 if (getLongFromObjectOrReply(c,c->argv[3],&start,NULL) != C_OK) in bitposCommand()
837 if (c->argc == 5) { in bitposCommand()
838 if (getLongFromObjectOrReply(c,c->argv[4],&end,NULL) != C_OK) in bitposCommand()
850 } else if (c->argc == 3) { in bitposCommand()
856 addReply(c,shared.syntaxerr); in bitposCommand()
863 addReplyLongLong(c, -1); in bitposCommand()
876 addReplyLongLong(c,-1); in bitposCommand()
880 addReplyLongLong(c,pos); in bitposCommand()
903 void bitfieldCommand(client *c) { in bitfieldCommand() argument
912 for (j = 2; j < c->argc; j++) { in bitfieldCommand()
913 int remargs = c->argc-j-1; /* Remaining args other than current. */ in bitfieldCommand()
914 char *subcmd = c->argv[j]->ptr; /* Current command name. */ in bitfieldCommand()
927 char *owtypename = c->argv[j+1]->ptr; in bitfieldCommand()
936 addReplyError(c,"Invalid OVERFLOW type specified"); in bitfieldCommand()
942 addReply(c,shared.syntaxerr); in bitfieldCommand()
948 if (getBitfieldTypeFromArgument(c,c->argv[j+1],&sign,&bits) != C_OK) { in bitfieldCommand()
953 if (getBitOffsetFromArgument(c,c->argv[j+2],&bitoffset,1,bits) != C_OK){ in bitfieldCommand()
962 if (getLongLongFromObjectOrReply(c,c->argv[j+3],&i64,NULL) != C_OK){ in bitfieldCommand()
984 o = lookupKeyRead(c->db,c->argv[1]); in bitfieldCommand()
985 if (o != NULL && checkType(c,o,OBJ_STRING)) return; in bitfieldCommand()
989 if ((o = lookupStringForBitCommand(c, in bitfieldCommand()
993 addReplyMultiBulkLen(c,numops); in bitfieldCommand()
1034 addReplyLongLong(c,retval); in bitfieldCommand()
1038 addReply(c,shared.nullbulk); in bitfieldCommand()
1063 addReplyLongLong(c,retval); in bitfieldCommand()
1067 addReply(c,shared.nullbulk); in bitfieldCommand()
1098 addReplyLongLong(c,val); in bitfieldCommand()
1102 addReplyLongLong(c,val); in bitfieldCommand()
1108 signalModifiedKey(c->db,c->argv[1]); in bitfieldCommand()
1109 notifyKeyspaceEvent(NOTIFY_STRING,"setbit",c->argv[1],c->db->id); in bitfieldCommand()