summaryrefslogtreecommitdiff
path: root/src/sparkline.c
diff options
context:
space:
mode:
authorSun He <sunheehnus@gmail.com>2014-12-08 11:15:06 +0800
committerSun He <sunheehnus@gmail.com>2014-12-08 11:15:06 +0800
commitc87a37661e14b288d2510b3e4de088a3fed3e5c0 (patch)
treeabf96b9db1478398ac0b6a5fd8f016558a26fe2c /src/sparkline.c
parent93eed9ae0163e328c33b16ab9ea3c4fbe0f98674 (diff)
downloadredis-c87a37661e14b288d2510b3e4de088a3fed3e5c0.tar.gz
sparkline.c: mov label-ini into the AddSample Function
Diffstat (limited to 'src/sparkline.c')
-rw-r--r--src/sparkline.c3
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 {