diff options
author | Sun He <sunheehnus@gmail.com> | 2014-12-08 11:15:06 +0800 |
---|---|---|
committer | Sun He <sunheehnus@gmail.com> | 2014-12-08 11:15:06 +0800 |
commit | c87a37661e14b288d2510b3e4de088a3fed3e5c0 (patch) | |
tree | abf96b9db1478398ac0b6a5fd8f016558a26fe2c /src/sparkline.c | |
parent | 93eed9ae0163e328c33b16ab9ea3c4fbe0f98674 (diff) | |
download | redis-c87a37661e14b288d2510b3e4de088a3fed3e5c0.tar.gz |
sparkline.c: mov label-ini into the AddSample Function
Diffstat (limited to 'src/sparkline.c')
-rw-r--r-- | src/sparkline.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/sparkline.c b/src/sparkline.c index 900f26ab7..3355a598c 100644 --- a/src/sparkline.c +++ b/src/sparkline.c @@ -49,7 +49,7 @@ static int label_margin_top = 1; * sparklineSequenceAddSample(seq, 10, NULL); * sparklineSequenceAddSample(seq, 20, NULL); * sparklineSequenceAddSample(seq, 30, "last sample label"); - * sds output = sparklineRender(seq, 80, 4); + * sds output = sparklineRender(sdsempty(), seq, 80, 4, SPARKLINE_FILL); * freeSparklineSequence(seq); * ------------------------------------------------------------------------- */ @@ -63,6 +63,7 @@ struct sequence *createSparklineSequence(void) { /* Add a new sample into a sequence. */ void sparklineSequenceAddSample(struct sequence *seq, double value, char *label) { + label = label == NULL ? label : zstrdup(label); if (seq->length == 0) { seq->min = seq->max = value; } else { |