summaryrefslogtreecommitdiff
path: root/src/t_zset.c
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2022-03-28 18:35:56 +0300
committerGitHub <noreply@github.com>2022-03-28 18:35:56 +0300
commit14b198868fd8f8c7cbd319bec369fbc3fb24aff6 (patch)
tree697849f07d2a07b45a36ab036cdc3ed897294296 /src/t_zset.c
parent3f28d7d712329261d0c56df77eef37c88d610cf3 (diff)
downloadredis-14b198868fd8f8c7cbd319bec369fbc3fb24aff6.tar.gz
introduce MAX_D2STRING_CHARS instead of 128 const (#10487)
There are a few places that use a hard coded const of 128 to allocate a buffer for d2string. Replace these with a clear macro. Note that In theory, converting double into string could take as much as nearly 400 chars, but since d2string uses `%g` and not `%f`, it won't pass some 40 chars. unrelated: restore some changes to auto generated commands.c that got accidentally reverted in #10293
Diffstat (limited to 'src/t_zset.c')
-rw-r--r--src/t_zset.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/t_zset.c b/src/t_zset.c
index 3710b62d7..77ca7c83a 100644
--- a/src/t_zset.c
+++ b/src/t_zset.c
@@ -1027,7 +1027,7 @@ unsigned char *zzlDelete(unsigned char *zl, unsigned char *eptr) {
unsigned char *zzlInsertAt(unsigned char *zl, unsigned char *eptr, sds ele, double score) {
unsigned char *sptr;
- char scorebuf[128];
+ char scorebuf[MAX_D2STRING_CHARS];
int scorelen;
scorelen = d2string(scorebuf,sizeof(scorebuf),score);