X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Frequestq.c;h=9af3fe1018986af6aeaa04a9003aaa1b27a592d7;hp=d774b9ad8e9ca239299123e79f1db5043262a3b9;hb=a6b61b9f8b6576e8159a4e7e6aee88bba7e5d07d;hpb=4c176312acdc3444c9afc820f76a393e64668e52 diff --git a/src/requestq.c b/src/requestq.c index d774b9a..9af3fe1 100644 --- a/src/requestq.c +++ b/src/requestq.c @@ -1,8 +1,6 @@ -/* - * Copyright (C) 1995-2005, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) Index Data * See the file LICENSE for details. - * - * $Id: requestq.c,v 1.3 2005-01-15 19:47:14 adam Exp $ */ /** * \file requestq.c @@ -11,6 +9,9 @@ * We also use the request-freelist to store encoding buffers, rather than * freeing and xmalloc'ing them on each cycle. */ +#if HAVE_CONFIG_H +#include +#endif #include @@ -20,9 +21,9 @@ void request_enq(request_q *q, request *r) { if (q->tail) - q->tail->next = r; + q->tail->next = r; else - q->head = r; + q->head = r; q->tail = r; q->num++; } @@ -37,10 +38,10 @@ request *request_deq(request_q *q) request *r = q->head; if (!r) - return 0; + return 0; q->head = q->head->next; if (!q->head) - q->tail = 0; + q->tail = 0; q->num--; return r; } @@ -56,7 +57,7 @@ void request_delq(request_q *q) request *r1, *r = q->list; while (r) { - xfree (r->response); + xfree (r->response); r1 = r; r = r->next; xfree (r1); @@ -68,17 +69,15 @@ request *request_get(request_q *q) request *r = q->list; if (r) - q->list = r->next; + q->list = r->next; else { - if (!(r = (request *)xmalloc(sizeof(*r)))) - abort(); - r->response = 0; - r->size_response = 0; + if (!(r = (request *)xmalloc(sizeof(*r)))) + abort(); + r->response = 0; + r->size_response = 0; } r->q = q; - r->len_refid = 0; - r->refid = 0; r->gdu_request = 0; r->apdu_request = 0; r->request_mem = 0; @@ -92,7 +91,18 @@ request *request_get(request_q *q) void request_release(request *r) { request_q *q = r->q; + if (r->request_mem) + nmem_destroy(r->request_mem); r->next = q->list; q->list = r; } +/* + * Local variables: + * c-basic-offset: 4 + * c-file-style: "Stroustrup" + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +