X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fdatabase.c;h=ab425c73c6465df964351e3abadc28040c6a8a79;hb=1498181abb059f78afc0ad4f7bcea0b5c13c7964;hp=6f1599a8f404fdd1d53ae5e9a662b797d58c5fef;hpb=ebf24e785974c368809d73394a24eb80506598fd;p=pazpar2-moved-to-github.git diff --git a/src/database.c b/src/database.c index 6f1599a..ab425c7 100644 --- a/src/database.c +++ b/src/database.c @@ -27,9 +27,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include #include +#include -#include "pazpar2.h" +#include "ppmutex.h" +#include "session.h" #include "host.h" +#include "pazpar2_config.h" #include "settings.h" #include "http.h" #include "zeerex.h" @@ -107,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; } @@ -408,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