@@ -483,7 +483,7 @@ robj *lookupStringForBitCommand(client *c, size_t maxbit) {
483
483
o = createObject (OBJ_STRING ,sdsnewlen (NULL , byte + 1 ));
484
484
dbAdd (c -> db ,c -> argv [1 ],o );
485
485
} else {
486
- if (checkType (c ,o , OBJ_STRING )) return NULL ;
486
+ if (checkTypeStringvariant (c ,o )) return NULL ;
487
487
o = dbUnshareStringValue (c -> db ,c -> argv [1 ],o );
488
488
o -> ptr = sdsgrowzero (o -> ptr ,byte + 1 );
489
489
}
@@ -504,7 +504,7 @@ robj *lookupStringForBitCommand(client *c, size_t maxbit) {
504
504
* If the source object is NULL the function is guaranteed to return NULL
505
505
* and set 'len' to 0. */
506
506
unsigned char * getObjectReadOnlyString (robj * o , long * len , char * llbuf ) {
507
- serverAssert (o -> type == OBJ_STRING );
507
+ serverAssert (o -> type == OBJ_STRING || o -> type == OBJ_STRING_PMEM );
508
508
unsigned char * p = NULL ;
509
509
510
510
/* Set the 'p' pointer to the string, that can be just a stack allocated
@@ -572,7 +572,7 @@ void getbitCommand(client *c) {
572
572
return ;
573
573
574
574
if ((o = lookupKeyReadOrReply (c ,c -> argv [1 ],shared .czero )) == NULL ||
575
- checkType (c ,o , OBJ_STRING )) return ;
575
+ checkTypeStringvariant (c ,o )) return ;
576
576
577
577
byte = bitoffset >> 3 ;
578
578
bit = 7 - (bitoffset & 0x7 );
@@ -635,7 +635,7 @@ void bitopCommand(client *c) {
635
635
continue ;
636
636
}
637
637
/* Return an error if one of the keys is not a string. */
638
- if (checkType (c ,o , OBJ_STRING )) {
638
+ if (checkTypeStringvariant (c ,o )) {
639
639
unsigned long i ;
640
640
for (i = 0 ; i < j ; i ++ ) {
641
641
if (objects [i ])
@@ -774,7 +774,7 @@ void bitcountCommand(client *c) {
774
774
775
775
/* Lookup, check for type, and return 0 for non existing keys. */
776
776
if ((o = lookupKeyReadOrReply (c ,c -> argv [1 ],shared .czero )) == NULL ||
777
- checkType (c ,o , OBJ_STRING )) return ;
777
+ checkTypeStringvariant (c ,o )) return ;
778
778
p = getObjectReadOnlyString (o ,& strlen ,llbuf );
779
779
780
780
/* Parse start/end range if any. */
@@ -838,7 +838,7 @@ void bitposCommand(client *c) {
838
838
addReplyLongLong (c , bit ? -1 : 0 );
839
839
return ;
840
840
}
841
- if (checkType (c ,o , OBJ_STRING )) return ;
841
+ if (checkTypeStringvariant (c ,o )) return ;
842
842
p = getObjectReadOnlyString (o ,& strlen ,llbuf );
843
843
844
844
/* Parse start/end range if any. */
@@ -1000,7 +1000,7 @@ void bitfieldGeneric(client *c, int flags) {
1000
1000
/* Lookup for read is ok if key doesn't exit, but errors
1001
1001
* if it's not a string. */
1002
1002
o = lookupKeyRead (c -> db ,c -> argv [1 ]);
1003
- if (o != NULL && checkType (c ,o , OBJ_STRING )) {
1003
+ if (o != NULL && checkTypeStringvariant (c ,o )) {
1004
1004
zfree (ops );
1005
1005
return ;
1006
1006
}
0 commit comments