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