sh_off_t size;
obuck_fd = open(obuck_name, (writeable ? O_RDWR | O_CREAT : O_RDONLY), 0666);
- obuck_fb = b = xmalloc(sizeof(struct fastbuf) + buflen + OBUCK_ALIGN + 4);
- bzero(b, sizeof(struct fastbuf));
+ obuck_fb = b = xmalloc_zero(sizeof(struct fastbuf) + buflen + OBUCK_ALIGN + 4);
b->buflen = buflen;
b->buffer = (char *)(b+1);
b->bptr = b->bstop = b->buffer;
struct sdbm_root root, *r;
uns cache_size = o->cache_size ? o->cache_size : 16;
- d = xmalloc(sizeof(struct sdbm));
- bzero(d, sizeof(*d));
+ d = xmalloc_zero(sizeof(struct sdbm));
d->flags = o->flags;
d->fd = sh_open(o->name, ((d->flags & SDBM_WRITE) ? O_RDWR : O_RDONLY), 0666);
if (d->fd >= 0) /* Already exists, let's check it */
struct page_cache *
pgc_open(uns page_size, uns max_pages)
{
- struct page_cache *c = xmalloc(sizeof(struct page_cache));
+ struct page_cache *c = xmalloc_zero(sizeof(struct page_cache));
uns i;
- bzero(c, sizeof(*c));
init_list(&c->free_pages);
init_list(&c->locked_pages);
init_list(&c->dirty_pages);
regex *
rx_compile(byte *p)
{
- regex *r = xmalloc(sizeof(regex));
+ regex *r = xmalloc_zero(sizeof(regex));
const char *msg;
- bzero(r, sizeof(struct regex));
r->buf.buffer = xmalloc(INITIAL_MEM);
r->buf.allocated = INITIAL_MEM;
msg = re_compile_pattern(p, strlen(p), &r->buf);
if (strlen(p) >= MAX_STATES) /* Too long */
return NULL;
- w = mp_alloc(pool, sizeof(*w));
- bzero(w, sizeof(*w));
+ w = mp_alloc_zero(pool, sizeof(*w));
w->pool = pool;
for(i=1; *p; p++)
{