runit

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

alloc_re.c (218B)


      1 /* Public domain. */
      2 
      3 #include "alloc.h"
      4 #include "byte.h"
      5 
      6 int alloc_re( char** x, size_t m, size_t n)
      7 {
      8   char *y;
      9  
     10   y = alloc(n);
     11   if (!y) return 0;
     12   byte_copy(y,m,*x);
     13   alloc_free(*x);
     14   *x = y;
     15   return 1;
     16 }