Line data Source code
1 : /***************************************************************************//**
2 :
3 : @file iter.c
4 :
5 : @author Stephen Brennan
6 :
7 : @date Created Monday, 4 August 2014
8 :
9 : @brief Functions that act on iterators, "libstephen/list.h".
10 :
11 : @copyright Copyright (c) 2013-2016, Stephen Brennan. Released under the
12 : Revised BSD License. See the LICENSE.txt file for details.
13 :
14 : *******************************************************************************/
15 :
16 : #include <stdio.h>
17 : #include <assert.h>
18 :
19 : #include "libstephen/base.h"
20 : #include "libstephen/list.h"
21 :
22 0 : void iter_print(smb_iter it, FILE *f, DATA_PRINTER printer)
23 : {
24 : DATA d;
25 : smb_status status;
26 0 : fprintf(f, "smb_iter {\n");
27 0 : while (it.has_next(&it)) {
28 0 : d = it.next(&it, &status);
29 : // used has_next
30 0 : assert(status == SMB_SUCCESS);
31 0 : printer(f, d);
32 0 : fprintf(f, ",\n");
33 : }
34 0 : it.destroy(&it);
35 0 : fprintf(f, "}\n");
36 0 : }
|