alloc_re.c
author tomas@localhost
Thu, 01 Nov 2007 14:46:11 +0100
changeset 0 c045670f36e9
permissions -rw-r--r--
Imported queue-fix-1.4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     1
#include "alloc.h"
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     2
#include "byte.h"
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     3
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     4
int alloc_re(x,m,n)
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     5
char **x;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     6
unsigned int m;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     7
unsigned int n;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     8
{
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     9
  char *y;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    10
 
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    11
  y = alloc(n);
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    12
  if (!y) return 0;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    13
  byte_copy(y,m,*x);
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    14
  alloc_free(*x);
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    15
  *x = y;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    16
  return 1;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    17
}