aboutsummaryrefslogtreecommitdiffstats
path: root/awk.h
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-11-23 19:56:27 +0200
committerArnold D. Robbins <arnold@skeeve.com>2014-11-23 19:56:27 +0200
commit2513062a4c89b0b60c3717d506fce841d44d871e (patch)
treeae2a21e0a0e0173c1c8b44e9e087da1ab357d66b /awk.h
parent838f65088cda84edc2df609d3e388acb3c8eb13d (diff)
downloadegawk-2513062a4c89b0b60c3717d506fce841d44d871e.tar.gz
egawk-2513062a4c89b0b60c3717d506fce841d44d871e.tar.bz2
egawk-2513062a4c89b0b60c3717d506fce841d44d871e.zip
Fix compile problems and warnings on current GCC (4.9.2).
Diffstat (limited to 'awk.h')
-rw-r--r--awk.h126
1 files changed, 63 insertions, 63 deletions
diff --git a/awk.h b/awk.h
index 84c8ca0e..3abad6f8 100644
--- a/awk.h
+++ b/awk.h
@@ -1245,74 +1245,12 @@ DEREF(NODE *r)
#define cant_happen() r_fatal("internal error line %d, file: %s", \
__LINE__, __FILE__)
-#define fatal set_loc(__FILE__, __LINE__), r_fatal
-
-static inline void *
-emalloc_real(size_t count, const char *where, const char *var, const char *file, int line)
-{
- void *ret;
-
- if (count == 0)
- fatal("%s:%d: emalloc called with zero bytes", file, line);
-
- ret = (void *) malloc(count);
- if (ret == NULL)
- fatal(_("%s:%d:%s: %s: can't allocate %ld bytes of memory (%s)"),
- file, line, where, var, (long) count, strerror(errno));
-
- return ret;
-}
-
-static inline void *
-erealloc_real(void *ptr, size_t count, const char *where, const char *var, const char *file, int line)
-{
- void *ret;
-
- if (count == 0)
- fatal("%s:%d: erealloc called with zero bytes", file, line);
-
- ret = (void *) realloc(ptr, count);
- if (ret == NULL)
- fatal(_("%s:%d:%s: %s: can't reallocate %ld bytes of memory (%s)"),
- file, line, where, var, (long) count, strerror(errno));
-
- return ret;
-}
-
#define emalloc(var,ty,x,str) (void) (var = (ty) emalloc_real((size_t)(x), str, #var, __FILE__, __LINE__))
#define erealloc(var,ty,x,str) (void) (var = (ty) erealloc_real((void *) var, (size_t)(x), str, #var, __FILE__, __LINE__))
#define efree(p) free(p)
-static inline NODE *
-force_string(NODE *s)
-{
- if ((s->flags & STRCUR) != 0
- && (s->stfmt == -1 || s->stfmt == CONVFMTidx)
- )
- return s;
- return format_val(CONVFMT, CONVFMTidx, s);
-}
-
-#ifdef GAWKDEBUG
-#define unref r_unref
-#define force_number str2number
-#else /* not GAWKDEBUG */
-
-static inline void
-unref(NODE *r)
-{
- if (r != NULL && --r->valref <= 0)
- r_unref(r);
-}
-
-static inline NODE *
-force_number(NODE *n)
-{
- return (n->flags & NUMCUR) ? n : str2number(n);
-}
-
-#endif /* GAWKDEBUG */
+#define fatal set_loc(__FILE__, __LINE__), r_fatal
extern jmp_buf fatal_tag;
extern bool fatal_tag_valid;
@@ -1800,3 +1738,65 @@ dupnode(NODE *n)
return r_dupnode(n);
}
#endif
+
+static inline NODE *
+force_string(NODE *s)
+{
+ if ((s->flags & STRCUR) != 0
+ && (s->stfmt == -1 || s->stfmt == CONVFMTidx)
+ )
+ return s;
+ return format_val(CONVFMT, CONVFMTidx, s);
+}
+
+#ifdef GAWKDEBUG
+#define unref r_unref
+#define force_number str2number
+#else /* not GAWKDEBUG */
+
+static inline void
+unref(NODE *r)
+{
+ if (r != NULL && --r->valref <= 0)
+ r_unref(r);
+}
+
+static inline NODE *
+force_number(NODE *n)
+{
+ return (n->flags & NUMCUR) ? n : str2number(n);
+}
+
+#endif /* GAWKDEBUG */
+
+static inline void *
+emalloc_real(size_t count, const char *where, const char *var, const char *file, int line)
+{
+ void *ret;
+
+ if (count == 0)
+ fatal("%s:%d: emalloc called with zero bytes", file, line);
+
+ ret = (void *) malloc(count);
+ if (ret == NULL)
+ fatal(_("%s:%d:%s: %s: can't allocate %ld bytes of memory (%s)"),
+ file, line, where, var, (long) count, strerror(errno));
+
+ return ret;
+}
+
+static inline void *
+erealloc_real(void *ptr, size_t count, const char *where, const char *var, const char *file, int line)
+{
+ void *ret;
+
+ if (count == 0)
+ fatal("%s:%d: erealloc called with zero bytes", file, line);
+
+ ret = (void *) realloc(ptr, count);
+ if (ret == NULL)
+ fatal(_("%s:%d:%s: %s: can't reallocate %ld bytes of memory (%s)"),
+ file, line, where, var, (long) count, strerror(errno));
+
+ return ret;
+}