X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fdb.c;h=de48171f58ba6d6bca523c5c3319789657880885;hb=9a707ec946b4c159e9505c855dff193eef0176bb;hp=fd8a8c0e25b4808f2162173c817531fb43c24e3f;hpb=31b663d9a5230eb85d3147141a06329a1a1a78a7;p=libucw.git diff --git a/lib/db.c b/lib/db.c index fd8a8c0e..de48171f 100644 --- a/lib/db.c +++ b/lib/db.c @@ -1,7 +1,7 @@ /* * Sherlock Library -- Fast Database Management Routines * - * (c) 1999--2000 Martin Mares + * (c) 1999--2000 Martin Mares */ /* @@ -19,18 +19,18 @@ * and we assume it's sorted. */ +#include "lib/lib.h" +#include "lib/lfs.h" +#include "lib/pagecache.h" +#include "lib/db.h" +#include "lib/db_internal.h" + #include #include #include #include #include -#include "lib.h" -#include "lfs.h" -#include "pagecache.h" -#include "db.h" -#include "db_internal.h" - struct sdbm * sdbm_open(struct sdbm_options *o) { @@ -38,8 +38,7 @@ sdbm_open(struct sdbm_options *o) 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 */ @@ -102,7 +101,7 @@ sdbm_close(struct sdbm *d) pgc_close(d->cache); if (d->fd >= 0) close(d->fd); - free(d); + xfree(d); } static uns