From e5353c0f447a8628985722296f57fc02dd2e0063 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 11 May 2012 15:05:35 +0300 Subject: Move to use of bool type, true, false, everywhere. --- node.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'node.c') diff --git a/node.c b/node.c index 8dbe68a9..ff593d22 100644 --- a/node.c +++ b/node.c @@ -120,7 +120,7 @@ r_force_number(NODE *n) if (do_non_decimal_data) { /* main.c assures false if do_posix */ errno = 0; - if (! do_traditional && get_numbase(cp, TRUE) != 10) { + if (! do_traditional && get_numbase(cp, true) != 10) { n->numbr = nondec2awknum(cp, cpend - cp); n->flags |= NUMCUR; ptr = cpend; @@ -564,10 +564,10 @@ parse_escape(const char **string_ptr) return i; case 'x': if (do_lint) { - static short warned = FALSE; + static bool warned = false; if (! warned) { - warned = TRUE; + warned = true; lintwarn(_("POSIX does not allow `\\x' escapes")); } } @@ -603,13 +603,13 @@ parse_escape(const char **string_ptr) return c; default: { - static short warned[256]; + static bool warned[256]; unsigned char uc = (unsigned char) c; /* N.B.: use unsigned char here to avoid Latin-1 problems */ if (! warned[uc]) { - warned[uc] = TRUE; + warned[uc] = true; warning(_("escape sequence `\\%c' treated as plain `%c'"), uc, uc); } @@ -621,7 +621,7 @@ parse_escape(const char **string_ptr) /* get_numbase --- return the base to use for the number in 's' */ int -get_numbase(const char *s, int use_locale) +get_numbase(const char *s, bool use_locale) { int dec_point = '.'; const char *str = s; @@ -672,7 +672,7 @@ str2wstr(NODE *n, size_t **ptr) char *sp; mbstate_t mbs; wchar_t wc, *wsp; - static short warned = FALSE; + static bool warned = false; assert((n->flags & (STRING|STRCUR)) != 0); @@ -755,7 +755,7 @@ str2wstr(NODE *n, size_t **ptr) memset(& mbs, 0, sizeof(mbs)); /* And warn the user something's wrong */ if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn(_("Invalid multibyte data detected. There may be a mismatch between your data and your locale.")); } break; @@ -936,7 +936,7 @@ is_ieee_magic_val(const char *val) static AWKNUM get_ieee_magic_val(const char *val) { - static short first = TRUE; + static bool first = true; static AWKNUM inf; static AWKNUM nan; @@ -945,7 +945,7 @@ get_ieee_magic_val(const char *val) if (val == ptr) { /* Older strtod implementations don't support inf or nan. */ if (first) { - first = FALSE; + first = false; nan = sqrt(-1.0); inf = -log(0.0); } -- cgit v1.2.3 From 0907dd281b71fb440c83fc53e6b4c7312f1c1f47 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 17 Jul 2012 23:13:14 +0300 Subject: Add AWK_VALUE_COOKIE. And performance speedup. --- node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'node.c') diff --git a/node.c b/node.c index ff593d22..c7316dcb 100644 --- a/node.c +++ b/node.c @@ -829,7 +829,7 @@ wstr2str(NODE *n) /* free_wstr --- release the wide string part of a node */ void -free_wstr(NODE *n) +r_free_wstr(NODE *n) { assert(n->type == Node_val); -- cgit v1.2.3 From e7bdf5ebd4162172e79c00196061af625bd729f2 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 4 Oct 2012 12:52:26 +0200 Subject: Clean up make_str_node macro. --- node.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'node.c') diff --git a/node.c b/node.c index c7316dcb..f8152bab 100644 --- a/node.c +++ b/node.c @@ -371,10 +371,10 @@ cmp_awknums(const NODE *t1, const NODE *t2) } -/* r_make_str_node --- make a string node */ +/* make_str_node --- make a string node */ NODE * -r_make_str_node(const char *s, size_t len, int flags) +make_str_node(const char *s, size_t len, int flags) { NODE *r; getnode(r); @@ -392,7 +392,7 @@ r_make_str_node(const char *s, size_t len, int flags) if (flags & ALREADY_MALLOCED) r->stptr = (char *) s; else { - emalloc(r->stptr, char *, len + 2, "r_make_str_node"); + emalloc(r->stptr, char *, len + 2, "make_str_node"); memcpy(r->stptr, s, len); } r->stptr[len] = '\0'; @@ -441,7 +441,7 @@ r_make_str_node(const char *s, size_t len, int flags) *ptm++ = c; } len = ptm - r->stptr; - erealloc(r->stptr, char *, len + 1, "r_make_str_node"); + erealloc(r->stptr, char *, len + 1, "make_str_node"); r->stptr[len] = '\0'; } r->stlen = len; -- cgit v1.2.3 From c9e416d0703fc11828a1d175002805b326029735 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 14 Nov 2012 21:37:47 +0200 Subject: Minor cleanup in calls to mpfr routines. --- node.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'node.c') diff --git a/node.c b/node.c index f8152bab..a857aa1d 100644 --- a/node.c +++ b/node.c @@ -471,12 +471,7 @@ r_unref(NODE *tmp) efree(tmp->stptr); #endif -#ifdef HAVE_MPFR - if (is_mpg_float(tmp)) - mpfr_clear(tmp->mpg_numbr); - else if (is_mpg_integer(tmp)) - mpz_clear(tmp->mpg_i); -#endif + mpfr_unset(tmp); free_wstr(tmp); freenode(tmp); -- cgit v1.2.3