Clean up #include mess by creating internal.h.
[gsasl.git] / lib / done.c
blob992f32a73807ef40039c39ea6a045e10ff6f88b7
1 /* done.c exit point for libgsasl
2 * Copyright (C) 2002 Simon Josefsson
4 * This file is part of libgsasl.
6 * Libgsasl is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * Libgsasl is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with libgsasl; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "internal.h"
24 /**
25 * gsasl_done:
26 * @ctx: libgsasl handle.
28 * This function destroys a libgsasl handle. The handle must not be
29 * used with other libgsasl functions after this call.
30 **/
31 void
32 gsasl_done (Gsasl_ctx * ctx)
34 int i;
36 if (ctx == NULL)
37 return;
39 for (i = 0; i < ctx->n_client_mechs; i++)
40 ctx->client_mechs[i].client.done (ctx);
42 for (i = 0; i < ctx->n_server_mechs; i++)
43 ctx->server_mechs[i].server.done (ctx);
45 if (ctx->client_mechs)
46 free (ctx->client_mechs);
48 if (ctx->server_mechs)
49 free (ctx->server_mechs);
51 free (ctx);
53 return;