Skip to content

Commit 1aac4bf

Browse files
committed
noping: dynamic graph padding
1 parent d0f8e12 commit 1aac4bf

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
@@ -940,7 +940,7 @@ static int update_graph_boxplot (ping_context_t *ctx, int graph_x, int graph_y)
940940
x_max = (size_t) getmaxx (ctx->window);
941941
if (x_max <= 8)
942942
return (EINVAL);
943-
x_max -= 4;
943+
x_max -= 2 * graph_x;
944944

945945
counters = calloc (x_max, sizeof (*counters));
946946
ratios = calloc (x_max, sizeof (*ratios));
@@ -1039,7 +1039,7 @@ static int update_graph_prettyping (ping_context_t *ctx, /* {{{ */
10391039
x_max = (size_t) getmaxx (ctx->window);
10401040
if (x_max <= 4)
10411041
return (EINVAL);
1042-
x_max -= 4;
1042+
x_max -= 2 * graph_x;
10431043

10441044
/* Determine the first index in the history we need to draw
10451045
* the graph. */
@@ -1169,7 +1169,7 @@ static int update_graph_histogram (ping_context_t *ctx, int graph_x, int graph_y
11691169
x_max = (size_t) getmaxx (ctx->window);
11701170
if (x_max <= 4)
11711171
return (EINVAL);
1172-
x_max -= 4;
1172+
x_max -= 2 * graph_x;
11731173

11741174
counters = calloc (x_max, sizeof (*counters));
11751175
accumulated = calloc (x_max, sizeof (*accumulated));

0 commit comments

Comments
 (0)