1 9df487d7 2003-11-23 devnull #include <u.h>
2 9df487d7 2003-11-23 devnull #include <libc.h>
3 9df487d7 2003-11-23 devnull #include <bin.h>
4 9df487d7 2003-11-23 devnull #include <httpd.h>
7 9df487d7 2003-11-23 devnull * memory allocators:
8 9df487d7 2003-11-23 devnull * h routines call canalloc; they should be used by everything else
9 9df487d7 2003-11-23 devnull * note this memory is wiped out at the start of each new request
10 9df487d7 2003-11-23 devnull * note: these routines probably shouldn't fatal.
13 9df487d7 2003-11-23 devnull hstrdup(HConnect *c, char *s)
18 9df487d7 2003-11-23 devnull n = strlen(s) + 1;
19 9df487d7 2003-11-23 devnull t = binalloc(&c->bin, n, 0);
20 9df487d7 2003-11-23 devnull if(t == nil)
21 9df487d7 2003-11-23 devnull sysfatal("out of memory");
22 9df487d7 2003-11-23 devnull memmove(t, s, n);
23 9df487d7 2003-11-23 devnull return t;
27 9df487d7 2003-11-23 devnull halloc(HConnect *c, ulong n)
31 9df487d7 2003-11-23 devnull p = binalloc(&c->bin, n, 1);
32 9df487d7 2003-11-23 devnull if(p == nil)
33 9df487d7 2003-11-23 devnull sysfatal("out of memory");
34 9df487d7 2003-11-23 devnull return p;