much less evil syntax - ploot - simple plotting tools HTML git clone git://bitreich.org/ploot git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/ploot DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 0f63680382fb6f810f4ac27df9793db7cba292cc DIR parent 9bd929c04277a0f9d0056e5b50f1233054a4b17f HTML Author: Josuah Demangeon <mail@josuah.net> Date: Wed, 2 May 2018 16:50:19 +0200 much less evil syntax Diffstat: M ffplot.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) --- DIR diff --git a/ffplot.c b/ffplot.c @@ -239,27 +239,28 @@ find_scales(Vlist *v, int n, dv = *vmax - *vmin; dt = *tmax - *tmin; - for (ts = tscale; ts < tscale + LEN(tscale); ts++) { + for (ts = tscale; ts < tscale + LEN(tscale); ts++) if (dt < *ts * YDENSITY) { *tstep = *ts; break; } - } - if (dv > 1) for (i = 1; i != 0; i *= 10) { - for (vs = vscale; vs < vscale + LEN(vscale); vs++) { - if (dv < *vs * i * XDENSITY) { - *vstep = *vs * i; - return; + if (dv > 1) { + for (i = 1; i != 0; i *= 10) { + for (vs = vscale; vs < vscale + LEN(vscale); vs++) { + if (dv < *vs * i * XDENSITY) { + *vstep = *vs * i; + return; + } } } - } - - for (i = 1; i != 0; i *= 10) { - for (vs = vscale + LEN(vscale) - 1; vs >= vscale; vs--) { - if (dv > *vs / i * XDENSITY / 2) { - *vstep = *vs / i; - return; + } else { + for (i = 1; i != 0; i *= 10) { + for (vs = vscale + LEN(vscale) - 1; vs >= vscale; vs--) { + if (dv > *vs / i * XDENSITY / 2) { + *vstep = *vs / i; + return; + } } } }