]> git.ozlabs.org Git - ccan/blob - ccan/darray/_info
crypto/shachain/tools: update to new rbuf API.
[ccan] / ccan / darray / _info
1 #include "config.h"
2 #include <stdio.h>
3 #include <string.h>
4
5 #include "ccan/darray/darray.h"
6
7 /**
8  * darray - Generic resizable arrays
9  *
10  * darray is a set of macros for managing dynamically-allocated arrays.
11  * It removes the tedium of managing realloc'd arrays with pointer, size, and
12  * allocated size.
13  *
14  * Example:
15  * #include <ccan/darray/darray.h>
16  * #include <stdio.h>
17  * 
18  * int main(void) {
19  *      darray(int) numbers = darray_new();
20  *      char buffer[32];
21  *      
22  *      for (;;) {
23  *              int *i;
24  *              darray_foreach(i, numbers)
25  *                      printf("%d ", *i);
26  *              if (darray_size(numbers) > 0)
27  *                      puts("");
28  *              
29  *              printf("darray> ");
30  *              fgets(buffer, sizeof(buffer), stdin);
31  *              if (*buffer == '\0' || *buffer == '\n')
32  *                      break;
33  *              
34  *              darray_append(numbers, atoi(buffer));
35  *      }
36  *      
37  *      darray_free(numbers);
38  *      
39  *      return 0;
40  * }
41  *
42  * Author: Joey Adams <joeyadams3.14159@gmail.com>
43  * License: MIT
44  * Version: 0.2
45  */
46 int main(int argc, char *argv[])
47 {
48         if (argc != 2)
49                 return 1;
50
51         if (strcmp(argv[1], "depends") == 0) {
52                 /* Nothing. */
53                 return 0;
54         }
55
56         return 1;
57 }