X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fstr%2F_info;h=b579525faac18e1fa52096b2e9b6eff34a70b404;hb=e0663bef2ec73ed33b22e5a029284296495aab87;hp=081e862d6d69fd7109c1f45ca4733923f5d91a7e;hpb=570c9c555f076e74f46141bb42b5d1d7ac89f632;p=ccan diff --git a/ccan/str/_info b/ccan/str/_info index 081e862d..b579525f 100644 --- a/ccan/str/_info +++ b/ccan/str/_info @@ -1,6 +1,6 @@ +#include "config.h" #include #include -#include "config.h" /** * str - string helper routines @@ -8,22 +8,35 @@ * 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 * #include * * int main(int argc, char *argv[]) * { - * if (argv[1] && streq(argv[1], "--verbose")) + * if (argc > 1 && streq(argv[1], "--verbose")) * printf("verbose set\n"); - * if (argv[1] && strstarts(argv[1], "--")) + * if (argc > 1 && strstarts(argv[1], "--")) * printf("Some option set\n"); - * if (argv[1] && strends(argv[1], "cow-powers")) + * if (argc > 1 && strends(argv[1], "cow-powers")) * printf("Magic option set\n"); * return 0; * } * - * Licence: LGPL (2 or any later version) + * License: CC0 (Public domain) + * Author: Rusty Russell */ int main(int argc, char *argv[]) { @@ -31,6 +44,7 @@ int main(int argc, char *argv[]) return 1; if (strcmp(argv[1], "depends") == 0) { + printf("ccan/build_assert\n"); return 0; }