No need to carry unused documentation how to use the API.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
+++ /dev/null
-#include "config.h"
-#include <stdio.h>
-#include <string.h>
-
-/**
- * build_assert - routines for build-time assertions
- *
- * This code provides routines which will cause compilation to fail should some
- * assertion be untrue: such failures are preferable to run-time assertions,
- * but much more limited since they can only depends on compile-time constants.
- *
- * These assertions are most useful when two parts of the code must be kept in
- * sync: it is better to avoid such cases if possible, but seconds best is to
- * detect invalid changes at build time.
- *
- * For example, a tricky piece of code might rely on a certain element being at
- * the start of the structure. To ensure that future changes don't break it,
- * you would catch such changes in your code like so:
- *
- * Example:
- * #include <stddef.h>
- * #include <ccan/build_assert/build_assert.h>
- *
- * struct foo {
- * char string[5];
- * int x;
- * };
- *
- * static char *foo_string(struct foo *foo)
- * {
- * // This trick requires that the string be first in the structure
- * BUILD_ASSERT(offsetof(struct foo, string) == 0);
- * return (char *)foo;
- * }
- *
- * License: CC0 (Public domain)
- * Author: Rusty Russell <rusty@rustcorp.com.au>
- */
-int main(int argc, char *argv[])
-{
- if (argc != 2)
- return 1;
-
- if (strcmp(argv[1], "depends") == 0)
- /* Nothing. */
- return 0;
-
- return 1;
-}
+++ /dev/null
-#include "config.h"
-#include <stdio.h>
-#include <string.h>
-
-/**
- * check_type - routines for compile time type checking
- *
- * C has fairly weak typing: ints get automatically converted to longs, signed
- * to unsigned, etc. There are some cases where this is best avoided, and
- * these macros provide methods for evoking warnings (or build errors) when
- * a precise type isn't used.
- *
- * On compilers which don't support typeof() these routines are less effective,
- * since they have to use sizeof() which can only distiguish between types of
- * different size.
- *
- * License: CC0 (Public domain)
- * Author: Rusty Russell <rusty@rustcorp.com.au>
- */
-int main(int argc, char *argv[])
-{
- if (argc != 2)
- return 1;
-
- if (strcmp(argv[1], "depends") == 0) {
-#if !HAVE_TYPEOF
- printf("ccan/build_assert\n");
-#endif
- return 0;
- }
-
- return 1;
-}
+++ /dev/null
-#include "config.h"
-#include <stdio.h>
-#include <string.h>
-
-/**
- * container_of - routine for upcasting
- *
- * It is often convenient to create code where the caller registers a pointer
- * to a generic structure and a callback. The callback might know that the
- * pointer points to within a larger structure, and container_of gives a
- * convenient and fairly type-safe way of returning to the enclosing structure.
- *
- * This idiom is an alternative to providing a void * pointer for every
- * callback.
- *
- * Example:
- * #include <stdio.h>
- * #include <ccan/container_of/container_of.h>
- *
- * struct timer {
- * void *members;
- * };
- *
- * struct info {
- * int my_stuff;
- * struct timer timer;
- * };
- *
- * static void my_timer_callback(struct timer *timer)
- * {
- * struct info *info = container_of(timer, struct info, timer);
- * printf("my_stuff is %u\n", info->my_stuff);
- * }
- *
- * static void register_timer(struct timer *timer)
- * {
- * (void)timer;
- * (void)my_timer_callback;
- * //...
- * }
- *
- * int main(void)
- * {
- * struct info info = { .my_stuff = 1 };
- *
- * register_timer(&info.timer);
- * // ...
- * return 0;
- * }
- *
- * License: CC0 (Public domain)
- * Author: Rusty Russell <rusty@rustcorp.com.au>
- */
-int main(int argc, char *argv[])
-{
- if (argc != 2)
- return 1;
-
- if (strcmp(argv[1], "depends") == 0) {
- printf("ccan/check_type\n");
- return 0;
- }
-
- return 1;
-}
+++ /dev/null
-#include "config.h"
-#include <stdio.h>
-#include <string.h>
-
-/**
- * endian - endian conversion macros for simple types
- *
- * Portable protocols (such as on-disk formats, or network protocols)
- * are often defined to be a particular endian: little-endian (least
- * significant bytes first) or big-endian (most significant bytes
- * first).
- *
- * Similarly, some CPUs lay out values in memory in little-endian
- * order (most commonly, Intel's 8086 and derivatives), or big-endian
- * order (almost everyone else).
- *
- * This module provides conversion routines, inspired by the linux kernel.
- * It also provides leint32_t, beint32_t etc typedefs, which are annotated for
- * the sparse checker.
- *
- * Example:
- * #include <stdio.h>
- * #include <err.h>
- * #include <ccan/endian/endian.h>
- *
- * //
- * int main(int argc, char *argv[])
- * {
- * uint32_t value;
- *
- * if (argc != 2)
- * errx(1, "Usage: %s <value>", argv[0]);
- *
- * value = atoi(argv[1]);
- * printf("native: %08x\n", value);
- * printf("little-endian: %08x\n", cpu_to_le32(value));
- * printf("big-endian: %08x\n", cpu_to_be32(value));
- * printf("byte-reversed: %08x\n", bswap_32(value));
- * exit(0);
- * }
- *
- * License: License: CC0 (Public domain)
- * Author: Rusty Russell <rusty@rustcorp.com.au>
- */
-int main(int argc, char *argv[])
-{
- if (argc != 2)
- return 1;
-
- if (strcmp(argv[1], "depends") == 0)
- /* Nothing */
- return 0;
-
- return 1;
-}
+++ /dev/null
-#include "config.h"
-#include <stdio.h>
-#include <string.h>
-
-/**
- * list - double linked list routines
- *
- * The list header contains routines for manipulating double linked lists.
- * It defines two types: struct list_head used for anchoring lists, and
- * struct list_node which is usually embedded in the structure which is placed
- * in the list.
- *
- * Example:
- * #include <err.h>
- * #include <stdio.h>
- * #include <stdlib.h>
- * #include <ccan/list/list.h>
- *
- * struct parent {
- * const char *name;
- * struct list_head children;
- * unsigned int num_children;
- * };
- *
- * struct child {
- * const char *name;
- * struct list_node list;
- * };
- *
- * int main(int argc, char *argv[])
- * {
- * struct parent p;
- * struct child *c;
- * int i;
- *
- * if (argc < 2)
- * errx(1, "Usage: %s parent children...", argv[0]);
- *
- * p.name = argv[1];
- * list_head_init(&p.children);
- * p.num_children = 0;
- * for (i = 2; i < argc; i++) {
- * c = malloc(sizeof(*c));
- * c->name = argv[i];
- * list_add(&p.children, &c->list);
- * p.num_children++;
- * }
- *
- * printf("%s has %u children:", p.name, p.num_children);
- * list_for_each(&p.children, c, list)
- * printf("%s ", c->name);
- * printf("\n");
- * return 0;
- * }
- *
- * License: BSD-MIT
- * Author: Rusty Russell <rusty@rustcorp.com.au>
- */
-int main(int argc, char *argv[])
-{
- if (argc != 2)
- return 1;
-
- if (strcmp(argv[1], "depends") == 0) {
- printf("ccan/str\n");
- printf("ccan/container_of\n");
- printf("ccan/check_type\n");
- return 0;
- }
-
- return 1;
-}
+++ /dev/null
-#include "config.h"
-#include <stdio.h>
-#include <string.h>
-
-/**
- * str - string helper routines
- *
- * This is a grab bag of functions for string operations, designed to enhance
- * the standard string.h.
- *
- * Note that if you define CCAN_STR_DEBUG, you will get extra compile
- * checks on common misuses of the following functions (they will now
- * be out-of-line, so there is a runtime penalty!).
- *
- * strstr, strchr, strrchr:
- * Return const char * if first argument is const (gcc only).
- *
- * isalnum, isalpha, isascii, isblank, iscntrl, isdigit, isgraph,
- * islower, isprint, ispunct, isspace, isupper, isxdigit:
- * Static and runtime check that input is EOF or an *unsigned*
- * char, as per C standard (really!).
- *
- * Example:
- * #include <stdio.h>
- * #include <ccan/str/str.h>
- *
- * int main(int argc, char *argv[])
- * {
- * if (argc > 1 && streq(argv[1], "--verbose"))
- * printf("verbose set\n");
- * if (argc > 1 && strstarts(argv[1], "--"))
- * printf("Some option set\n");
- * if (argc > 1 && strends(argv[1], "cow-powers"))
- * printf("Magic option set\n");
- * return 0;
- * }
- *
- * License: CC0 (Public domain)
- * Author: Rusty Russell <rusty@rustcorp.com.au>
- */
-int main(int argc, char *argv[])
-{
- if (argc != 2)
- return 1;
-
- if (strcmp(argv[1], "depends") == 0) {
- printf("ccan/build_assert\n");
- return 0;
- }
-
- return 1;
-}