X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=src%2Fdatabase.c;h=ab425c73c6465df964351e3abadc28040c6a8a79;hb=2cfd7518dc740c913602ea8306ec8f27509b00d4;hp=8ffbee2328a71984fc8b93ab95f67a7c65d65296;hpb=ca9817524ebe069581ad72f6bca0e9775d61e30c;p=pazpar2-moved-to-github.git diff --git a/src/database.c b/src/database.c index 8ffbee2..ab425c7 100644 --- a/src/database.c +++ b/src/database.c @@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include +#include "ppmutex.h" #include "session.h" #include "host.h" #include "pazpar2_config.h" @@ -109,7 +110,7 @@ static struct host *create_host(const char *hostport, iochan_man_t iochan_man) xfree(host); return 0; } - yaz_mutex_create(&host->mutex); + pazpar2_mutex_create(&host->mutex, "host"); return host; } @@ -410,10 +411,29 @@ database_hosts_t database_hosts_create(void) database_hosts_t p = xmalloc(sizeof(*p)); p->hosts = 0; p->mutex = 0; - yaz_mutex_create(&p->mutex); + pazpar2_mutex_create(&p->mutex, "database"); return p; } +void database_hosts_destroy(database_hosts_t *pp) +{ + if (*pp) + { + struct host *p = (*pp)->hosts; + while (p) + { + struct host *p_next = p->next; + yaz_mutex_destroy(&p->mutex); + xfree(p->ipport); + xfree(p->hostport); + xfree(p); + p = p_next; + } + yaz_mutex_destroy(&(*pp)->mutex); + xfree(*pp); + } +} + /* * Local variables: * c-basic-offset: 4