From 2dcbbf2cd80f1f2c5b9ce1aed67d28093929ccaa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Antoine=20Beaupr=C3=A9?= Date: Fri, 6 Dec 2013 00:07:09 -0500 Subject: [PATCH] move unicode detection to a separate function this will ease transition to a commandline option override --- src/oping.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/oping.c b/src/oping.c index 0cb084f..aa99ef9 100644 --- a/src/oping.c +++ b/src/oping.c @@ -635,6 +635,11 @@ static void time_calc (struct timespec *ts_dest, /* {{{ */ } /* }}} void time_calc */ #if USE_NCURSES +static int unicode_locale() /* {{{ */ +{ + return _nc_unicode_locale(); +} /* }}} int unicode_locale */ + static int update_prettyping_graph (ping_context_t *ctx, /* {{{ */ double latency, unsigned int sequence) { @@ -650,7 +655,7 @@ static int update_prettyping_graph (ping_context_t *ctx, /* {{{ */ x_max = getmaxx (ctx->window); x_pos = ((sequence - 1) % (x_max - 4)) + 2; - if (_nc_unicode_locale()) + if (unicode_locale()) { hist_symbols_num = hist_symbols_utf8_num; } @@ -676,7 +681,7 @@ static int update_prettyping_graph (ping_context_t *ctx, /* {{{ */ assert (index_colors < hist_colors_num); index_symbols = intensity % hist_symbols_num; - if (_nc_unicode_locale()) + if (unicode_locale()) { color = hist_colors_utf8[index_colors]; symbol = hist_symbols_utf8[index_symbols]; @@ -691,7 +696,7 @@ static int update_prettyping_graph (ping_context_t *ctx, /* {{{ */ wattron (ctx->window, A_BOLD); wattron (ctx->window, COLOR_PAIR(color)); - if (_nc_unicode_locale()) + if (unicode_locale()) { mvwprintw (ctx->window, /* y = */ 3, -- 2.30.2