mirror of
http://github.com/valkey-io/valkey
synced 2024-11-23 20:00:00 +00:00
Rename some redis structs to server (#178)
- redisFunctionSym -> serverFunctionSym - redisSortObject -> serverSortObject - redisSortOperation -> serverSortOperation #144 Signed-off-by: 0del <bany.y0599@gmail.com>
This commit is contained in:
parent
1736018aa9
commit
add5f5615c
10
src/server.h
10
src/server.h
@ -2390,23 +2390,23 @@ struct serverError {
|
||||
long long count;
|
||||
};
|
||||
|
||||
struct redisFunctionSym {
|
||||
struct serverFunctionSym {
|
||||
char *name;
|
||||
unsigned long pointer;
|
||||
};
|
||||
|
||||
typedef struct _redisSortObject {
|
||||
typedef struct _serverSortObject {
|
||||
robj *obj;
|
||||
union {
|
||||
double score;
|
||||
robj *cmpobj;
|
||||
} u;
|
||||
} redisSortObject;
|
||||
} serverSortObject;
|
||||
|
||||
typedef struct _redisSortOperation {
|
||||
typedef struct _serverSortOperation {
|
||||
int type;
|
||||
robj *pattern;
|
||||
} redisSortOperation;
|
||||
} serverSortOperation;
|
||||
|
||||
/* Structure to hold list iteration abstraction. */
|
||||
typedef struct {
|
||||
|
18
src/sort.c
18
src/sort.c
@ -36,8 +36,8 @@
|
||||
|
||||
zskiplistNode* zslGetElementByRank(zskiplist *zsl, unsigned long rank);
|
||||
|
||||
redisSortOperation *createSortOperation(int type, robj *pattern) {
|
||||
redisSortOperation *so = zmalloc(sizeof(*so));
|
||||
serverSortOperation *createSortOperation(int type, robj *pattern) {
|
||||
serverSortOperation *so = zmalloc(sizeof(*so));
|
||||
so->type = type;
|
||||
so->pattern = pattern;
|
||||
return so;
|
||||
@ -137,7 +137,7 @@ noobj:
|
||||
* the additional parameter is not standard but a BSD-specific we have to
|
||||
* pass sorting parameters via the global 'server' structure */
|
||||
int sortCompare(const void *s1, const void *s2) {
|
||||
const redisSortObject *so1 = s1, *so2 = s2;
|
||||
const serverSortObject *so1 = s1, *so2 = s2;
|
||||
int cmp;
|
||||
|
||||
if (!server.sort_alpha) {
|
||||
@ -197,7 +197,7 @@ void sortCommandGeneric(client *c, int readonly) {
|
||||
int int_conversion_error = 0;
|
||||
int syntax_error = 0;
|
||||
robj *sortval, *sortby = NULL, *storekey = NULL;
|
||||
redisSortObject *vector; /* Resulting vector to sort */
|
||||
serverSortObject *vector; /* Resulting vector to sort */
|
||||
int user_has_full_key_access = 0; /* ACL - used in order to verify 'get' and 'by' options can be used */
|
||||
/* Create a list of operations to perform for every sorted element.
|
||||
* Operations can be GET */
|
||||
@ -363,7 +363,7 @@ void sortCommandGeneric(client *c, int readonly) {
|
||||
}
|
||||
|
||||
/* Load the sorting vector with all the objects to sort */
|
||||
vector = zmalloc(sizeof(redisSortObject)*vectorlen);
|
||||
vector = zmalloc(sizeof(serverSortObject)*vectorlen);
|
||||
j = 0;
|
||||
|
||||
if (sortval->type == OBJ_LIST && dontsort) {
|
||||
@ -516,9 +516,9 @@ void sortCommandGeneric(client *c, int readonly) {
|
||||
server.sort_bypattern = sortby ? 1 : 0;
|
||||
server.sort_store = storekey ? 1 : 0;
|
||||
if (sortby && (start != 0 || end != vectorlen-1))
|
||||
pqsort(vector,vectorlen,sizeof(redisSortObject),sortCompare, start,end);
|
||||
pqsort(vector,vectorlen,sizeof(serverSortObject),sortCompare, start,end);
|
||||
else
|
||||
qsort(vector,vectorlen,sizeof(redisSortObject),sortCompare);
|
||||
qsort(vector,vectorlen,sizeof(serverSortObject),sortCompare);
|
||||
}
|
||||
|
||||
/* Send command output to the output buffer, performing the specified
|
||||
@ -536,7 +536,7 @@ void sortCommandGeneric(client *c, int readonly) {
|
||||
if (!getop) addReplyBulk(c,vector[j].obj);
|
||||
listRewind(operations,&li);
|
||||
while((ln = listNext(&li))) {
|
||||
redisSortOperation *sop = ln->value;
|
||||
serverSortOperation *sop = ln->value;
|
||||
robj *val = lookupKeyByPattern(c->db,sop->pattern,
|
||||
vector[j].obj);
|
||||
|
||||
@ -568,7 +568,7 @@ void sortCommandGeneric(client *c, int readonly) {
|
||||
} else {
|
||||
listRewind(operations,&li);
|
||||
while((ln = listNext(&li))) {
|
||||
redisSortOperation *sop = ln->value;
|
||||
serverSortOperation *sop = ln->value;
|
||||
robj *val = lookupKeyByPattern(c->db,sop->pattern,
|
||||
vector[j].obj);
|
||||
|
||||
|
@ -12,7 +12,7 @@ while {[gets $fd line] != -1} {
|
||||
}
|
||||
}
|
||||
set symlist [lsort -unique $symlist]
|
||||
puts "static struct redisFunctionSym symsTable\[\] = {"
|
||||
puts "static struct serverFunctionSym symsTable\[\] = {"
|
||||
foreach sym $symlist {
|
||||
puts "{\"$sym\",(unsigned long)$sym},"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user