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