summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2004-10-05 06:33:53 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2004-10-05 06:33:53 +0000
commitbcae12896c3363667f2bf0d8358ffad005d80d1f (patch)
tree13f283f0d41827a8bb0ea2f2024bb0389be29d07 /src
parent1ccdcbff40a62554c860446eb5f9e37bf1460f90 (diff)
downloadcoreutils-bcae12896c3363667f2bf0d8358ffad005d80d1f.tar.xz
(NEW, OLD): Remove, partly to avoid
reference to obsolescent macro XMALLOC. All uses replaced by xmalloc and free.
Diffstat (limited to 'src')
-rw-r--r--src/expr.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/expr.c b/src/expr.c
index 46016ca00..eac5cf17f 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -44,10 +44,6 @@
#define AUTHORS "Mike Parker"
-#undef NEW
-#define NEW(Type) XMALLOC (Type, 1)
-#define OLD(x) free (x)
-
/* Exit statuses. */
enum
{
@@ -215,9 +211,7 @@ main (int argc, char **argv)
static VALUE *
int_value (intmax_t i)
{
- VALUE *v;
-
- v = NEW (VALUE);
+ VALUE *v = xmalloc (sizeof *v);
v->type = integer;
v->u.i = i;
return v;
@@ -228,9 +222,7 @@ int_value (intmax_t i)
static VALUE *
str_value (char *s)
{
- VALUE *v;
-
- v = NEW (VALUE);
+ VALUE *v = xmalloc (sizeof *v);
v->type = string;
v->u.s = xstrdup (s);
return v;
@@ -243,7 +235,7 @@ freev (VALUE *v)
{
if (v->type == string)
free (v->u.s);
- OLD (v);
+ free (v);
}
/* Print VALUE V. */
@@ -554,7 +546,7 @@ eval6 (bool evaluate)
v = str_value ("");
else
{
- v = NEW (VALUE);
+ v = xmalloc (sizeof *v);
v->type = string;
v->u.s = strncpy (xmalloc (i2->u.i + 1),
l->u.s + i1->u.i - 1, i2->u.i);