Skip to content

Commit 75eaac5

Browse files
committed
Added a server.arch_bits field instead of computing it at runtime for INFO.
1 parent b80b1c5 commit 75eaac5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/redis.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,7 @@ void createSharedObjects(void) {
860860
}
861861

862862
void initServerConfig() {
863+
server.arch_bits = (sizeof(long) == 8) ? 64 : 32;
863864
server.port = REDIS_SERVERPORT;
864865
server.bindaddr = NULL;
865866
server.unixsocket = NULL;
@@ -1439,7 +1440,7 @@ sds genRedisInfoString(char *section) {
14391440
"redis_version:%s\r\n"
14401441
"redis_git_sha1:%s\r\n"
14411442
"redis_git_dirty:%d\r\n"
1442-
"arch_bits:%s\r\n"
1443+
"arch_bits:%d\r\n"
14431444
"multiplexing_api:%s\r\n"
14441445
"gcc_version:%d.%d.%d\r\n"
14451446
"process_id:%ld\r\n"
@@ -1450,7 +1451,7 @@ sds genRedisInfoString(char *section) {
14501451
REDIS_VERSION,
14511452
redisGitSHA1(),
14521453
strtol(redisGitDirty(),NULL,10) > 0,
1453-
(sizeof(long) == 8) ? "64" : "32",
1454+
server.arch_bits,
14541455
aeGetApiName(),
14551456
#ifdef __GNUC__
14561457
__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__,

src/redis.h

+1
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ struct redisServer {
527527
int activerehashing; /* Incremental rehash in serverCron() */
528528
char *requirepass; /* Pass for AUTH command, or NULL */
529529
char *pidfile; /* PID file path */
530+
int arch_bits; /* 32 or 64 depending on sizeof(long) */
530531
/* Networking */
531532
int port; /* TCP listening port */
532533
char *bindaddr; /* Bind address or NULL */

0 commit comments

Comments
 (0)