]> git.ozlabs.org Git - ccan/blob - ccan/bytestring/_info
32de954fc59561ac36aaa73499ce251642480fdb
[ccan] / ccan / bytestring / _info
1 #include <stdio.h>
2 #include <string.h>
3 #include "config.h"
4
5 /**
6  * bytestring - simple bytestring handling
7  *
8  * This code handles manipulation of "bytestrings" represented as a
9  * structure containing a pointer and length.  Bytestrings are not
10  * NUL-terminated, and may include internal \0 characters.  The main
11  * use case is for referencing sub-sections of a large data buffer
12  * without the inconvenience of manually passing (and returning) both
13  * pointer and length all the time.
14  *
15  * Because of this use case, the bytestrings are treated as having
16  * immutable contents (we use a const char pointer).  The caller code
17  * is responsible for ensuring that the lifetime of the data
18  * referenced by the bytestrings is long enough not to leave
19  * bytestring structures with a dangling pointer.
20  *
21  * Example:
22  *      const char buf[] = "ABCDEFGH";
23  *      struct bytestring abcd = BYTESTRING("ABCD");
24  *
25  *      assert(bytestring_eq(bytestring(buf, 4), abcd));
26  *
27  * License: LGPL (v2.1 or any later version)
28  * Author: David Gibson <david@gibson.dropbear.id.au>
29  */
30 int main(int argc, char *argv[])
31 {
32         /* Expect exactly one argument */
33         if (argc != 2)
34                 return 1;
35
36         if (strcmp(argv[1], "depends") == 0) {
37                 printf("ccan/array_size\n");
38                 return 0;
39         }
40
41         return 1;
42 }