From: Antoine Beaupré Date: Fri, 6 Dec 2013 05:07:09 +0000 (-0500) Subject: move unicode detection to a separate function X-Git-Tag: liboping-1.7.0~5^2~5 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=2dcbbf2cd80f1f2c5b9ce1aed67d28093929ccaa;p=liboping.git move unicode detection to a separate function this will ease transition to a commandline option override --- 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,