Skip to content

Commit b3bb469

Browse files
committed
noping: dynamic graph padding
1 parent 7997ae2 commit b3bb469

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/oping.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ static int update_graph_boxplot (ping_context_t *ctx, int graph_x, int graph_y)
902902
x_max = (size_t) getmaxx (ctx->window);
903903
if (x_max <= 8)
904904
return (EINVAL);
905-
x_max -= 4;
905+
x_max -= 2 * graph_x;
906906

907907
counters = calloc (x_max, sizeof (*counters));
908908
ratios = calloc (x_max, sizeof (*ratios));
@@ -1001,7 +1001,7 @@ static int update_graph_prettyping (ping_context_t *ctx, /* {{{ */
10011001
x_max = (size_t) getmaxx (ctx->window);
10021002
if (x_max <= 4)
10031003
return (EINVAL);
1004-
x_max -= 4;
1004+
x_max -= 2 * graph_x;
10051005

10061006
/* Determine the first index in the history we need to draw
10071007
* the graph. */
@@ -1127,7 +1127,7 @@ static int update_graph_histogram (ping_context_t *ctx, int graph_x, int graph_y
11271127
x_max = (size_t) getmaxx (ctx->window);
11281128
if (x_max <= 4)
11291129
return (EINVAL);
1130-
x_max -= 4;
1130+
x_max -= 2 * graph_x;
11311131

11321132
counters = calloc (x_max, sizeof (*counters));
11331133
accumulated = calloc (x_max, sizeof (*accumulated));

0 commit comments

Comments
 (0)