Change typeNameCanonicalize -> getObjectTypeName, and other style changes

This commit is contained in:
Angus Pearson 2019-07-08 11:04:37 +01:00
parent 38cd5fd9f6
commit 6eb52e200c
2 changed files with 7 additions and 8 deletions

View File

@ -767,7 +767,7 @@ void scanGenericCommand(client *c, robj *o, unsigned long cursor) {
/* Filter an element if it isn't the type we want. */ /* Filter an element if it isn't the type we want. */
if (!filter && o == NULL && typename){ if (!filter && o == NULL && typename){
robj* typecheck = lookupKeyReadWithFlags(c->db, kobj, LOOKUP_NOTOUCH); robj* typecheck = lookupKeyReadWithFlags(c->db, kobj, LOOKUP_NOTOUCH);
char* type = typeNameCanonicalize(typecheck); char* type = getObjectTypeName(typecheck);
if (strcasecmp((char*) typename, type)) filter = 1; if (strcasecmp((char*) typename, type)) filter = 1;
} }
@ -827,7 +827,7 @@ void lastsaveCommand(client *c) {
addReplyLongLong(c,server.lastsave); addReplyLongLong(c,server.lastsave);
} }
char* typeNameCanonicalize(robj *o) { char* getObjectTypeName(robj *o) {
char* type; char* type;
if (o == NULL) { if (o == NULL) {
type = "none"; type = "none";
@ -852,7 +852,7 @@ char* typeNameCanonicalize(robj *o) {
void typeCommand(client *c) { void typeCommand(client *c) {
robj *o; robj *o;
o = lookupKeyReadWithFlags(c->db,c->argv[1],LOOKUP_NOTOUCH); o = lookupKeyReadWithFlags(c->db,c->argv[1],LOOKUP_NOTOUCH);
addReplyStatus(c, typeNameCanonicalize(o)); addReplyStatus(c, getObjectTypeName(o));
} }
void shutdownCommand(client *c) { void shutdownCommand(client *c) {

View File

@ -646,11 +646,10 @@ typedef struct redisObject {
void *ptr; void *ptr;
} robj; } robj;
/* The 'canonical' name for a type as enumerated above is given by the /* The a string name for an object's type as listed above
* below function. Native types are checked against the OBJ_STRING, * Native types are checked against the OBJ_STRING, OBJ_LIST, OBJ_* defines,
* OBJ_LIST, OBJ_* defines, and Module types have their registered name * and Module types have their registered name returned. */
* returned.*/ char *getObjectTypeName(robj*);
char* typeNameCanonicalize(robj*);
/* Macro used to initialize a Redis object allocated on the stack. /* Macro used to initialize a Redis object allocated on the stack.
* Note that this macro is taken near the structure definition to make sure * Note that this macro is taken near the structure definition to make sure