summaryrefslogtreecommitdiff
path: root/src/release.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/release.c')
-rw-r--r--src/release.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/release.c b/src/release.c
index 4e59c7474..e0bd018fc 100644
--- a/src/release.c
+++ b/src/release.c
@@ -32,6 +32,7 @@
* files using this functions. */
#include <string.h>
+#include <stdio.h>
#include "release.h"
#include "version.h"
@@ -50,3 +51,16 @@ uint64_t redisBuildId(void) {
return crc64(0,(unsigned char*)buildid,strlen(buildid));
}
+
+/* Return a cached value of the build string in order to avoid recomputing
+ * and converting it in hex every time: this string is shown in the INFO
+ * output that should be fast. */
+char *redisBuildIdString(void) {
+ static char buf[32];
+ static int cached = 0;
+ if (!cached) {
+ snprintf(buf,sizeof(buf),"%llx",(unsigned long long) redisBuildId());
+ cached = 1;
+ }
+ return buf;
+}