├── .gitignore ├── .travis.yml ├── Makefile ├── Makefile-web ├── PATCHES ├── README ├── appveyor.yml ├── ccan ├── .gitignore ├── a_star │ ├── LICENSE │ ├── _info │ ├── a_star.c │ ├── a_star.h │ └── test │ │ └── run.c ├── aga │ ├── LICENSE │ ├── _info │ ├── aga.c │ ├── aga.h │ ├── bellman_ford.c │ ├── bfs.c │ ├── dfs.c │ ├── dijkstra.c │ ├── private.h │ └── test │ │ ├── api-adjacency.c │ │ ├── api-bellman_ford.c │ │ ├── api-bfs.c │ │ ├── api-concurrent.c │ │ ├── api-dfs.c │ │ ├── api-dijkstra.c │ │ ├── api-lazytrie-words.txt │ │ ├── api-lazytrie.c │ │ ├── chain.c │ │ ├── compile_fail-mismatch1.c │ │ ├── compile_fail-mismatch2.c │ │ ├── compile_fail-mismatch3.c │ │ ├── compile_fail-mismatch4.c │ │ ├── compile_ok.c │ │ ├── error-graph.c │ │ ├── full.c │ │ ├── grid.c │ │ ├── negacycle.c │ │ ├── parallel.c │ │ ├── shortcut1.c │ │ ├── shortcut2.c │ │ ├── simple-graph.c │ │ ├── simple-graph.h │ │ ├── traversal1.c │ │ └── trivial.c ├── agar │ ├── LICENSE │ ├── _info │ ├── agar.c │ ├── agar.h │ └── test │ │ ├── api-adjacency.c │ │ ├── api-bellman_ford.c │ │ ├── api-bfs.c │ │ ├── api-dfs.c │ │ ├── api-dijkstra.c │ │ ├── chain.c │ │ ├── error-graph.c │ │ ├── full.c │ │ ├── grid.c │ │ ├── negacycle.c │ │ ├── parallel.c │ │ ├── shortcut1.c │ │ ├── shortcut2.c │ │ ├── simple-graphr.h │ │ ├── traversal1.c │ │ └── trivial.c ├── alignof │ ├── LICENSE │ ├── _info │ ├── alignof.h │ └── test │ │ └── run.c ├── altstack │ ├── LICENSE │ ├── _info │ ├── altstack.c │ ├── altstack.h │ └── test │ │ └── run.c ├── antithread │ ├── LICENSE │ ├── _info │ ├── alloc │ │ ├── LICENSE │ │ ├── _info │ │ ├── alloc.c │ │ ├── alloc.h │ │ ├── bitops.c │ │ ├── bitops.h │ │ ├── test │ │ │ ├── run-corrupt.c │ │ │ ├── run-testsize.c │ │ │ ├── run-tiny-encode.c │ │ │ └── run.c │ │ ├── tiny.c │ │ └── tiny.h │ ├── antithread.c │ ├── antithread.h │ ├── examples │ │ ├── Makefile │ │ ├── arabella.c │ │ ├── arabella.jpg │ │ ├── dns_lookup.c │ │ └── md5_finder.h │ └── test │ │ ├── run-lock.c │ │ ├── run-simple.c │ │ ├── run-spawn-NULL.c │ │ ├── run-spawn.c │ │ ├── run-tell.c │ │ └── run-tell_parent.c ├── argcheck │ ├── LICENSE │ ├── _info │ ├── argcheck.h │ └── test │ │ └── run.c ├── array_size │ ├── LICENSE │ ├── _info │ ├── array_size.h │ └── test │ │ ├── compile_fail-function-param.c │ │ ├── compile_fail.c │ │ └── run.c ├── asearch │ ├── LICENSE │ ├── _info │ ├── asearch.c │ ├── asearch.h │ └── test │ │ ├── compile_fail-return-value-const.c │ │ ├── compile_fail-return-value.c │ │ ├── run-strings.c │ │ └── run.c ├── asort │ ├── LICENSE │ ├── _info │ ├── asort.c │ ├── asort.h │ └── test │ │ ├── compile_fail-context-type.c │ │ └── run.c ├── asprintf │ ├── LICENSE │ ├── _info │ ├── asprintf.c │ ├── asprintf.h │ └── test │ │ └── run.c ├── autodata │ ├── LICENSE │ ├── _info │ ├── autodata.c │ ├── autodata.h │ └── test │ │ ├── helper.c │ │ ├── run-fools.c │ │ └── run.c ├── avl │ ├── LICENSE │ ├── _info │ ├── avl.c │ ├── avl.h │ └── test │ │ └── run.c ├── base64 │ ├── LICENSE │ ├── _info │ ├── base64.c │ ├── base64.h │ └── test │ │ ├── moretap.h │ │ └── run.c ├── bdelta │ ├── LICENSE │ ├── _info │ ├── bdelta.c │ ├── bdelta.h │ └── test │ │ ├── common.h │ │ ├── run-medium.c │ │ ├── run-myers.c │ │ └── run-trivial.c ├── bitmap │ ├── LICENSE │ ├── _info │ ├── bitmap.c │ ├── bitmap.h │ └── test │ │ ├── run-alloc.c │ │ ├── run-ffs.c │ │ ├── run-ranges.c │ │ └── run.c ├── bitops │ ├── LICENSE │ ├── _info │ ├── bitops.c │ ├── bitops.h │ └── test │ │ ├── run-selftest.c │ │ └── run.c ├── block_pool │ ├── LICENSE │ ├── _info │ ├── block_pool.c │ ├── block_pool.h │ └── test │ │ └── run.c ├── breakpoint │ ├── LICENSE │ ├── _info │ ├── breakpoint.c │ ├── breakpoint.h │ └── test │ │ └── run.c ├── btree │ ├── LICENSE │ ├── _info │ ├── btree.c │ ├── btree.h │ └── test │ │ ├── run-benchmark.c │ │ ├── run-random-access.c │ │ ├── run-search-implement.c │ │ └── run-trivial.c ├── build_assert │ ├── LICENSE │ ├── _info │ ├── build_assert.h │ └── test │ │ ├── compile_fail-expr.c │ │ ├── compile_fail.c │ │ ├── compile_ok.c │ │ └── run-BUILD_ASSERT_OR_ZERO.c ├── bytestring │ ├── LICENSE │ ├── _info │ ├── bytestring.c │ ├── bytestring.h │ └── test │ │ ├── compile_fail-BYTESTRING-2.c │ │ ├── compile_fail-BYTESTRING.c │ │ └── run.c ├── cast │ ├── LICENSE │ ├── _info │ ├── cast.h │ └── test │ │ ├── compile_fail-cast_const.c │ │ ├── compile_fail-cast_const2.c │ │ ├── compile_fail-cast_const3.c │ │ ├── compile_fail-cast_signed-const.c │ │ ├── compile_fail-cast_signed-sizesame.c │ │ ├── compile_fail-cast_signed.c │ │ ├── compile_fail-cast_static-2.c │ │ ├── compile_fail-cast_static-3.c │ │ ├── compile_fail-cast_static.c │ │ ├── compile_ok-cast_void.c │ │ └── compile_ok-static.c ├── ccan_tokenizer │ ├── LICENSE │ ├── _info │ ├── ccan_tokenizer.c │ ├── ccan_tokenizer.h │ ├── charflag.c │ ├── charflag.h │ ├── dict.c │ ├── dict.h │ ├── documentation │ ├── number_constant.guppy │ ├── queue.c │ ├── queue.h │ ├── read_cnumber.c │ ├── read_cstring.c │ ├── scripts │ │ └── message_dump_to_messages.sh │ ├── test │ │ ├── run-simple-token.c │ │ └── run.c │ └── todo ├── cdump │ ├── LICENSE │ ├── _info │ ├── cdump.c │ ├── cdump.h │ ├── test │ │ ├── run-CDUMP.c │ │ ├── run-arraysize.c │ │ ├── run-attributes.c │ │ ├── run-enum-comma.c │ │ ├── run-forward-decl.c │ │ ├── run-multiline.c │ │ ├── run-qualifiers.c │ │ └── run.c │ └── tools │ │ ├── .gitignore │ │ ├── Makefile │ │ └── cdump-enumstr.c ├── charset │ ├── LICENSE │ ├── _info │ ├── charset.c │ ├── charset.h │ └── test │ │ ├── common.h │ │ ├── run-surrogate-pair.c │ │ ├── run-utf8-read-write.c │ │ └── run-utf8_validate.c ├── check_type │ ├── LICENSE │ ├── _info │ ├── check_type.h │ └── test │ │ ├── compile_fail-check_type.c │ │ ├── compile_fail-check_type_unsigned.c │ │ ├── compile_fail-check_types_match.c │ │ └── run.c ├── ciniparser │ ├── LICENSE │ ├── _info │ ├── ciniparser.c │ ├── ciniparser.h │ ├── dictionary.c │ ├── dictionary.h │ └── test │ │ ├── run-dictionary.c │ │ ├── run.c │ │ └── test.ini ├── closefrom │ ├── LICENSE │ ├── _info │ ├── closefrom.c │ ├── closefrom.h │ └── test │ │ └── run.c ├── compiler │ ├── LICENSE │ ├── _info │ ├── compiler.h │ └── test │ │ ├── compile_fail-printf.c │ │ └── run-is_compile_constant.c ├── container_of │ ├── LICENSE │ ├── _info │ ├── container_of.h │ └── test │ │ ├── compile_fail-bad-type.c │ │ ├── compile_fail-types.c │ │ ├── compile_fail-var-types.c │ │ └── run.c ├── coroutine │ ├── LICENSE │ ├── _info │ ├── coroutine.c │ ├── coroutine.h │ └── test │ │ ├── api-1.c │ │ ├── api-2.c │ │ └── api-3.c ├── cppmagic │ ├── LICENSE │ ├── _info │ ├── cppmagic.h │ └── test │ │ └── run.c ├── cpuid │ ├── LICENSE │ ├── _info │ ├── cpuid.c │ ├── cpuid.h │ └── test │ │ └── run.c ├── crc │ ├── LICENSE │ ├── _info │ ├── crc.c │ ├── crc.h │ └── test │ │ └── api.c ├── crc32c │ ├── LICENSE │ ├── _info │ ├── benchmark │ │ ├── Makefile │ │ └── bench.c │ ├── crc32c.c │ ├── crc32c.h │ └── test │ │ ├── api-crc32c.c │ │ └── run-crc32c.c ├── crcsync │ ├── LICENSE │ ├── _info │ ├── crcsync.c │ ├── crcsync.h │ └── test │ │ ├── run-crash.c │ │ ├── run-crc.c │ │ ├── run-roll.c │ │ └── run.c ├── crypto │ ├── hkdf_sha256 │ │ ├── LICENSE │ │ ├── _info │ │ ├── hkdf_sha256.c │ │ ├── hkdf_sha256.h │ │ └── test │ │ │ └── api-rfc5869.c │ ├── hmac_sha256 │ │ ├── LICENSE │ │ ├── _info │ │ ├── hmac_sha256.c │ │ ├── hmac_sha256.h │ │ └── test │ │ │ └── api-rfc4231.c │ ├── ripemd160 │ │ ├── LICENSE │ │ ├── _info │ │ ├── ripemd160.c │ │ ├── ripemd160.h │ │ └── test │ │ │ ├── run-lotsa-data.c │ │ │ ├── run-test-vectors.c │ │ │ └── run-types.c │ ├── sha256 │ │ ├── LICENSE │ │ ├── _info │ │ ├── benchmarks │ │ │ ├── Makefile │ │ │ ├── double-sha-bench.c │ │ │ ├── open_software_license.txt │ │ │ ├── sha256_avx1.asm │ │ │ ├── sha256_avx2_rorx2.asm │ │ │ ├── sha256_avx2_rorx8.asm │ │ │ └── sha256_sse4.asm │ │ ├── sha256.c │ │ ├── sha256.h │ │ └── test │ │ │ ├── run-33-bit-test.c │ │ │ ├── run-lotsa-data.c │ │ │ ├── run-test-vectors.c │ │ │ └── run-types.c │ ├── sha512 │ │ ├── LICENSE │ │ ├── _info │ │ ├── sha512.c │ │ ├── sha512.h │ │ └── test │ │ │ ├── run-lotsa-data.c │ │ │ └── run-test-vectors.c │ ├── shachain │ │ ├── LICENSE │ │ ├── _info │ │ ├── design.txt │ │ ├── shachain.c │ │ ├── shachain.h │ │ ├── test │ │ │ ├── run-8bit.c │ │ │ ├── run-badhash.c │ │ │ ├── run-can_derive.c │ │ │ └── run.c │ │ └── tools │ │ │ ├── .gitignore │ │ │ ├── Makefile │ │ │ └── shachain48.c │ ├── siphash24 │ │ ├── LICENSE │ │ ├── _info │ │ ├── siphash24.c │ │ ├── siphash24.h │ │ └── test │ │ │ └── run.c │ └── xtea │ │ ├── LICENSE │ │ ├── _info │ │ ├── test │ │ └── run.c │ │ ├── xtea.c │ │ └── xtea.h ├── daemon_with_notify │ ├── LICENSE │ ├── _info │ ├── daemon_with_notify.c │ ├── daemon_with_notify.h │ └── test │ │ └── run.c ├── daemonize │ ├── LICENSE │ ├── _info │ ├── daemonize.c │ ├── daemonize.h │ └── test │ │ └── run.c ├── darray │ ├── LICENSE │ ├── _info │ ├── darray.h │ └── test │ │ ├── lotsOfNumbers.h │ │ ├── lotsOfStrings.h │ │ ├── run.c │ │ ├── testLits.h │ │ ├── testLits.h.template │ │ └── testLits_generate.pl ├── deque │ ├── LICENSE │ ├── _info │ ├── deque.c │ ├── deque.h │ └── test │ │ ├── api1.c │ │ ├── run2.c │ │ └── run3.c ├── dgraph │ ├── LICENSE │ ├── _info │ ├── dgraph.c │ ├── dgraph.h │ └── test │ │ ├── run-debug.c │ │ └── run.c ├── edit_distance │ ├── LICENSE │ ├── _info │ ├── edit_distance-params.h │ ├── edit_distance-private.h │ ├── edit_distance.bib │ ├── edit_distance.c │ ├── edit_distance.h │ ├── edit_distance_dl.c │ ├── edit_distance_lcs.c │ ├── edit_distance_lev.c │ ├── edit_distance_rdl.c │ └── test │ │ ├── api.c │ │ ├── run-types-short.c │ │ ├── run-types-struct.c │ │ ├── run-types-wchar.c │ │ └── run-weights.c ├── endian │ ├── LICENSE │ ├── _info │ ├── endian.h │ └── test │ │ ├── compile_ok-constant.c │ │ └── run.c ├── eratosthenes │ ├── LICENSE │ ├── _info │ ├── eratosthenes.c │ ├── eratosthenes.h │ └── test │ │ ├── run-incremental.c │ │ └── run.c ├── err │ ├── LICENSE │ ├── _info │ ├── err.c │ ├── err.h │ └── test │ │ └── run.c ├── failtest │ ├── LICENSE │ ├── _info │ ├── failtest.c │ ├── failtest.h │ ├── failtest_override.h │ ├── failtest_proto.h │ ├── failtest_undo.h │ └── test │ │ ├── run-failpath.c │ │ ├── run-history.c │ │ ├── run-locking.c │ │ ├── run-malloc.c │ │ ├── run-open.c │ │ ├── run-with-fdlimit.c │ │ └── run-write.c ├── fdpass │ ├── LICENSE │ ├── _info │ ├── fdpass.c │ ├── fdpass.h │ └── test │ │ └── run.c ├── foreach │ ├── LICENSE │ ├── _info │ ├── foreach.c │ ├── foreach.h │ └── test │ │ ├── compile_ok-const.c │ │ ├── compile_ok-nonconst.c │ │ ├── run-break.c │ │ ├── run-nested.c │ │ ├── run-not-on-stack.c │ │ ├── run-single-arg.c │ │ └── run.c ├── generator │ ├── LICENSE │ ├── _info │ ├── generator.c │ ├── generator.h │ └── test │ │ ├── api.c │ │ ├── compile_fail-1.c │ │ ├── compile_fail-2.c │ │ ├── compile_fail-3.c │ │ ├── compile_fail-4.c │ │ ├── compile_fail-5.c │ │ ├── example-gens.c │ │ └── example-gens.h ├── grab_file │ ├── LICENSE │ ├── _info │ ├── grab_file.c │ ├── grab_file.h │ └── test │ │ └── run-grab.c ├── graphql │ ├── LICENSE │ ├── _info │ ├── graphql.c │ ├── graphql.h │ └── test │ │ └── run.c ├── hash │ ├── LICENSE │ ├── _info │ ├── hash.c │ ├── hash.h │ └── test │ │ ├── api-hash_stable.c │ │ └── run.c ├── heap │ ├── LICENSE │ ├── _info │ ├── heap.c │ ├── heap.h │ └── test │ │ └── run.c ├── htable │ ├── LICENSE │ ├── _info │ ├── htable.c │ ├── htable.h │ ├── htable_type.h │ ├── test │ │ ├── run-allocator.c │ │ ├── run-clash.c │ │ ├── run-copy.c │ │ ├── run-debug.c │ │ ├── run-extra.c │ │ ├── run-size.c │ │ ├── run-type-int.c │ │ ├── run-type.c │ │ ├── run-zero-hash-first-entry.c │ │ └── run.c │ └── tools │ │ ├── Makefile │ │ ├── density.c │ │ ├── hsearchspeed.c │ │ ├── speed.c │ │ └── stringspeed.c ├── idtree │ ├── LICENSE │ ├── _info │ ├── idtree.c │ ├── idtree.h │ └── test │ │ ├── run-wrap.c │ │ └── run.c ├── ilog │ ├── LICENSE │ ├── _info │ ├── ilog.c │ ├── ilog.h │ └── test │ │ ├── run-out-of-line.c │ │ └── run.c ├── intmap │ ├── LICENSE │ ├── _info │ ├── benchmark │ │ ├── Makefile │ │ └── speed.c │ ├── intmap.c │ ├── intmap.h │ └── test │ │ ├── run-after-exhaustive.c │ │ ├── run-after-fail.c │ │ ├── run-order-smallsize.c │ │ ├── run-order.c │ │ ├── run-signed-int.c │ │ └── run.c ├── invbloom │ ├── LICENSE │ ├── _info │ ├── invbloom.c │ ├── invbloom.h │ └── test │ │ ├── run-singletoncb.c │ │ ├── run-subtract.c │ │ └── run.c ├── io │ ├── LICENSE │ ├── SCENARIOS │ ├── _info │ ├── backend.h │ ├── benchmarks │ │ ├── Makefile │ │ ├── run-different-speed.c │ │ ├── run-length-prefix.c │ │ ├── run-loop.c │ │ └── run-stream-many.c │ ├── fdpass │ │ ├── LICENSE │ │ ├── _info │ │ ├── fdpass.c │ │ ├── fdpass.h │ │ └── test │ │ │ └── run.c │ ├── io.c │ ├── io.h │ ├── io_plan.h │ ├── poll.c │ └── test │ │ ├── run-01-start-finish.c │ │ ├── run-02-read.c │ │ ├── run-03-readpartial.c │ │ ├── run-04-writepartial.c │ │ ├── run-05-write.c │ │ ├── run-06-idle.c │ │ ├── run-07-break.c │ │ ├── run-08-hangup-on-idle.c │ │ ├── run-08-read-after-hangup.c │ │ ├── run-09-connect.c │ │ ├── run-10-many.c │ │ ├── run-12-bidir.c │ │ ├── run-13-all-idle.c │ │ ├── run-14-duplex-both-read.c │ │ ├── run-15-timeout.c │ │ ├── run-16-duplex-test.c │ │ ├── run-17-homemade-io.c │ │ ├── run-18-errno.c │ │ ├── run-19-always.c │ │ ├── run-20-io_time_override.c │ │ ├── run-21-io_close_taken_fd.c │ │ ├── run-22-POLLHUP-on-listening-socket.c │ │ ├── run-30-io_flush_sync.c │ │ ├── run-40-wakeup-mutual.c │ │ ├── run-41-io_poll_override.c │ │ ├── run-43-io_plan_in_started.c │ │ ├── run-44-io_plan_out_started.c │ │ ├── run-45-eof.c │ │ ├── run-46-exclusive.c │ │ ├── run-47-exclusive-duplex.c │ │ └── run-48-exclusive-duplex-write.c ├── isaac │ ├── LICENSE │ ├── _info │ ├── isaac.c │ ├── isaac.h │ ├── isaac64.c │ ├── isaac64.h │ └── test │ │ ├── run.c │ │ └── run64.c ├── iscsi │ ├── LICENCE │ ├── LICENSE │ ├── Makefile │ ├── _info │ ├── discovery.c │ ├── dlinklist.h │ ├── init.c │ ├── iscsi-private.h │ ├── iscsi.h │ ├── login.c │ ├── nop.c │ ├── pdu.c │ ├── scsi-command.c │ ├── scsi-lowlevel.c │ ├── scsi-lowlevel.h │ ├── socket.c │ ├── test │ │ └── run.c │ └── tools │ │ └── iscsiclient.c ├── jacobson_karels │ ├── LICENSE │ ├── _info │ ├── jacobson_karels.h │ └── test │ │ ├── run-nouse.c │ │ └── run.c ├── jmap │ ├── LICENSE │ ├── _info │ ├── jmap.c │ ├── jmap.h │ ├── test │ │ ├── run-access-count.c │ │ ├── run-ptridx-int.c │ │ ├── run-ptridx-type.c │ │ ├── run-uintidx-type.c │ │ └── run.c │ └── tools │ │ ├── Makefile │ │ └── speed.c ├── jset │ ├── LICENSE │ ├── _info │ ├── jset.c │ ├── jset.h │ └── test │ │ ├── run-pointer-type.c │ │ └── run.c ├── json │ ├── LICENSE │ ├── _info │ ├── json.c │ ├── json.h │ └── test │ │ ├── common.h │ │ ├── run-construction.c │ │ ├── run-decode-encode.c │ │ ├── run-stringify.c │ │ ├── run-validate.c │ │ ├── test-strings │ │ └── test-strings-reencoded ├── json_escape │ ├── LICENSE │ ├── _info │ ├── json_escape.c │ ├── json_escape.h │ └── test │ │ ├── run-partial.c │ │ ├── run-take.c │ │ └── run.c ├── json_out │ ├── LICENSE │ ├── _info │ ├── json_out.c │ ├── json_out.h │ └── test │ │ ├── run-debugging.c │ │ ├── run-move_cb.c │ │ └── run.c ├── lbalance │ ├── LICENSE │ ├── _info │ ├── lbalance.c │ ├── lbalance.h │ ├── test │ │ └── run.c │ └── tools │ │ ├── Makefile │ │ └── lbalance.c ├── likely │ ├── LICENSE │ ├── _info │ ├── likely.c │ ├── likely.h │ └── test │ │ ├── run-debug.c │ │ └── run.c ├── list │ ├── LICENSE │ ├── _info │ ├── list.c │ ├── list.h │ └── test │ │ ├── compile_ok-constant.c │ │ ├── helper.c │ │ ├── helper.h │ │ ├── run-CCAN_LIST_DEBUG.c │ │ ├── run-check-corrupt.c │ │ ├── run-check-nonconst.c │ │ ├── run-list_del_from-assert.c │ │ ├── run-list_prev-list_next.c │ │ ├── run-prepend_list.c │ │ ├── run-single-eval.c │ │ ├── run-with-debug.c │ │ └── run.c ├── lpq │ ├── LICENSE │ ├── _info │ ├── lpq.c │ ├── lpq.h │ └── test │ │ └── api.c ├── lqueue │ ├── LICENSE │ ├── _info │ ├── lqueue.h │ └── test │ │ └── run.c ├── lstack │ ├── LICENSE │ ├── _info │ ├── lstack.h │ └── test │ │ └── run.c ├── md4 │ ├── LICENSE │ ├── _info │ ├── md4.c │ ├── md4.h │ └── test │ │ └── api.c ├── mem │ ├── LICENSE │ ├── _info │ ├── bench │ │ ├── .gitignore │ │ ├── Makefile │ │ └── speed.c │ ├── mem.c │ ├── mem.h │ └── test │ │ ├── api-memcheck.c │ │ ├── api.c │ │ └── compile_fail-memcheck.c ├── membuf │ ├── LICENSE │ ├── _info │ ├── membuf.c │ ├── membuf.h │ └── test │ │ └── run.c ├── minmax │ ├── LICENSE │ ├── _info │ ├── minmax.h │ └── test │ │ ├── compile_fail-wrongsign.c │ │ ├── compile_fail-wrongsize.c │ │ └── run.c ├── net │ ├── LICENSE │ ├── _info │ ├── net.c │ ├── net.h │ ├── test │ │ ├── run-bind.c │ │ └── run.c │ └── tools │ │ ├── Makefile │ │ └── test-net.c ├── nfs │ ├── LICENSE │ ├── Makefile │ ├── _info │ ├── dlinklist.h │ ├── init.c │ ├── libnfs-private.h │ ├── libnfs-raw-mount.c │ ├── libnfs-raw-nfs.c │ ├── libnfs-raw-nfsacl.c │ ├── libnfs-raw-portmap.c │ ├── libnfs-raw.h │ ├── libnfs-sync.c │ ├── libnfs.c │ ├── mount.c │ ├── nfs.c │ ├── nfs.h │ ├── nfsacl.c │ ├── pdu.c │ ├── portmap.c │ ├── rpc │ │ ├── mount.h │ │ ├── mount.x │ │ ├── nfs.h │ │ ├── nfs.x │ │ ├── nfsacl.h │ │ ├── nfsacl.x │ │ ├── portmap.h │ │ └── portmap.x │ ├── socket.c │ └── tools │ │ ├── nfsclient-async.c │ │ ├── nfsclient-raw.c │ │ └── nfsclient-sync.c ├── noerr │ ├── LICENSE │ ├── _info │ ├── noerr.c │ ├── noerr.h │ └── test │ │ └── run.c ├── objset │ ├── LICENSE │ ├── _info │ ├── objset.h │ └── test │ │ └── run.c ├── ogg_to_pcm │ ├── LICENSE │ ├── _info │ ├── ogg_to_pcm.c │ └── ogg_to_pcm.h ├── opt │ ├── LICENSE │ ├── _info │ ├── helpers.c │ ├── opt.c │ ├── opt.h │ ├── parse.c │ ├── private.h │ ├── test │ │ ├── compile_ok-const-arg.c │ │ ├── run-add_desc.c │ │ ├── run-checkopt.c │ │ ├── run-consume_words.c │ │ ├── run-correct-reporting.c │ │ ├── run-early.c │ │ ├── run-early_incomplete.c │ │ ├── run-helpers.c │ │ ├── run-iter.c │ │ ├── run-no-options.c │ │ ├── run-set_alloc.c │ │ ├── run-unregister.c │ │ ├── run-usage.c │ │ ├── run-userbits.c │ │ ├── run.c │ │ ├── utils.c │ │ └── utils.h │ └── usage.c ├── order │ ├── LICENSE │ ├── _info │ ├── order.c │ ├── order.h │ └── test │ │ ├── api.c │ │ ├── compile_fail_1.c │ │ ├── compile_fail_2.c │ │ ├── compile_ok.c │ │ ├── fancy_cmp.h │ │ └── run-fancy.c ├── permutation │ ├── LICENSE │ ├── _info │ ├── permutation.c │ ├── permutation.h │ └── test │ │ └── api.c ├── pipecmd │ ├── LICENSE │ ├── _info │ ├── pipecmd.c │ ├── pipecmd.h │ └── test │ │ ├── run-fdleak.c │ │ ├── run-preserve.c │ │ └── run.c ├── pr_log │ ├── LICENSE │ ├── _info │ ├── pr_log.c │ ├── pr_log.h │ └── test │ │ ├── run-debug.c │ │ ├── run-disable.c │ │ └── run.c ├── ptr_valid │ ├── LICENSE │ ├── _info │ ├── ptr_valid.c │ ├── ptr_valid.h │ └── test │ │ ├── run-string.c │ │ └── run.c ├── ptrint │ ├── LICENSE │ ├── _info │ ├── ptrint.h │ └── test │ │ └── run.c ├── pushpull │ ├── LICENSE │ ├── _info │ ├── pull.c │ ├── pull.h │ ├── push.c │ ├── push.h │ ├── pushpull.h │ └── test │ │ └── run.c ├── rbtree │ ├── LICENSE │ ├── _info │ ├── rbtree.c │ ├── rbtree.h │ └── test │ │ ├── run-many.c │ │ └── run.c ├── rbuf │ ├── LICENSE │ ├── _info │ ├── rbuf.c │ ├── rbuf.h │ └── test │ │ ├── run-all.c │ │ ├── run-open.c │ │ ├── run-partial-read.c │ │ ├── run-term-eof.c │ │ └── run.c ├── read_write_all │ ├── LICENSE │ ├── _info │ ├── read_write_all.c │ ├── read_write_all.h │ └── test │ │ ├── run-read_all.c │ │ └── run-write_all.c ├── rfc822 │ ├── LICENSE │ ├── _info │ ├── examples │ │ ├── .gitignore │ │ ├── Makefile │ │ └── headernames.c │ ├── rfc5322.txt │ ├── rfc822.c │ ├── rfc822.h │ └── test │ │ ├── helper.c │ │ ├── helper.h │ │ ├── run-bad-header-name-chars.c │ │ ├── run-check-check.c │ │ ├── run-default-alloc-failure.c │ │ ├── run-hdr-and-body.c │ │ ├── run-hdr-no-colon.c │ │ ├── run-hdr-of-name.c │ │ ├── run-no-body.c │ │ ├── run-testdata.c │ │ ├── run-unfold.c │ │ └── testdata.h ├── rszshm │ ├── LICENSE │ ├── _info │ ├── rszshm.c │ ├── rszshm.h │ └── test │ │ └── run.c ├── rune │ ├── LICENSE │ ├── _info │ ├── coding.c │ ├── internal.h │ ├── rune.c │ ├── rune.h │ └── test │ │ ├── run-alt-lexicographic-order.c │ │ ├── run-altern-escape.c │ │ ├── run.c │ │ └── test_vectors.csv ├── short_types │ ├── LICENSE │ ├── _info │ ├── short_types.h │ └── test │ │ ├── run-endian.c │ │ └── run.c ├── siphash │ ├── LICENSE │ ├── _info │ ├── siphash.c │ ├── siphash.h │ └── test │ │ └── api.c ├── sparse_bsearch │ ├── LICENSE │ ├── _info │ ├── sparse_bsearch.c │ ├── sparse_bsearch.h │ └── test │ │ └── run.c ├── str │ ├── LICENSE │ ├── _info │ ├── base32 │ │ ├── LICENSE │ │ ├── _info │ │ ├── base32.c │ │ ├── base32.h │ │ └── test │ │ │ ├── run-lower.c │ │ │ └── run.c │ ├── debug.c │ ├── hex │ │ ├── LICENSE │ │ ├── _info │ │ ├── hex.c │ │ ├── hex.h │ │ └── test │ │ │ └── run.c │ ├── str.c │ ├── str.h │ ├── str_debug.h │ └── test │ │ ├── compile_fail-STR_MAX_CHARS.c │ │ ├── compile_fail-isalnum.c │ │ ├── compile_fail-isalpha.c │ │ ├── compile_fail-isascii.c │ │ ├── compile_fail-isblank.c │ │ ├── compile_fail-iscntrl.c │ │ ├── compile_fail-isdigit.c │ │ ├── compile_fail-islower.c │ │ ├── compile_fail-isprint.c │ │ ├── compile_fail-ispunct.c │ │ ├── compile_fail-isspace.c │ │ ├── compile_fail-isupper.c │ │ ├── compile_fail-isxdigit.c │ │ ├── compile_fail-strchr.c │ │ ├── compile_fail-strrchr.c │ │ ├── compile_fail-strstr.c │ │ ├── compile_ok-STR_MAX_CHARS-static.c │ │ ├── debug.c │ │ ├── run-STR_MAX_CHARS.c │ │ └── run.c ├── strgrp │ ├── LICENSE │ ├── _info │ ├── strgrp.c │ ├── strgrp.h │ └── test │ │ ├── api_all_similar_insert_two.c │ │ ├── api_almost_different_25_insert_two.c │ │ ├── api_almost_different_50_insert_two.c │ │ ├── api_almost_different_75_insert_two.c │ │ ├── api_almost_similar_25_insert_two.c │ │ ├── api_almost_similar_50_insert_two.c │ │ ├── api_almost_similar_75_insert_two.c │ │ ├── api_exact_match_insert_two.c │ │ ├── api_illegal_none_similar_insert_two.c │ │ ├── api_insert_duplicate.c │ │ ├── api_insert_one.c │ │ ├── api_insert_two_distinct.c │ │ ├── api_iterate_no_groups.c │ │ ├── api_iterate_one_group.c │ │ ├── api_iterate_two_groups.c │ │ ├── api_new_free.c │ │ ├── api_test_free_cb.c │ │ ├── api_test_print.c │ │ ├── helpers.c │ │ └── helpers.h ├── stringbuilder │ ├── LICENSE │ ├── _info │ ├── stringbuilder.c │ ├── stringbuilder.h │ └── test │ │ └── run.c ├── stringmap │ ├── LICENSE │ ├── _info │ ├── stringmap.c │ ├── stringmap.h │ └── test │ │ └── run.c ├── strmap │ ├── LICENSE │ ├── _info │ ├── strmap.c │ ├── strmap.h │ └── test │ │ ├── run-iterate-const.c │ │ ├── run-order.c │ │ ├── run-prefix.c │ │ └── run.c ├── strset │ ├── _info │ ├── strset.c │ ├── strset.h │ ├── test │ │ ├── run-hibit.c │ │ ├── run-iterate-const.c │ │ ├── run-order.c │ │ ├── run-prefix.c │ │ └── run.c │ └── tools │ │ ├── Makefile │ │ ├── cbspeed.c │ │ └── speed.c ├── structeq │ ├── LICENSE │ ├── _info │ ├── structeq.h │ └── test │ │ ├── compile_fail-different.c │ │ ├── compile_fail-expect-any-padding.c │ │ ├── compile_fail-expect-padding.c │ │ ├── compile_fail-unexpceted-padding.c │ │ ├── compile_fail-unexpected-negative-padding.c │ │ ├── run-with-padding.c │ │ ├── run-with-unknown-padding.c │ │ └── run.c ├── take │ ├── LICENSE │ ├── _info │ ├── take.c │ ├── take.h │ └── test │ │ ├── run-debug.c │ │ └── run.c ├── tal │ ├── LICENSE │ ├── _info │ ├── autoptr │ │ ├── LICENSE │ │ ├── _info │ │ ├── autoptr.c │ │ ├── autoptr.h │ │ └── test │ │ │ └── run.c │ ├── benchmark │ │ ├── Makefile │ │ ├── samba-allocs.c │ │ ├── speed.c │ │ └── talloc.dump │ ├── grab_file │ │ ├── LICENSE │ │ ├── _info │ │ ├── grab_file.c │ │ ├── grab_file.h │ │ └── test │ │ │ └── run-grab.c │ ├── link │ │ ├── LICENSE │ │ ├── _info │ │ ├── link.c │ │ ├── link.h │ │ └── test │ │ │ └── run.c │ ├── path │ │ ├── LICENSE │ │ ├── _info │ │ ├── path.c │ │ ├── path.h │ │ └── test │ │ │ ├── run-basename.c │ │ │ ├── run-canon.c │ │ │ ├── run-cwd.c │ │ │ ├── run-dirname.c │ │ │ ├── run-ext_off.c │ │ │ ├── run-is_abs.c │ │ │ ├── run-is_dir.c │ │ │ ├── run-is_file.c │ │ │ ├── run-join.c │ │ │ ├── run-pushd.c │ │ │ ├── run-readlink.c │ │ │ ├── run-rel.c │ │ │ ├── run-simplify.c │ │ │ └── run-split.c │ ├── stack │ │ ├── LICENSE │ │ ├── _info │ │ ├── stack.c │ │ ├── stack.h │ │ └── test │ │ │ └── run-stack.c │ ├── str │ │ ├── LICENSE │ │ ├── _info │ │ ├── str.c │ │ ├── str.h │ │ └── test │ │ │ ├── helper.h │ │ │ ├── run-fmt-terminate.c │ │ │ ├── run-string.c │ │ │ ├── run-strndup.c │ │ │ ├── run-strreg.c │ │ │ ├── run-take.c │ │ │ └── run.c │ ├── tal.c │ ├── tal.h │ ├── talloc │ │ ├── LICENSE │ │ ├── _info │ │ ├── talloc.c │ │ ├── talloc.h │ │ └── test │ │ │ ├── run-array.c │ │ │ ├── run-count.c │ │ │ ├── run-destructor.c │ │ │ ├── run-expand.c │ │ │ ├── run-free.c │ │ │ ├── run-named-debug.c │ │ │ ├── run-named-nolabels.c │ │ │ ├── run-named.c │ │ │ ├── run-overflow.c │ │ │ ├── run-steal.c │ │ │ ├── run-take.c │ │ │ └── run.c │ └── test │ │ ├── run-allocfail.c │ │ ├── run-array.c │ │ ├── run-count.c │ │ ├── run-destructor.c │ │ ├── run-destructor2.c │ │ ├── run-expand.c │ │ ├── run-free.c │ │ ├── run-groups-grow.c │ │ ├── run-iter.c │ │ ├── run-named-debug.c │ │ ├── run-named-nolabels.c │ │ ├── run-named.c │ │ ├── run-notifier.c │ │ ├── run-overflow.c │ │ ├── run-resizez.c │ │ ├── run-steal.c │ │ ├── run-take-free-assert.c │ │ ├── run-take.c │ │ ├── run-test-backend.c │ │ └── run.c ├── talloc │ ├── LICENSE │ ├── _info │ ├── talloc.3.xml │ ├── talloc.c │ ├── talloc.h │ └── test │ │ ├── compile_fail-talloc_set.c │ │ ├── run-corruption1.c │ │ ├── run-external-alloc.c │ │ ├── run-set_allocator.c │ │ ├── run-talloc_set.c │ │ ├── run-test_autofree.c │ │ ├── run-test_free_in_destructor.c │ │ ├── run-test_free_parent_deny_child.c │ │ ├── run-test_loop.c │ │ ├── run-test_misc.c │ │ ├── run-test_move.c │ │ ├── run-test_realloc.c │ │ ├── run-test_realloc_fn.c │ │ ├── run-test_ref.c │ │ ├── run-test_steal.c │ │ ├── run-test_talloc_ptrtype.c │ │ ├── run-test_type.c │ │ ├── run-test_unlink.c │ │ ├── run-test_unref_reparent.c │ │ └── run.c ├── tally │ ├── LICENSE │ ├── _info │ ├── tally.c │ ├── tally.h │ └── test │ │ ├── run-bucket_of.c │ │ ├── run-divlu64.c │ │ ├── run-histogram.c │ │ ├── run-mean.c │ │ ├── run-median.c │ │ ├── run-min-max.c │ │ ├── run-mode.c │ │ ├── run-renormalize.c │ │ └── run-total.c ├── tap │ ├── _info │ ├── tap.3 │ ├── tap.c │ ├── tap.h │ └── test │ │ └── run.c ├── tcon │ ├── LICENSE │ ├── _info │ ├── tcon.h │ └── test │ │ ├── compile_fail-container1.c │ │ ├── compile_fail-container1w.c │ │ ├── compile_fail-container2.c │ │ ├── compile_fail-container2w.c │ │ ├── compile_fail-container3.c │ │ ├── compile_fail-container3w.c │ │ ├── compile_fail-container4.c │ │ ├── compile_fail-container4w.c │ │ ├── compile_fail-tcon_cast.c │ │ ├── compile_fail-tcon_cast_wrap.c │ │ ├── compile_fail-wrap.c │ │ ├── compile_fail.c │ │ ├── compile_ok-container.c │ │ ├── compile_ok-sizeof.c │ │ ├── compile_ok-value.c │ │ ├── compile_ok-void.c │ │ ├── compile_ok.c │ │ ├── run-container.c │ │ └── run-wrap.c ├── time │ ├── LICENSE │ ├── _info │ ├── test │ │ ├── run-check.c │ │ ├── run-monotonic.c │ │ └── run.c │ ├── time.c │ └── time.h ├── timer │ ├── LICENSE │ ├── _info │ ├── benchmarks │ │ ├── Makefile │ │ ├── benchmark.c │ │ └── expected-usage.c │ ├── design.txt │ ├── test │ │ ├── run-add.c │ │ ├── run-allocator.c │ │ ├── run-corrupt.c │ │ ├── run-corrupt2.c │ │ ├── run-expiry.c │ │ ├── run-ff.c │ │ ├── run-original-corrupt.c │ │ └── run.c │ ├── timer.c │ └── timer.h ├── tlist │ ├── LICENSE │ ├── _info │ ├── test │ │ ├── compile_fail-tlist_add.c │ │ ├── compile_fail-tlist_add_tail.c │ │ ├── compile_fail-tlist_del_from.c │ │ ├── compile_fail-tlist_for_each.c │ │ ├── compile_fail-tlist_for_each_safe.c │ │ ├── compile_fail-tlist_next.c │ │ ├── compile_fail-tlist_next2.c │ │ ├── compile_fail-tlist_prev.c │ │ ├── compile_fail-tlist_prev2.c │ │ ├── compile_fail-tlist_tail.c │ │ ├── compile_fail-tlist_top.c │ │ └── run.c │ └── tlist.h ├── tlist2 │ ├── LICENSE │ ├── _info │ ├── test │ │ ├── .c │ │ ├── compile_fail-tlist_add_2.c │ │ ├── compile_fail-tlist_add_tail_2.c │ │ ├── compile_fail-tlist_del_from_2.c │ │ ├── compile_fail-tlist_for_each_2.c │ │ ├── compile_fail-tlist_for_each_safe_2.c │ │ ├── compile_fail-tlist_tail_2.c │ │ ├── compile_fail-tlist_top_2.c │ │ └── run_2.c │ └── tlist2.h ├── ttxml │ ├── LICENSE │ ├── _info │ ├── test │ │ ├── run.c │ │ ├── test.xml1 │ │ ├── test.xml2 │ │ ├── test.xml3 │ │ └── test.xml4 │ ├── ttxml.c │ └── ttxml.h ├── typesafe_cb │ ├── LICENSE │ ├── _info │ ├── test │ │ ├── compile_fail-cast_if_type-promotable.c │ │ ├── compile_fail-typesafe_cb-int.c │ │ ├── compile_fail-typesafe_cb.c │ │ ├── compile_fail-typesafe_cb_cast-multi.c │ │ ├── compile_fail-typesafe_cb_cast.c │ │ ├── compile_fail-typesafe_cb_postargs.c │ │ ├── compile_fail-typesafe_cb_preargs.c │ │ ├── compile_ok-typesafe_cb-NULL.c │ │ ├── compile_ok-typesafe_cb-undefined.c │ │ ├── compile_ok-typesafe_cb-vars.c │ │ ├── compile_ok-typesafe_cb_cast.c │ │ └── run.c │ └── typesafe_cb.h ├── ungraph │ ├── LICENSE │ ├── _info │ ├── test │ │ └── run.c │ ├── ungraph.c │ └── ungraph.h ├── utf8 │ ├── LICENSE │ ├── _info │ ├── test │ │ ├── run-decode.c │ │ ├── run-encode-decode.c │ │ └── run-encode.c │ ├── utf8.c │ └── utf8.h ├── version │ ├── LICENSE │ ├── _info │ ├── test │ │ ├── compile_fail.c │ │ └── run.c │ └── version.h ├── wwviaudio │ ├── LICENSE │ ├── _info │ ├── wwviaudio.c │ └── wwviaudio.h └── xstring │ ├── LICENSE │ ├── _info │ ├── test │ ├── run.c │ └── run2.c │ ├── xstring.c │ └── xstring.h ├── doc ├── Makefile ├── ccanlint.1 ├── ccanlint.1.txt ├── configurator.1 └── configurator.1.txt ├── junkcode ├── codedr@gmail.com-grok │ └── grok.c ├── dongre.avinash@gmail.com-clibutils │ ├── inc │ │ ├── c_array.h │ │ ├── c_deque.h │ │ ├── c_errors.h │ │ ├── c_heap.h │ │ ├── c_lib.h │ │ ├── c_map.h │ │ ├── c_rb.h │ │ ├── c_set.h │ │ ├── c_slist.h │ │ └── c_stack.h │ ├── src │ │ ├── Makefile │ │ ├── c_array.c │ │ ├── c_deque.c │ │ ├── c_heap.c │ │ ├── c_map.c │ │ ├── c_rb.c │ │ ├── c_set.c │ │ ├── c_slist.c │ │ ├── c_stack.c │ │ └── c_util.c │ ├── test │ │ ├── Makefile │ │ ├── t_c_array.c │ │ ├── t_c_deque.c │ │ ├── t_c_heap.c │ │ ├── t_c_map.c │ │ ├── t_c_rb.c │ │ ├── t_c_set.c │ │ ├── t_c_slist.c │ │ ├── t_c_stack.c │ │ └── t_clibutils.c │ └── win │ │ ├── clibutils.ncb │ │ ├── clibutils.sln │ │ ├── clibutils.suo │ │ ├── clibutils.vcproj │ │ ├── clibutils.vcproj.ADPROD.avdongre.user │ │ ├── clibutils_Debug │ │ ├── BuildLog.htm │ │ ├── c_array.obj │ │ ├── c_deque.obj │ │ ├── c_heap.obj │ │ ├── c_map.obj │ │ ├── c_rb.obj │ │ ├── c_set.obj │ │ ├── c_slist.obj │ │ ├── c_stack.obj │ │ ├── c_util.obj │ │ ├── clibutils.idb │ │ ├── clibutils.lib │ │ └── clibutils.pdb │ │ ├── tclibutils.vcproj │ │ ├── tclibutils.vcproj.ADPROD.avdongre.user │ │ └── tclibutils_Debug │ │ ├── BuildLog.htm │ │ ├── mt.dep │ │ ├── t_c_array.obj │ │ ├── t_c_deque.obj │ │ ├── t_c_heap.obj │ │ ├── t_c_map.obj │ │ ├── t_c_rb.obj │ │ ├── t_c_set.obj │ │ ├── t_c_slist.obj │ │ ├── t_c_stack.obj │ │ ├── t_clibutils.obj │ │ ├── tclibutils.exe │ │ ├── tclibutils.exe.embed.manifest │ │ ├── tclibutils.exe.embed.manifest.res │ │ ├── tclibutils.exe.intermediate.manifest │ │ ├── tclibutils.idb │ │ ├── tclibutils.ilk │ │ ├── tclibutils.pdb │ │ ├── tclibutils_pure.ini │ │ └── tclibutils_pure.log ├── fork0@users.sf.net-bitmaps │ └── bitmaps.h ├── fork0@users.sf.net-pathexpand │ └── pathexpand.c ├── fork0@users.sf.net-timeout │ └── timeout.c ├── guerrilla_thought@gmx.de-bst │ └── bst.h ├── henryeshbaugh@gmail.com-log │ ├── LICENSE │ ├── _info │ ├── log.c │ └── log.h ├── iasoule32@gmail.com-polynomial │ ├── _info.c │ ├── polynomial_adt.c │ ├── polynomial_adt.h │ └── test │ │ └── run.c ├── mansourmoufid@gmail.com-endianness │ └── endianness.c ├── rusty@rustcorp.com.au-ntdb │ ├── ABI │ │ ├── ntdb-0.9.sigs │ │ └── ntdb-1.0.sigs │ ├── LICENSE │ ├── Makefile │ ├── _info │ ├── check.c │ ├── doc │ │ ├── TDB_porting.txt │ │ ├── design.lyx │ │ ├── design.pdf │ │ └── design.txt │ ├── free.c │ ├── hash.c │ ├── io.c │ ├── lock.c │ ├── man │ │ ├── ntdb.3.xml │ │ ├── ntdbbackup.8.xml │ │ ├── ntdbdump.8.xml │ │ ├── ntdbrestore.8.xml │ │ └── ntdbtool.8.xml │ ├── ntdb.c │ ├── ntdb.h │ ├── ntdb.pc.in │ ├── open.c │ ├── private.h │ ├── python │ │ └── pyntdb.c │ ├── summary.c │ ├── test │ │ ├── api-12-store.c │ │ ├── api-13-delete.c │ │ ├── api-14-exists.c │ │ ├── api-16-wipe_all.c │ │ ├── api-20-alloc-attr.c │ │ ├── api-21-parse_record.c │ │ ├── api-55-transaction.c │ │ ├── api-60-noop-transaction.c │ │ ├── api-80-tdb_fd.c │ │ ├── api-81-seqnum.c │ │ ├── api-82-lockattr.c │ │ ├── api-83-openhook.c │ │ ├── api-91-get-stats.c │ │ ├── api-92-get-set-readonly.c │ │ ├── api-93-repack.c │ │ ├── api-94-expand-during-parse.c │ │ ├── api-95-read-only-during-parse.c │ │ ├── api-add-remove-flags.c │ │ ├── api-check-callback.c │ │ ├── api-firstkey-nextkey.c │ │ ├── api-fork-test.c │ │ ├── api-locktimeout.c │ │ ├── api-missing-entries.c │ │ ├── api-open-multiple-times.c │ │ ├── api-record-expand.c │ │ ├── api-simple-delete.c │ │ ├── api-summary.c │ │ ├── external-agent.c │ │ ├── external-agent.h │ │ ├── failtest_helper.c │ │ ├── failtest_helper.h │ │ ├── helpapi-external-agent.h │ │ ├── helprun-external-agent.h │ │ ├── helprun-layout.h │ │ ├── layout.h │ │ ├── lock-tracking.c │ │ ├── lock-tracking.h │ │ ├── logging.c │ │ ├── logging.h │ │ ├── no-fsync.h │ │ ├── ntdb-source.h │ │ ├── python-api.py │ │ ├── run-001-encode.c │ │ ├── run-001-fls.c │ │ ├── run-01-new_database.c │ │ ├── run-02-expand.c │ │ ├── run-03-coalesce.c │ │ ├── run-04-basichash.c │ │ ├── run-05-readonly-open.c │ │ ├── run-10-simple-store.c │ │ ├── run-11-simple-fetch.c │ │ ├── run-12-check.c │ │ ├── run-15-append.c │ │ ├── run-25-hashoverload.c │ │ ├── run-30-exhaust-before-expand.c │ │ ├── run-35-convert.c │ │ ├── run-50-multiple-freelists.c │ │ ├── run-56-open-during-transaction.c │ │ ├── run-57-die-during-transaction.c │ │ ├── run-64-bit-tdb.c │ │ ├── run-90-get-set-attributes.c │ │ ├── run-capabilities.c │ │ ├── run-expand-in-transaction.c │ │ ├── run-features.c │ │ ├── run-lockall.c │ │ ├── run-remap-in-read_traverse.c │ │ ├── run-seed.c │ │ ├── run-tdb_errorstr.c │ │ ├── run-tdb_foreach.c │ │ ├── run-traverse.c │ │ ├── tap-interface.c │ │ └── tap-interface.h │ ├── tools │ │ ├── Makefile │ │ ├── growtdb-bench.c │ │ ├── mkntdb.c │ │ ├── ntdbbackup.c │ │ ├── ntdbdump.c │ │ ├── ntdbrestore.c │ │ ├── ntdbtool.c │ │ ├── ntdbtorture.c │ │ └── speed.c │ ├── transaction.c │ ├── traverse.c │ └── wscript ├── swehack@gmail.com-snifstat │ └── snifstat.c ├── tinkertim@gmail.com-grawk │ └── grawk.c └── tterribe@email.unc.edu-nmbrthry │ ├── [ccan] Mathematics Module.mbox │ ├── choose.c │ ├── choose.h │ ├── crt.c │ ├── crt.h │ ├── egcd.c │ ├── egcd.h │ ├── gcd.c │ └── gcd.h ├── licenses ├── APACHE-2 ├── BSD-3CLAUSE ├── BSD-MIT ├── CC0 ├── GPL-2 ├── GPL-3 ├── LGPL-2.1 └── LGPL-3 ├── tools ├── ccan_depends.c ├── ccan_dir.c ├── ccanlint │ ├── async.c │ ├── ccanlint.c │ ├── ccanlint.h │ ├── file_analysis.c │ ├── licenses.c │ ├── licenses.h │ ├── test │ │ ├── Makefile │ │ └── run-file_analysis.c │ └── tests │ │ ├── avoids_cpp_reserved.c │ │ ├── build.h │ │ ├── depends_accurate.c │ │ ├── depends_build.c │ │ ├── depends_build_without_features.c │ │ ├── depends_exist.c │ │ ├── examples_compile.c │ │ ├── examples_exist.c │ │ ├── examples_relevant.c │ │ ├── examples_run.c │ │ ├── hash_if.c │ │ ├── headers_idempotent.c │ │ ├── info_compiles.c │ │ ├── info_documentation_exists.c │ │ ├── info_exists.c │ │ ├── info_ported.c │ │ ├── info_summary_single_line.c │ │ ├── license_comment.c │ │ ├── license_depends_compat.c │ │ ├── license_exists.c │ │ ├── license_file_compat.c │ │ ├── main_header_compiles.c │ │ ├── main_header_exists.c │ │ ├── module_builds.c │ │ ├── module_links.c │ │ ├── no_trailing_whitespace.c │ │ ├── objects_build.c │ │ ├── objects_build_with_stringchecks.c │ │ ├── objects_build_without_features.c │ │ ├── reduce_features.c │ │ ├── reduce_features.h │ │ ├── tests_compile.c │ │ ├── tests_compile.h │ │ ├── tests_compile_coverage.c │ │ ├── tests_coverage.c │ │ ├── tests_exist.c │ │ ├── tests_helpers_compile.c │ │ ├── tests_pass.c │ │ ├── tests_pass.h │ │ ├── tests_pass_valgrind.c │ │ └── tests_pass_without_features.c ├── compile.c ├── configurator │ └── configurator.c ├── create-ccan-tree ├── depends.c ├── doc_extract-core.c ├── doc_extract.c ├── doc_extract.h ├── gcov.c ├── gen_deps.sh ├── list_files.sh ├── manifest.c ├── manifest.h ├── modfiles.c ├── namespacize.c ├── read_config_header.c ├── read_config_header.h ├── test_all.sh ├── tools.c └── tools.h └── web ├── ccan-bg.png ├── ccan.css ├── ccan.jpg ├── ccan.png ├── ccan.svg ├── logo.html ├── menulist.html ├── search.html ├── static-configuration ├── staticall.php ├── staticindex.php ├── staticjunkcode.php ├── staticmoduleinfo.php ├── staticupload.php ├── upload.php └── uploader.php.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | TAGS 2 | .valgrind_suppressions 3 | *.d 4 | *.o 5 | *.ok 6 | .fast-ok 7 | config.h 8 | config.h.tmp 9 | *~ 10 | tools/ccan_depends 11 | tools/doc_extract 12 | tools/namespacize 13 | tools/run_tests 14 | tools/ccanlint/ccanlint 15 | tools/modfiles 16 | tools/_infotojson/infotojson 17 | tools/ccanlint/test/run-file_analysis 18 | tools/configurator/configurator 19 | scores/ 20 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | The C Code Archive Network: http://ccodearchive.net 2 | 3 | You can find a set of helper utilities under tools/ and the modules 4 | under ccan/. The recommended way to add ccan modules to your project 5 | is to create a ccan/ directory and add one module per subdirectory 6 | (see tools/create-ccan-tree). 7 | 8 | Enjoy! 9 | -------------------------------------------------------------------------------- /ccan/.gitignore: -------------------------------------------------------------------------------- 1 | *-Makefile 2 | info 3 | 4 | -------------------------------------------------------------------------------- /ccan/a_star/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/GPL-2 -------------------------------------------------------------------------------- /ccan/aga/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/aga/private.h: -------------------------------------------------------------------------------- 1 | /* Licensed under LGPLv2+ - see LICENSE file for details */ 2 | #ifndef CCAN_AGA_PRIVATE_H 3 | #define CCAN_AGA_PRIVATE_H 4 | 5 | int aga_start(struct aga_graph *g); 6 | bool aga_node_needs_update(const struct aga_graph *g, 7 | const struct aga_node *node); 8 | bool aga_update_node(const struct aga_graph *g, struct aga_node *node); 9 | bool aga_check_state(const struct aga_graph *g); 10 | void aga_fail(struct aga_graph *g, int error); 11 | 12 | #endif /* CCAN_AGA_PRIVATE_H */ 13 | -------------------------------------------------------------------------------- /ccan/aga/test/chain.c: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | 9 | #include "simple-graph.h" 10 | 11 | static int chain_edge_info(const struct aga_graph *g, 12 | const struct aga_node *node, 13 | struct aga_node *edge, 14 | struct aga_edge_info *ei) 15 | { 16 | if ((edge == node + 1) || (node == edge + 1)) 17 | ei->to = edge; 18 | 19 | return 0; 20 | } 21 | 22 | void chain_graph_init(struct chain_graph *cg, int nnodes) 23 | { 24 | cg->fg.nnodes = nnodes; 25 | simple_graph_init(&cg->fg.sg, full_first_edge, full_next_edge, 26 | chain_edge_info); 27 | } 28 | -------------------------------------------------------------------------------- /ccan/aga/test/compile_fail-mismatch1.c: -------------------------------------------------------------------------------- 1 | #ifdef FAIL 2 | typedef struct mismatch mismatch_t; 3 | #define EDGE1 mismatch_t 4 | #endif 5 | 6 | #include "compile_ok.c" 7 | -------------------------------------------------------------------------------- /ccan/aga/test/compile_fail-mismatch2.c: -------------------------------------------------------------------------------- 1 | #ifdef FAIL 2 | typedef struct mismatch mismatch_t; 3 | #define EDGE2 mismatch_t 4 | #endif 5 | 6 | #include "compile_ok.c" 7 | -------------------------------------------------------------------------------- /ccan/aga/test/compile_fail-mismatch3.c: -------------------------------------------------------------------------------- 1 | #ifdef FAIL 2 | typedef struct mismatch mismatch_t; 3 | #define EDGE3 mismatch_t 4 | #endif 5 | 6 | #include "compile_ok.c" 7 | -------------------------------------------------------------------------------- /ccan/aga/test/compile_fail-mismatch4.c: -------------------------------------------------------------------------------- 1 | #ifdef FAIL 2 | typedef struct mismatch mismatch_t; 3 | #define EDGE4 mismatch_t 4 | #endif 5 | 6 | #include "compile_ok.c" 7 | -------------------------------------------------------------------------------- /ccan/aga/test/simple-graph.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "simple-graph.h" 4 | 5 | void simple_graph_init_(struct simple_graph *sg) 6 | { 7 | int i; 8 | 9 | for (i = 0; i < MAX_NODES; i++) 10 | aga_node_init(&sg->nodes[i]); 11 | } 12 | -------------------------------------------------------------------------------- /ccan/agar/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/agar/test/chain.c: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #include "simple-graphr.h" 11 | 12 | static int chain_edge_info_r(const struct agar_graph *gr, 13 | const void *nr, const void *e, 14 | struct agar_edge_info *eir) 15 | { 16 | int fromi = ptr2int(nr); 17 | int toi = ptr2int(e); 18 | 19 | if ((toi == fromi + 1) || (fromi == toi + 1)) 20 | eir->to = int2ptr(toi); 21 | 22 | return 0; 23 | } 24 | 25 | void chain_graphr_init(struct chain_graphr *cgr, int nnodes) 26 | { 27 | cgr->fgr.nnodes = nnodes; 28 | agar_init_graph(&cgr->fgr.gr, full_first_edge_r, full_next_edge_r, 29 | chain_edge_info_r); 30 | } 31 | -------------------------------------------------------------------------------- /ccan/alignof/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/alignof/alignof.h: -------------------------------------------------------------------------------- 1 | /* CC0 (Public domain) - see LICENSE file for details */ 2 | #ifndef CCAN_ALIGNOF_H 3 | #define CCAN_ALIGNOF_H 4 | #include "config.h" 5 | 6 | /** 7 | * ALIGNOF - get the alignment of a type 8 | * @t: the type to test 9 | * 10 | * This returns a safe alignment for the given type. 11 | */ 12 | #if HAVE_ALIGNOF 13 | /* A GCC extension. */ 14 | #define ALIGNOF(t) __alignof__(t) 15 | #else 16 | /* Alignment by measuring structure padding. */ 17 | #define ALIGNOF(t) ((char *)(&((struct { char c; t _h; } *)0)->_h) - (char *)0) 18 | #endif 19 | 20 | #endif /* CCAN_ALIGNOF_H */ 21 | -------------------------------------------------------------------------------- /ccan/altstack/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/APACHE-2 -------------------------------------------------------------------------------- /ccan/antithread/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/GPL-3 -------------------------------------------------------------------------------- /ccan/antithread/alloc/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/antithread/alloc/bitops.h: -------------------------------------------------------------------------------- 1 | /* Licensed under LGPLv2.1+ - see LICENSE file for details */ 2 | #ifndef CCAN_ALLOC_BITOPS_H 3 | #define CCAN_ALLOC_BITOPS_H 4 | unsigned int afls(unsigned long val); 5 | unsigned int affsl(unsigned long val); 6 | unsigned int popcount(unsigned long val); 7 | unsigned long align_up(unsigned long x, unsigned long align); 8 | #endif /* CCAN_ALLOC_BITOPS_H */ 9 | -------------------------------------------------------------------------------- /ccan/antithread/alloc/test/run-corrupt.c: -------------------------------------------------------------------------------- 1 | /* Example allocation which caused corruption. */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | int main(int argc, char *argv[]) 9 | { 10 | void *mem; 11 | 12 | plan_tests(7); 13 | 14 | mem = malloc(1179648); 15 | alloc_init(mem, 1179648); 16 | ok1(alloc_check(mem, 1179648)); 17 | ok1(alloc_get(mem, 1179648, 48, 16)); 18 | ok1(alloc_check(mem, 1179648)); 19 | ok1(alloc_get(mem, 1179648, 53, 16)); 20 | ok1(alloc_check(mem, 1179648)); 21 | ok1(alloc_get(mem, 1179648, 53, 16)); 22 | ok1(alloc_check(mem, 1179648)); 23 | free(mem); 24 | 25 | return exit_status(); 26 | } 27 | -------------------------------------------------------------------------------- /ccan/antithread/alloc/tiny.h: -------------------------------------------------------------------------------- 1 | /* Licensed under LGPLv2.1+ - see LICENSE file for details */ 2 | #ifndef CCAN_TINY_H 3 | #define CCAN_TINY_H 4 | #include 5 | #include 6 | 7 | void tiny_alloc_init(void *pool, unsigned long poolsize); 8 | void *tiny_alloc_get(void *pool, unsigned long poolsize, 9 | unsigned long size, unsigned long align); 10 | void tiny_alloc_free(void *pool, unsigned long poolsize, void *free); 11 | unsigned long tiny_alloc_size(void *pool, unsigned long poolsize, void *p); 12 | bool tiny_alloc_check(void *pool, unsigned long poolsize); 13 | void tiny_alloc_visualize(FILE *out, void *pool, unsigned long poolsize); 14 | 15 | #endif /* CCAN_TINY_H */ 16 | -------------------------------------------------------------------------------- /ccan/antithread/examples/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS=-g -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -I../../.. ../../talloc.o ../../alloc.o ../../noerr.o ../../read_write_all.o ../../antithread.o # -O3 2 | LDLIBS=-ljpeg -lm 3 | 4 | all: dns_lookup arabella 5 | 6 | clean: 7 | rm -f dns_lookup arabella 8 | -------------------------------------------------------------------------------- /ccan/antithread/examples/arabella.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/ccan/antithread/examples/arabella.jpg -------------------------------------------------------------------------------- /ccan/antithread/examples/md5_finder.h: -------------------------------------------------------------------------------- 1 | #ifndef MD5_FINDER_H 2 | #define MD5_FINDER_H 3 | #include 4 | #include 5 | 6 | #define MD5_HASH_WORDS 4 7 | 8 | #define u32 uint32_t 9 | #define u64 uint64_t 10 | #define u8 uint8_t 11 | 12 | struct md5_search { 13 | u32 mask[MD5_HASH_WORDS]; 14 | u32 md5[MD5_HASH_WORDS]; 15 | bool success; 16 | unsigned int num_tries; 17 | unsigned int num_bytes; 18 | u8 *pattern; 19 | }; 20 | 21 | /* Child writes this value initially to say "ready". */ 22 | #define INITIAL_POINTER ((void *)1) 23 | 24 | #endif /* MD5_FINDER_H */ 25 | -------------------------------------------------------------------------------- /ccan/antithread/test/run-simple.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static void *test(struct at_pool *atp, int *pid) 6 | { 7 | *pid = getpid(); 8 | return NULL; 9 | }; 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | struct at_pool *atp; 14 | struct athread *at; 15 | int *pid; 16 | 17 | plan_tests(4); 18 | 19 | atp = at_pool(1*1024*1024); 20 | assert(atp); 21 | pid = talloc(at_pool_ctx(atp), int); 22 | assert(pid); 23 | ok1((char *)pid >= (char *)atp->p->pool 24 | && (char *)pid < (char *)atp->p->pool + atp->p->poolsize); 25 | at = at_run(atp, test, pid); 26 | assert(at); 27 | 28 | ok1(at_read(at) == NULL); 29 | talloc_free(at); 30 | 31 | ok1(*pid != 0); 32 | ok1(*pid != getpid()); 33 | 34 | return exit_status(); 35 | } 36 | -------------------------------------------------------------------------------- /ccan/antithread/test/run-spawn-NULL.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | struct at_pool *atp; 8 | struct athread *at; 9 | int err; 10 | 11 | atp = at_get_pool(&argc, argv, NULL); 12 | if (atp) { 13 | at_tell_parent(atp, (void *)1UL); 14 | exit(0); 15 | } 16 | assert(!argv[1]); 17 | 18 | err = errno; 19 | plan_tests(3); 20 | ok1(err == EINVAL); 21 | 22 | atp = at_pool(1*1024*1024); 23 | assert(atp); 24 | 25 | /* This should work */ 26 | at = at_spawn(atp, NULL, argv); 27 | ok1(at); 28 | 29 | /* Should read back the magic pointer. */ 30 | ok1(at_read(at) == (void *)1); 31 | talloc_free(at); 32 | 33 | return exit_status(); 34 | } 35 | -------------------------------------------------------------------------------- /ccan/antithread/test/run-tell.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static void *test(struct at_pool *atp, void *unused) 6 | { 7 | char *p; 8 | p = at_read_parent(atp); 9 | at_tell_parent(atp, p + 1); 10 | return NULL; 11 | }; 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | struct at_pool *atp; 16 | struct athread *at; 17 | 18 | plan_tests(1); 19 | 20 | atp = at_pool(1*1024*1024); 21 | assert(atp); 22 | at = at_run(atp, test, NULL); 23 | assert(at); 24 | 25 | at_tell(at, argv[0]); 26 | ok1(at_read(at) == argv[0] + 1); 27 | talloc_free(at); 28 | 29 | return exit_status(); 30 | } 31 | -------------------------------------------------------------------------------- /ccan/argcheck/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/array_size/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/array_size/test/compile_fail-function-param.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct foo { 5 | unsigned int a, b; 6 | }; 7 | 8 | int check_parameter(const struct foo *array); 9 | int check_parameter(const struct foo *array) 10 | { 11 | #ifdef FAIL 12 | return (ARRAY_SIZE(array) == 4); 13 | #if !HAVE_TYPEOF || !HAVE_BUILTIN_TYPES_COMPATIBLE_P 14 | #error "Unfortunately we don't fail if _array_size_chk is a noop." 15 | #endif 16 | #else 17 | return sizeof(array) == 4 * sizeof(struct foo); 18 | #endif 19 | } 20 | 21 | int main(void) 22 | { 23 | return check_parameter(NULL); 24 | } 25 | -------------------------------------------------------------------------------- /ccan/array_size/test/compile_fail.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char *argv[8]) 4 | { 5 | (void)argc; 6 | (void)argv; 7 | char array[100]; 8 | #ifdef FAIL 9 | return ARRAY_SIZE(argv) + ARRAY_SIZE(array); 10 | #if !HAVE_TYPEOF || !HAVE_BUILTIN_TYPES_COMPATIBLE_P 11 | #error "Unfortunately we don't fail if _array_size_chk is a noop." 12 | #endif 13 | #else 14 | return ARRAY_SIZE(array); 15 | #endif 16 | } 17 | -------------------------------------------------------------------------------- /ccan/asearch/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/asearch/test/compile_fail-return-value-const.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | static int cmp(const char *key, const char *const *elem, void *ctx) 8 | { 9 | return strcmp(key, *elem); 10 | } 11 | 12 | int main(void) 13 | { 14 | const char key[] = "key"; 15 | const char *elems[] = { "a", "big", "list", "of", "things" }; 16 | 17 | #ifdef FAIL 18 | char **p; 19 | #if !HAVE_TYPEOF 20 | #error "Unfortunately we don't fail if no typeof." 21 | #endif 22 | #else 23 | const char **p; 24 | #endif 25 | p = asearch(key, elems, ARRAY_SIZE(elems), cmp, NULL); 26 | return p ? 0 : 1; 27 | } 28 | -------------------------------------------------------------------------------- /ccan/asearch/test/compile_fail-return-value.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | static int cmp(const char *key, char *const *elem, void *ctx) 6 | { 7 | return 0; 8 | } 9 | 10 | int main(int argc, char **argv) 11 | { 12 | const char key[] = "key"; 13 | 14 | #ifdef FAIL 15 | int **p; 16 | #if !HAVE_TYPEOF 17 | #error "Unfortunately we don't fail if no typeof." 18 | #endif 19 | #else 20 | char **p; 21 | #endif 22 | p = asearch(key, argv+1, argc-1, cmp, NULL); 23 | return p ? 0 : 1; 24 | } 25 | -------------------------------------------------------------------------------- /ccan/asearch/test/run-strings.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | static int cmp(const int *key, const char *const *elem, void *ctx) 9 | { 10 | return *key - atoi(*elem); 11 | } 12 | 13 | int main(void) 14 | { 15 | const char *args[] = { "1", "4", "7", "9" }; 16 | int key = 7; 17 | const char **p; 18 | 19 | plan_tests(1); 20 | p = asearch(&key, args, ARRAY_SIZE(args), cmp, NULL); 21 | ok1(p == &args[2]); 22 | 23 | return exit_status(); 24 | } 25 | -------------------------------------------------------------------------------- /ccan/asort/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/asort/test/compile_fail-context-type.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static int cmp(char *const *a UNNEEDED, char *const *b UNNEEDED, int *flag UNNEEDED) 5 | { 6 | return 0; 7 | } 8 | 9 | int main(int argc, char **argv) 10 | { 11 | #ifdef FAIL 12 | #if HAVE_TYPEOF && HAVE_BUILTIN_CHOOSE_EXPR && HAVE_BUILTIN_TYPES_COMPATIBLE_P 13 | char flag; 14 | #else 15 | #error "Unfortunately we don't fail if no typecheck_cb support." 16 | #endif 17 | #else 18 | int flag; 19 | #endif 20 | asort(argv+1, argc-1, cmp, &flag); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /ccan/asprintf/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/autodata/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/autodata/test/helper.c: -------------------------------------------------------------------------------- 1 | /* Check that linking together works. */ 2 | #include 3 | 4 | AUTODATA_TYPE(autostrings, char); 5 | 6 | AUTODATA(autostrings, "helper"); 7 | -------------------------------------------------------------------------------- /ccan/avl/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/base64/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/bdelta/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/bitmap/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/bitmap/_info: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | #include 3 | #include 4 | 5 | /** 6 | * bitmap - bitmap handling 7 | * 8 | * This code handles manipulation of bitmaps, arbitrary length arrays 9 | * of bits. 10 | * 11 | * License: LGPL (v2.1 or any later version) 12 | * Author: David Gibson 13 | */ 14 | int main(int argc, char *argv[]) 15 | { 16 | /* Expect exactly one argument */ 17 | if (argc != 2) 18 | return 1; 19 | 20 | if (strcmp(argv[1], "depends") == 0) { 21 | printf("ccan/endian\n"); 22 | return 0; 23 | } 24 | 25 | if (strcmp(argv[1], "testdepends") == 0) { 26 | printf("ccan/array_size\n"); 27 | printf("ccan/foreach\n"); 28 | return 0; 29 | } 30 | 31 | return 1; 32 | } 33 | -------------------------------------------------------------------------------- /ccan/bitops/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/block_pool/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/breakpoint/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/breakpoint/_info: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | #include 3 | #include 4 | 5 | /** 6 | * breakpoint - break if the program is run under gdb. 7 | * 8 | * This code allows you to insert breakpoints within a program. These will 9 | * do nothing unless your program is run under GDB. 10 | * 11 | * License: CC0 (Public domain) 12 | * 13 | * Example: 14 | * #include 15 | * 16 | * int main(void) 17 | * { 18 | * breakpoint(); 19 | * return 0; 20 | * } 21 | */ 22 | int main(int argc, char *argv[]) 23 | { 24 | /* Expect exactly one argument */ 25 | if (argc != 2) 26 | return 1; 27 | 28 | if (strcmp(argv[1], "depends") == 0) { 29 | printf("ccan/compiler\n"); 30 | return 0; 31 | } 32 | 33 | return 1; 34 | } 35 | -------------------------------------------------------------------------------- /ccan/breakpoint/breakpoint.h: -------------------------------------------------------------------------------- 1 | /* CC0 (Public domain) - see LICENSE file for details */ 2 | #ifndef CCAN_BREAKPOINT_H 3 | #define CCAN_BREAKPOINT_H 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | void breakpoint_init(void) COLD; 11 | extern bool breakpoint_initialized; 12 | extern bool breakpoint_under_debug; 13 | 14 | /** 15 | * breakpoint - stop if running under the debugger. 16 | */ 17 | static inline void breakpoint(void) 18 | { 19 | if (!breakpoint_initialized) 20 | breakpoint_init(); 21 | if (breakpoint_under_debug) 22 | kill(getpid(), SIGTRAP); 23 | } 24 | #endif /* CCAN_BREAKPOINT_H */ 25 | -------------------------------------------------------------------------------- /ccan/breakpoint/test/run.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(void) 6 | { 7 | /* This is how many tests you plan to run */ 8 | plan_tests(2); 9 | 10 | breakpoint(); 11 | 12 | ok1(breakpoint_initialized); 13 | ok1(!breakpoint_under_debug); 14 | 15 | /* This exits depending on whether all tests passed */ 16 | return exit_status(); 17 | } 18 | -------------------------------------------------------------------------------- /ccan/btree/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/build_assert/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/build_assert/test/compile_fail-expr.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | #ifdef FAIL 6 | return BUILD_ASSERT_OR_ZERO(1 == 0); 7 | #else 8 | return 0; 9 | #endif 10 | } 11 | -------------------------------------------------------------------------------- /ccan/build_assert/test/compile_fail.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | #ifdef FAIL 6 | BUILD_ASSERT(1 == 0); 7 | #endif 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /ccan/build_assert/test/compile_ok.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | BUILD_ASSERT(1 == 1); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /ccan/build_assert/test/run-BUILD_ASSERT_OR_ZERO.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) 5 | { 6 | plan_tests(1); 7 | ok1(BUILD_ASSERT_OR_ZERO(1 == 1) == 0); 8 | return exit_status(); 9 | } 10 | -------------------------------------------------------------------------------- /ccan/bytestring/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/bytestring/test/compile_fail-BYTESTRING-2.c: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | #include 4 | 5 | #include 6 | 7 | /* 8 | * BYTESTRING() can only be used safely on a literal string (or, 9 | * strictly, something whose size can be determined with ARRAY_SIZE(). 10 | * This checks that it correctly fails to compile if used on a 11 | * non-array pointer. 12 | */ 13 | int main(int argc, char *argv[]) 14 | { 15 | struct bytestring bs; 16 | const char *x = "abcde"; 17 | 18 | #ifdef FAIL 19 | bs = BYTESTRING(x); 20 | #else 21 | bs.len = 0; 22 | #endif 23 | printf("%zd %s\n", bs.len, x); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /ccan/bytestring/test/compile_fail-BYTESTRING.c: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | #include 4 | 5 | #include 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | struct bytestring bs; 10 | 11 | bs = BYTESTRING( 12 | #ifdef FAIL 13 | argv[0] 14 | #else 15 | "literal" 16 | #endif 17 | ); 18 | printf("%zd\n", bs.len); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /ccan/cast/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/cast/test/compile_fail-cast_const.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* Note: this *isn't* sizeof(char) on all platforms. */ 5 | struct char_struct { 6 | char c; 7 | }; 8 | 9 | int main(void) 10 | { 11 | char *uc; 12 | const 13 | #ifdef FAIL 14 | struct char_struct 15 | #else 16 | char 17 | #endif 18 | *p = NULL; 19 | 20 | uc = cast_const(char *, p); 21 | (void) uc; /* Suppress unused-but-set-variable warning. */ 22 | return 0; 23 | } 24 | 25 | #ifdef FAIL 26 | #if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P 27 | #error "Unfortunately we don't fail if cast_const can only use size" 28 | #endif 29 | #endif 30 | -------------------------------------------------------------------------------- /ccan/cast/test/compile_fail-cast_const2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* Note: this *isn't* sizeof(char) on all platforms. */ 5 | struct char_struct { 6 | char c; 7 | }; 8 | 9 | int main(void) 10 | { 11 | char **uc; 12 | const 13 | #ifdef FAIL 14 | struct char_struct 15 | #else 16 | char 17 | #endif 18 | **p = NULL; 19 | 20 | uc = cast_const2(char **, p); 21 | (void) uc; /* Suppress unused-but-set-variable warning. */ 22 | return 0; 23 | } 24 | 25 | #ifdef FAIL 26 | #if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P 27 | #error "Unfortunately we don't fail if cast_const can only use size" 28 | #endif 29 | #endif 30 | -------------------------------------------------------------------------------- /ccan/cast/test/compile_fail-cast_const3.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* Note: this *isn't* sizeof(char) on all platforms. */ 5 | struct char_struct { 6 | char c; 7 | }; 8 | 9 | int main(void) 10 | { 11 | char ***uc; 12 | const 13 | #ifdef FAIL 14 | struct char_struct 15 | #else 16 | char 17 | #endif 18 | ***p = NULL; 19 | 20 | uc = cast_const3(char ***, p); 21 | (void) uc; /* Suppress unused-but-set-variable warning. */ 22 | return 0; 23 | } 24 | 25 | #ifdef FAIL 26 | #if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P 27 | #error "Unfortunately we don't fail if cast_const can only use size" 28 | #endif 29 | #endif 30 | -------------------------------------------------------------------------------- /ccan/cast/test/compile_fail-cast_signed-const.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) 5 | { 6 | unsigned char *uc; 7 | #ifdef FAIL 8 | const 9 | #endif 10 | char 11 | *p = NULL; 12 | 13 | uc = cast_signed(unsigned char *, p); 14 | (void) uc; /* Suppress unused-but-set-variable warning. */ 15 | return 0; 16 | } 17 | 18 | #ifdef FAIL 19 | #if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P 20 | #error "Unfortunately we don't fail if cast_const can only use size" 21 | #endif 22 | #endif 23 | -------------------------------------------------------------------------------- /ccan/cast/test/compile_fail-cast_signed-sizesame.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* Note: this *isn't* sizeof(char) on all platforms. */ 5 | struct char_struct { 6 | char c; 7 | }; 8 | 9 | int main(void) 10 | { 11 | unsigned char *uc; 12 | #ifdef FAIL 13 | struct char_struct 14 | #else 15 | char 16 | #endif 17 | *p = NULL; 18 | 19 | uc = cast_signed(unsigned char *, p); 20 | 21 | (void) uc; /* Suppress unused-but-set-variable warning. */ 22 | return 0; 23 | } 24 | 25 | #ifdef FAIL 26 | #if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P 27 | #error "Unfortunately we don't fail if cast_signed can only use size" 28 | #endif 29 | #endif 30 | -------------------------------------------------------------------------------- /ccan/cast/test/compile_fail-cast_signed.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) 5 | { 6 | unsigned char *uc; 7 | #ifdef FAIL 8 | int 9 | #else 10 | char 11 | #endif 12 | *p = NULL; 13 | 14 | uc = cast_signed(unsigned char *, p); 15 | (void) uc; /* Suppress unused-but-set-variable warning. */ 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /ccan/cast/test/compile_fail-cast_static-2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) 5 | { 6 | char *c; 7 | #ifdef FAIL 8 | long 9 | #else 10 | char 11 | #endif 12 | *p = 0; 13 | 14 | c = cast_static(char *, p); 15 | (void) c; /* Suppress unused-but-set-variable warning. */ 16 | return 0; 17 | } 18 | 19 | #ifdef FAIL 20 | #if !HAVE_COMPOUND_LITERALS 21 | #error "Unfortunately we don't fail if cast_static is a noop" 22 | #endif 23 | #endif 24 | -------------------------------------------------------------------------------- /ccan/cast/test/compile_fail-cast_static-3.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) 5 | { 6 | char *c; 7 | #ifdef FAIL 8 | const 9 | #endif 10 | char *p = 0; 11 | 12 | c = cast_static(char *, p); 13 | (void) c; /* Suppress unused-but-set-variable warning. */ 14 | return 0; 15 | } 16 | 17 | #ifdef FAIL 18 | #if !HAVE_COMPOUND_LITERALS 19 | #error "Unfortunately we don't fail if cast_static is a noop" 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /ccan/cast/test/compile_fail-cast_static.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) 5 | { 6 | long c; 7 | #ifdef FAIL 8 | char * 9 | #else 10 | char 11 | #endif 12 | x = 0; 13 | 14 | c = cast_static(long, x); 15 | (void) c; /* Suppress unused-but-set-variable warning. */ 16 | return 0; 17 | } 18 | 19 | #ifdef FAIL 20 | #if !HAVE_COMPOUND_LITERALS 21 | #error "Unfortunately we don't fail if cast_static without compound literals" 22 | #endif 23 | #endif 24 | -------------------------------------------------------------------------------- /ccan/cast/test/compile_ok-cast_void.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void *remove_void(const void *p) 4 | { 5 | return cast_const(void *, p); 6 | } 7 | 8 | int main(void) 9 | { 10 | void *p = remove_void("foo"); 11 | return !p; 12 | } 13 | -------------------------------------------------------------------------------- /ccan/cast/test/compile_ok-static.c: -------------------------------------------------------------------------------- 1 | /* OpenIndiana's CC (aka suncc) has issues with constants: make sure 2 | * we are one! */ 3 | #include 4 | 5 | static char *p = cast_const(char *, (const char *)"hello"); 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | (void)argc; 10 | return p[0] == argv[0][0]; 11 | } 12 | -------------------------------------------------------------------------------- /ccan/ccan_tokenizer/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-3CLAUSE -------------------------------------------------------------------------------- /ccan/ccan_tokenizer/dict.h: -------------------------------------------------------------------------------- 1 | #ifndef CCAN_TOKENIZER_DICT_H 2 | #define CCAN_TOKENIZER_DICT_H 3 | 4 | #include 5 | #include 6 | //needed for freeing the struct dict* 7 | 8 | struct dict_entry { 9 | int id; 10 | const char *str; 11 | }; 12 | 13 | struct dict { 14 | struct dict_entry *zero; 15 | struct dict_entry *by_first_letter[256]; 16 | }; 17 | 18 | struct dict *dict_build(void *ctx, const struct dict_entry *entries, size_t count); 19 | struct dict_entry *dict_lookup(struct dict *dict, const char **sp, const char *e); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /ccan/ccan_tokenizer/scripts/message_dump_to_messages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sed 's/^D: /{.level=TM_DEBUG, .path="/' | 3 | sed 's/^I: /{.level=TM_INFO, .path="/' | 4 | sed 's/^W: /{.level=TM_WARN, .path="/' | 5 | sed 's/^BUG: /{.level=TM_BUG, .path="/' | 6 | sed 's/:.*/\"},/' 7 | -------------------------------------------------------------------------------- /ccan/cdump/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/cdump/tools/.gitignore: -------------------------------------------------------------------------------- 1 | cdump-enumstr 2 | -------------------------------------------------------------------------------- /ccan/charset/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/check_type/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/check_type/test/compile_fail-check_type.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char *argv[]) 4 | { 5 | (void)argc; 6 | (void)argv; 7 | #ifdef FAIL 8 | check_type(argc, char); 9 | #endif 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /ccan/check_type/test/compile_fail-check_type_unsigned.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char *argv[]) 4 | { 5 | (void)argc; 6 | (void)argv; 7 | #ifdef FAIL 8 | #if HAVE_TYPEOF 9 | check_type(argc, unsigned int); 10 | #else 11 | /* This doesn't work without typeof, so just fail */ 12 | #error "Fail without typeof" 13 | #endif 14 | #endif 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /ccan/check_type/test/compile_fail-check_types_match.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char *argv[]) 4 | { 5 | unsigned char x = argc; 6 | (void)argv; 7 | #ifdef FAIL 8 | check_types_match(argc, x); 9 | #endif 10 | return x; 11 | } 12 | -------------------------------------------------------------------------------- /ccan/check_type/test/run.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | int x = 0, y = 0; 7 | 8 | (void)argv; 9 | plan_tests(9); 10 | 11 | ok1(check_type(argc, int) == 0); 12 | ok1(check_type(&argc, int *) == 0); 13 | ok1(check_types_match(argc, argc) == 0); 14 | ok1(check_types_match(argc, x) == 0); 15 | ok1(check_types_match(&argc, &x) == 0); 16 | 17 | ok1(check_type(x++, int) == 0); 18 | ok(x == 0, "check_type does not evaluate expression"); 19 | ok1(check_types_match(x++, y++) == 0); 20 | ok(x == 0 && y == 0, "check_types_match does not evaluate expressions"); 21 | 22 | return exit_status(); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/ciniparser/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/ciniparser/test/test.ini: -------------------------------------------------------------------------------- 1 | # 2 | # This is an example of ini file 3 | # 4 | 5 | [Pizza] 6 | 7 | Ham = yes ; 8 | Mushrooms = TRUE ; 9 | Capres = 3 ; 10 | Cheese = Non ; 11 | Anchovies = 0 ; 12 | 13 | [Wine] 14 | 15 | Grape = Cabernet Sauvignon ; 16 | Year = 1989 ; 17 | Country = Spain ; 18 | Alcohol = 12.5 ; 19 | 20 | [Foo] 21 | 22 | bar = foobar ; 23 | shemp = stooge ; 24 | -------------------------------------------------------------------------------- /ccan/closefrom/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/compiler/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/compiler/test/compile_fail-printf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void PRINTF_FMT(2,3) my_printf(int x, const char *fmt, ...) 4 | { 5 | (void)x; 6 | (void)fmt; 7 | } 8 | 9 | int main(void) 10 | { 11 | unsigned int i = 0; 12 | 13 | my_printf(1, "Not a pointer " 14 | #ifdef FAIL 15 | "%p", 16 | #if !HAVE_ATTRIBUTE_PRINTF 17 | #error "Unfortunately we don't fail if !HAVE_ATTRIBUTE_PRINTF." 18 | #endif 19 | #else 20 | "%i", 21 | #endif 22 | i); 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /ccan/compiler/test/run-is_compile_constant.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | (void)argc; 7 | (void)argv; 8 | plan_tests(2); 9 | 10 | ok1(!IS_COMPILE_CONSTANT(argc)); 11 | #if HAVE_BUILTIN_CONSTANT_P 12 | ok1(IS_COMPILE_CONSTANT(7)); 13 | #else 14 | pass("If !HAVE_BUILTIN_CONSTANT_P, IS_COMPILE_CONSTANT always false"); 15 | #endif 16 | return exit_status(); 17 | } 18 | -------------------------------------------------------------------------------- /ccan/container_of/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/container_of/test/compile_fail-bad-type.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct foo { 5 | int a; 6 | char b; 7 | }; 8 | 9 | int main(void) 10 | { 11 | struct foo foo = { .a = 1, .b = 2 }; 12 | int *intp = &foo.a; 13 | char *p; 14 | 15 | #ifdef FAIL 16 | /* p is a char *, but this gives a struct foo * */ 17 | p = container_of(intp, struct foo, a); 18 | #else 19 | p = (char *)intp; 20 | #endif 21 | return p == NULL; 22 | } 23 | -------------------------------------------------------------------------------- /ccan/container_of/test/compile_fail-types.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct foo { 5 | int a; 6 | char b; 7 | }; 8 | 9 | int main(void) 10 | { 11 | struct foo foo = { .a = 1, .b = 2 }, *foop; 12 | int *intp = &foo.a; 13 | 14 | #ifdef FAIL 15 | /* b is a char, but intp is an int * */ 16 | foop = container_of(intp, struct foo, b); 17 | #else 18 | foop = NULL; 19 | #endif 20 | (void) foop; /* Suppress unused-but-set-variable warning. */ 21 | return intp == NULL; 22 | } 23 | -------------------------------------------------------------------------------- /ccan/container_of/test/compile_fail-var-types.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct foo { 5 | int a; 6 | char b; 7 | }; 8 | 9 | int main(void) 10 | { 11 | struct foo foo = { .a = 1, .b = 2 }, *foop; 12 | int *intp = &foo.a; 13 | 14 | #ifdef FAIL 15 | /* b is a char, but intp is an int * */ 16 | foop = container_of_var(intp, foop, b); 17 | #if !HAVE_TYPEOF 18 | #error "Unfortunately we don't fail if we don't have typeof." 19 | #endif 20 | #else 21 | foop = NULL; 22 | #endif 23 | (void) foop; /* Suppress unused-but-set-variable warning. */ 24 | return intp == NULL; 25 | } 26 | -------------------------------------------------------------------------------- /ccan/coroutine/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/cppmagic/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/cppmagic/_info: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | #include 3 | #include 4 | 5 | /** 6 | * cppmagic - Abuse of the C preprocessor 7 | * 8 | * This contains a bunch of fancy macro techniques such as 9 | * preprocessor-time evaluated conditionals and (quasi) recursion and 10 | * iteration. 11 | * 12 | * It's based on these articles: 13 | * - http://jhnet.co.uk/articles/cpp_magic 14 | * - https://github.com/pfultz2/Cloak/wiki/C-Preprocessor-tricks,-tips,-and-idioms 15 | * and code from the Boost C++ library. 16 | * 17 | * License: BSD-MIT 18 | */ 19 | int main(int argc, char *argv[]) 20 | { 21 | /* Expect exactly one argument */ 22 | if (argc != 2) 23 | return 1; 24 | 25 | if (strcmp(argv[1], "depends") == 0) { 26 | return 0; 27 | } 28 | 29 | return 1; 30 | } 31 | -------------------------------------------------------------------------------- /ccan/cpuid/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/cpuid/test/run.c: -------------------------------------------------------------------------------- 1 | #include "../cpuid.c" 2 | 3 | #include 4 | #include 5 | 6 | int main(void) 7 | { 8 | if (!cpuid_is_supported()) { 9 | printf ("CPUID instruction is not supported by this CPU\n"); 10 | return 1; 11 | } 12 | 13 | uint32_t info = CPUID_HIGHEST_EXTENDED_FUNCTION_SUPPORTED | CPUID_EXTENDED_L2_CACHE_FEATURES | CPUID_VIRT_PHYS_ADDR_SIZES 14 | | CPUID_PROCINFO_AND_FEATUREBITS; 15 | uint32_t featureset = CPUID_FEAT_ECX_ALL | CPUID_FEAT_EDX_ALL; 16 | if (!cpuid_write_info(info, featureset, stdout)) { 17 | printf("Failed to write CPU information!\n"); 18 | return 1; 19 | } 20 | 21 | printf("Wrote CPU information\n"); 22 | return 0; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /ccan/crc/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/GPL-2 -------------------------------------------------------------------------------- /ccan/crc32c/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/crc32c/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | CCANDIR=../../.. 2 | CFLAGS=-Wall -Werror -O3 -I$(CCANDIR) -flto 3 | #CFLAGS=-Wall -Werror -g3 -I$(CCANDIR) 4 | LDFLAGS := -flto -O3 5 | 6 | all: bench 7 | 8 | CCAN_OBJS:=ccan-tal.o ccan-tal-grab_file.o ccan-noerr.o ccan-take.o ccan-time.o 9 | 10 | bench: bench.o $(CCAN_OBJS) 11 | 12 | clean: 13 | rm -f bench *.o 14 | 15 | ccan-time.o: $(CCANDIR)/ccan/time/time.c 16 | $(CC) $(CFLAGS) -c -o $@ $< 17 | ccan-tal.o: $(CCANDIR)/ccan/tal/tal.c 18 | $(CC) $(CFLAGS) -c -o $@ $< 19 | ccan-take.o: $(CCANDIR)/ccan/take/take.c 20 | $(CC) $(CFLAGS) -c -o $@ $< 21 | ccan-noerr.o: $(CCANDIR)/ccan/noerr/noerr.c 22 | $(CC) $(CFLAGS) -c -o $@ $< 23 | ccan-tal-grab_file.o: $(CCANDIR)/ccan/tal/grab_file/grab_file.c 24 | $(CC) $(CFLAGS) -c -o $@ $< 25 | -------------------------------------------------------------------------------- /ccan/crcsync/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/crypto/hkdf_sha256/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/crypto/hkdf_sha256/_info: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | #include 3 | #include 4 | 5 | /** 6 | * crypto/hkdf_sha256 - RFC5869 Hardened Key Derivation Functions using SHA256 7 | * 8 | * This code implements the hkdf described in RFC5869. 9 | * 10 | * License: BSD-MIT 11 | * Maintainer: Rusty Russell 12 | */ 13 | int main(int argc, char *argv[]) 14 | { 15 | /* Expect exactly one argument */ 16 | if (argc != 2) 17 | return 1; 18 | 19 | if (strcmp(argv[1], "depends") == 0) { 20 | printf("ccan/crypto/hmac_sha256\n"); 21 | return 0; 22 | } 23 | 24 | if (strcmp(argv[1], "testdepends") == 0) { 25 | printf("ccan/str/hex\n"); 26 | return 0; 27 | } 28 | 29 | return 1; 30 | } 31 | -------------------------------------------------------------------------------- /ccan/crypto/hkdf_sha256/hkdf_sha256.h: -------------------------------------------------------------------------------- 1 | #ifndef CCAN_CRYPTO_HKDF_SHA256_H 2 | #define CCAN_CRYPTO_HKDF_SHA256_H 3 | /* BSD-MIT - see LICENSE file for details */ 4 | #include "config.h" 5 | #include 6 | 7 | /** 8 | * hkdf_sha256 - generate a derived key 9 | * @okm: where to output the key 10 | * @okm_size: the number of bytes pointed to by @okm (must be less than 255*32) 11 | * @s: salt 12 | * @ssize: the number of bytes pointed to by @s 13 | * @k: pointer to input key 14 | * @ksize: the number of bytes pointed to by @k 15 | * @info: pointer to info 16 | * @isize: the number of bytes pointed to by @info 17 | */ 18 | void hkdf_sha256(void *okm, size_t okm_size, 19 | const void *s, size_t ssize, 20 | const void *k, size_t ksize, 21 | const void *info, size_t isize); 22 | #endif /* CCAN_CRYPTO_HKDF_SHA256_H */ 23 | -------------------------------------------------------------------------------- /ccan/crypto/hmac_sha256/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/crypto/ripemd160/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/crypto/ripemd160/test/run-lotsa-data.c: -------------------------------------------------------------------------------- 1 | #include 2 | /* Include the C files directly. */ 3 | #include 4 | #include 5 | 6 | int main(void) 7 | { 8 | struct ripemd160 h, expected; 9 | static const char zeroes[1000]; 10 | size_t i; 11 | 12 | plan_tests(63); 13 | 14 | /* Test different alignments. */ 15 | ripemd160(&expected, zeroes, sizeof(zeroes) - 64); 16 | for (i = 1; i < 64; i++) { 17 | ripemd160(&h, zeroes + i, sizeof(zeroes) - 64); 18 | ok1(memcmp(&h, &expected, sizeof(h)) == 0); 19 | } 20 | 21 | /* This exits depending on whether all tests passed */ 22 | return exit_status(); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/crypto/sha256/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/crypto/sha256/benchmarks/Makefile: -------------------------------------------------------------------------------- 1 | CCANDIR := ../../../../ 2 | CFLAGS := -Wall -I$(CCANDIR) -O3 -flto -DCCAN_USE_ORIGINAL=1 3 | LDFLAGS := -O3 -flto 4 | 5 | INTEL_OBJS := sha256_avx1.o sha256_avx2_rorx2.o sha256_avx2_rorx8.o sha256_sse4.o 6 | 7 | double-sha-bench: double-sha-bench.o ccan-time.o $(INTEL_OBJS) #ccan-crypto-sha256.o 8 | 9 | $(INTEL_OBJS): %.o : %.asm 10 | 11 | %.o : %.asm 12 | yasm -f x64 -f elf64 -X gnu -g dwarf2 -D LINUX -o $@ $< 13 | 14 | clean: 15 | rm -f *.o 16 | 17 | ccan-crypto-sha256.o: $(CCANDIR)/ccan/crypto/sha256/sha256.c 18 | $(CC) $(CFLAGS) -c -o $@ $< 19 | ccan-time.o: $(CCANDIR)/ccan/time/time.c 20 | $(CC) $(CFLAGS) -c -o $@ $< 21 | -------------------------------------------------------------------------------- /ccan/crypto/sha256/test/run-lotsa-data.c: -------------------------------------------------------------------------------- 1 | #include 2 | /* Include the C files directly. */ 3 | #include 4 | #include 5 | 6 | int main(void) 7 | { 8 | struct sha256 h, expected; 9 | static const char zeroes[1000]; 10 | size_t i; 11 | 12 | plan_tests(63); 13 | 14 | /* Test different alignments. */ 15 | sha256(&expected, zeroes, sizeof(zeroes) - 64); 16 | for (i = 1; i < 64; i++) { 17 | sha256(&h, zeroes + i, sizeof(zeroes) - 64); 18 | ok1(memcmp(&h, &expected, sizeof(h)) == 0); 19 | } 20 | 21 | /* This exits depending on whether all tests passed */ 22 | return exit_status(); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/crypto/sha512/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/crypto/sha512/test/run-lotsa-data.c: -------------------------------------------------------------------------------- 1 | #include 2 | /* Include the C files directly. */ 3 | #include 4 | #include 5 | 6 | int main(void) 7 | { 8 | struct sha512 h, expected; 9 | static const char zeroes[1000]; 10 | size_t i; 11 | 12 | plan_tests(63); 13 | 14 | /* Test different alignments. */ 15 | sha512(&expected, zeroes, sizeof(zeroes) - 64); 16 | for (i = 1; i < 64; i++) { 17 | sha512(&h, zeroes + i, sizeof(zeroes) - 64); 18 | ok1(memcmp(&h, &expected, sizeof(h)) == 0); 19 | } 20 | 21 | /* This exits depending on whether all tests passed */ 22 | return exit_status(); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/crypto/shachain/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/crypto/shachain/tools/.gitignore: -------------------------------------------------------------------------------- 1 | shachain48 2 | -------------------------------------------------------------------------------- /ccan/crypto/siphash24/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/crypto/xtea/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/crypto/xtea/_info: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | #include 3 | #include 4 | 5 | /** 6 | * crypto/xtea - implementation of xtea algorithm. 7 | * 8 | * This code is an implementation of the simple xtea encryption/decryption 9 | * algorithm. You probably don't want to use this; try AES or chacha20 10 | * from libsodium for modern encryption routines. 11 | * 12 | * License: CC0 (Public Domain) 13 | */ 14 | int main(int argc, char *argv[]) 15 | { 16 | /* Expect exactly one argument */ 17 | if (argc != 2) 18 | return 1; 19 | 20 | if (strcmp(argv[1], "depends") == 0) { 21 | return 0; 22 | } 23 | 24 | return 1; 25 | } 26 | -------------------------------------------------------------------------------- /ccan/daemon_with_notify/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-3CLAUSE -------------------------------------------------------------------------------- /ccan/daemonize/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/daemonize/daemonize.h: -------------------------------------------------------------------------------- 1 | /* Licensed under BSD-MIT - see LICENSE file for details */ 2 | #ifndef CCAN_DAEMONIZE_H 3 | #define CCAN_DAEMONIZE_H 4 | #include 5 | 6 | /** 7 | * daemonize - turn this process into a daemon. 8 | * 9 | * This routine forks us off to become a daemon. It returns false on failure 10 | * (eg. fork(), chdir or open failed) and sets errno. 11 | * 12 | * Side effects for programmers to be aware of: 13 | * - PID changes (our parent exits, we become child of init) 14 | * - stdin and stdout file descriptors are closed 15 | * - stderr is reopened to /dev/null so you don't reuse it 16 | * - Current working directory changes to / 17 | * - Umask is set to 0. 18 | */ 19 | bool daemonize(void); 20 | 21 | #endif /* CCAN_DAEMONIZE_H */ 22 | -------------------------------------------------------------------------------- /ccan/darray/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/deque/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/APACHE-2 -------------------------------------------------------------------------------- /ccan/dgraph/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/dgraph/_info: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | #include 3 | #include 4 | 5 | /** 6 | * dgraph - simple directed graph module 7 | * 8 | * This code implements a simple directed graph, with nodes and edges. 9 | * 10 | * License: LGPL (v2.1 or any later version) 11 | */ 12 | int main(int argc, char *argv[]) 13 | { 14 | /* Expect exactly one argument */ 15 | if (argc != 2) 16 | return 1; 17 | 18 | if (strcmp(argv[1], "depends") == 0) { 19 | printf("ccan/tlist\n"); 20 | printf("ccan/typesafe_cb\n"); 21 | printf("ccan/agar\n"); 22 | return 0; 23 | } 24 | 25 | return 1; 26 | } 27 | -------------------------------------------------------------------------------- /ccan/edit_distance/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/endian/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/endian/test/compile_ok-constant.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct foo { 4 | char one[BSWAP_16(0xFF00)]; 5 | char two[BSWAP_32(0xFF000000)]; 6 | char three[BSWAP_64(0xFF00000000000000ULL)]; 7 | }; 8 | 9 | int main(void) 10 | { 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /ccan/eratosthenes/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/eratosthenes/eratosthenes.h: -------------------------------------------------------------------------------- 1 | /* Licensed under LGPLv2+ - see LICENSE file for details */ 2 | #ifndef CCAN_ERATOSTHENES_H_ 3 | #define CCAN_ERATOSTHENES_H_ 4 | 5 | #include "config.h" 6 | 7 | #include 8 | 9 | #include 10 | 11 | struct eratosthenes { 12 | unsigned long limit; 13 | bitmap *b; 14 | }; 15 | 16 | void eratosthenes_init(struct eratosthenes *s); 17 | 18 | void eratosthenes_reset(struct eratosthenes *s); 19 | 20 | void eratosthenes_sieve(struct eratosthenes *s, unsigned long limit); 21 | 22 | bool eratosthenes_isprime(const struct eratosthenes *s, unsigned long n); 23 | 24 | unsigned long eratosthenes_nextprime(const struct eratosthenes *s, 25 | unsigned long n); 26 | 27 | #endif /* CCAN_ERATOSTHENES_H_ */ 28 | -------------------------------------------------------------------------------- /ccan/err/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/failtest/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-3 -------------------------------------------------------------------------------- /ccan/fdpass/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/fdpass/fdpass.h: -------------------------------------------------------------------------------- 1 | /* CC0 license (public domain) - see LICENSE file for details */ 2 | #ifndef CCAN_FDPASS_H 3 | #define CCAN_FDPASS_H 4 | 5 | #include 6 | 7 | /** 8 | * fdpass_send - send a file descriptor across a socket 9 | * @sockout: socket to write to 10 | * @fd: file descriptor to pass 11 | * 12 | * On failure, sets errno and returns false. 13 | */ 14 | bool fdpass_send(int sockout, int fd); 15 | 16 | /** 17 | * fdpass_recv - receive a file descriptor from a socket 18 | * @sockin: socket to read from 19 | * 20 | * On failure, returns -1 and sets errno. Otherwise returns fd. 21 | */ 22 | int fdpass_recv(int sockin); 23 | #endif /* CCAN_FDPASS_H */ 24 | -------------------------------------------------------------------------------- /ccan/foreach/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-3 -------------------------------------------------------------------------------- /ccan/foreach/test/compile_ok-const.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* Iterating over const pointers should work fine. */ 5 | int main(int argc, char *argv[]) 6 | { 7 | const char *s1 = "hello", *s2 = "world", *p; 8 | unsigned int i = 0; 9 | 10 | foreach_ptr(p, s1, s2) 11 | i++; 12 | 13 | return i == 2 ? 0 : 1; 14 | } 15 | -------------------------------------------------------------------------------- /ccan/foreach/test/compile_ok-nonconst.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* Iterating const over non-const pointers should work fine. */ 5 | int main(int argc, char *argv[]) 6 | { 7 | char *p; 8 | unsigned int i = 0; 9 | 10 | foreach_ptr(p, argv[0], argv[1]) 11 | i++; 12 | 13 | return i == 2 ? 0 : 1; 14 | } 15 | -------------------------------------------------------------------------------- /ccan/foreach/test/run-break.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | static int count_iters(void) 8 | { 9 | unsigned int count = 0; 10 | #if !HAVE_COMPOUND_LITERALS || !HAVE_FOR_LOOP_DECLARATION 11 | struct iter_info *i; 12 | 13 | list_for_each(&iters, i, list) 14 | count++; 15 | #endif 16 | return count; 17 | } 18 | 19 | int main(void) 20 | { 21 | int i, j, sum; 22 | 23 | plan_tests(2); 24 | 25 | sum = 0; 26 | foreach_int(i, 0, 1, 2, 3, 4) { 27 | foreach_int(j, 0, 1, 2, 3, 4) { 28 | sum += i*j; 29 | if (j == i) 30 | break; 31 | } 32 | } 33 | ok1(sum == 65); 34 | ok1(count_iters() <= 2); 35 | 36 | return exit_status(); 37 | } 38 | 39 | -------------------------------------------------------------------------------- /ccan/foreach/test/run-single-arg.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main(void) 8 | { 9 | int i, num; 10 | const char *p; 11 | 12 | plan_tests(5); 13 | 14 | num = 0; 15 | foreach_int(i, 0) { 16 | ok1(i == 0); 17 | num++; 18 | } 19 | ok1(num == 1); 20 | 21 | num = 0; 22 | foreach_ptr(p, "hello") { 23 | ok1(strcmp("hello", p) == 0); 24 | num++; 25 | } 26 | ok1(p == NULL); 27 | ok1(num == 1); 28 | 29 | return exit_status(); 30 | } 31 | 32 | -------------------------------------------------------------------------------- /ccan/foreach/test/run.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main(void) 8 | { 9 | int i, expecti; 10 | const char *p, *expectp[] = { "hello", "there", "big", "big", "world" }; 11 | 12 | plan_tests(11); 13 | 14 | expecti = 0; 15 | foreach_int(i, 0, 1, 2, 3, 4) { 16 | ok1(i == expecti); 17 | expecti++; 18 | } 19 | 20 | expecti = 0; 21 | foreach_ptr(p, "hello", "there", "big", "big", "world") { 22 | ok1(strcmp(expectp[expecti], p) == 0); 23 | expecti++; 24 | } 25 | ok1(p == NULL); 26 | 27 | return exit_status(); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /ccan/generator/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/generator/test/compile_fail-1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include "example-gens.h" 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | #ifdef FAIL 13 | int *g = gen1(); 14 | #else 15 | generator_t(int) g = gen1(); 16 | #endif 17 | 18 | printf("%d", *generator_next(g)); 19 | 20 | exit(0); 21 | } 22 | -------------------------------------------------------------------------------- /ccan/generator/test/compile_fail-2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include "example-gens.h" 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | #ifdef FAIL 13 | generator_t(char) g = gen1(); 14 | #else 15 | generator_t(int) g = gen1(); 16 | #endif 17 | 18 | printf("%d", *generator_next(g)); 19 | 20 | exit(0); 21 | } 22 | -------------------------------------------------------------------------------- /ccan/generator/test/compile_fail-3.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include 7 | 8 | generator_def_static(intgen, int) 9 | { 10 | #ifdef FAIL 11 | generator_yield("a"); 12 | #else 13 | generator_yield(1); 14 | #endif 15 | } 16 | 17 | int main(int argc, char *argv[]) 18 | { 19 | generator_t(int) g = intgen(); 20 | 21 | printf("%d", *generator_next(g)); 22 | 23 | exit(0); 24 | } 25 | -------------------------------------------------------------------------------- /ccan/generator/test/compile_fail-4.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include "example-gens.h" 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | generator_t(int) g = gen1(); 13 | #ifdef FAIL 14 | char *val; 15 | #else 16 | int val; 17 | #endif 18 | 19 | if (generator_next_val(val, g)) 20 | printf("%d", val); 21 | 22 | exit(0); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/generator/test/compile_fail-5.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include "example-gens.h" 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | #ifdef FAIL 13 | int *g = NULL; 14 | #else 15 | generator_t(int) g = gen1(); 16 | #endif 17 | 18 | generator_free(g); 19 | 20 | exit(0); 21 | } 22 | -------------------------------------------------------------------------------- /ccan/generator/test/example-gens.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include "example-gens.h" 6 | 7 | generator_def(gen1, int) 8 | { 9 | generator_yield(1); 10 | generator_yield(3); 11 | generator_yield(17); 12 | } 13 | 14 | generator_def(gen2, int, int, base) 15 | { 16 | generator_yield(base + 1); 17 | generator_yield(base + 3); 18 | generator_yield(base + 17); 19 | } 20 | 21 | generator_def(gen3, const char *, const char *, str, int, count) 22 | { 23 | int i; 24 | 25 | for (i = 0; i < count; i++) 26 | generator_yield(str); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /ccan/generator/test/example-gens.h: -------------------------------------------------------------------------------- 1 | #ifndef _EXAMPLE_GENS_H 2 | #define _EXAMPLE_GENS_H 3 | 4 | #include 5 | 6 | generator_declare(gen1, int); 7 | generator_declare(gen2, int, int, base); 8 | generator_declare(gen3, const char *, const char *, str, int, count); 9 | 10 | #endif /* _EXAMPLE_GENS_H */ 11 | -------------------------------------------------------------------------------- /ccan/grab_file/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/graphql/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/hash/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/heap/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/htable/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/htable/test/run-clash.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | /* Clashy hash */ 8 | static size_t hash(const void *elem, void *unused UNNEEDED) 9 | { 10 | return 0; 11 | } 12 | 13 | int main(void) 14 | { 15 | struct htable ht; 16 | 17 | plan_tests(254 * 253); 18 | /* We try to get two elements which clash */ 19 | for (size_t i = 2; i < 256; i++) { 20 | for (size_t j = 2; j < 256; j++) { 21 | if (i == j) 22 | continue; 23 | htable_init(&ht, hash, NULL); 24 | htable_add(&ht, hash((void *)i, NULL), (void *)i); 25 | htable_add(&ht, hash((void *)j, NULL), (void *)j); 26 | ok1(htable_check(&ht, "test")); 27 | htable_clear(&ht); 28 | } 29 | } 30 | return exit_status(); 31 | } 32 | -------------------------------------------------------------------------------- /ccan/idtree/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/GPL-2 -------------------------------------------------------------------------------- /ccan/idtree/test/run-wrap.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | unsigned int i; 8 | struct idtree *idtree; 9 | 10 | plan_tests(6); 11 | idtree = idtree_new(NULL); 12 | 13 | ok1(idtree_add_above(idtree, &i, INT_MAX-1, INT_MAX) == INT_MAX-1); 14 | ok1(idtree_add_above(idtree, &i, INT_MAX-1, INT_MAX) == INT_MAX); 15 | ok1(idtree_add_above(idtree, &i, INT_MAX-1, INT_MAX) == -1); 16 | 17 | ok1(idtree_remove(idtree, INT_MAX-1) == true); 18 | ok1(idtree_add_above(idtree, &i, INT_MAX-1, INT_MAX) == INT_MAX-1); 19 | ok1(idtree_add_above(idtree, &i, INT_MAX-1, INT_MAX) == -1); 20 | tal_free(idtree); 21 | exit(exit_status()); 22 | } 23 | -------------------------------------------------------------------------------- /ccan/ilog/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/intmap/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/intmap/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | CCANDIR=../../.. 2 | CFLAGS=-Wall -Werror -O3 -I$(CCANDIR) -flto 3 | #CFLAGS=-Wall -Werror -g3 -I$(CCANDIR) 4 | LDFLAGS := -flto -O3 5 | 6 | all: speed 7 | 8 | CCAN_OBJS:=ccan-intmap.o ccan-time.o ccan-isaac64.o ccan-htable.o ccan-siphash24.o 9 | 10 | speed: speed.o $(CCAN_OBJS) 11 | 12 | clean: 13 | rm -f speed *.o 14 | 15 | ccan-time.o: $(CCANDIR)/ccan/time/time.c 16 | $(CC) $(CFLAGS) -c -o $@ $< 17 | ccan-intmap.o: $(CCANDIR)/ccan/intmap/intmap.c 18 | $(CC) $(CFLAGS) -c -o $@ $< 19 | ccan-isaac64.o: $(CCANDIR)/ccan/isaac/isaac64.c 20 | $(CC) $(CFLAGS) -c -o $@ $< 21 | ccan-htable.o: $(CCANDIR)/ccan/htable/htable.c 22 | $(CC) $(CFLAGS) -c -o $@ $< 23 | ccan-siphash24.o: $(CCANDIR)/ccan/crypto/siphash24/siphash24.c 24 | $(CC) $(CFLAGS) -c -o $@ $< 25 | -------------------------------------------------------------------------------- /ccan/intmap/test/run-after-fail.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(void) 6 | { 7 | UINTMAP(const char *) map; 8 | u64 idx; 9 | 10 | /* This is how many tests you plan to run */ 11 | plan_tests(2); 12 | 13 | uintmap_init(&map); 14 | assert(uintmap_add(&map, 0x103, "103")); 15 | assert(uintmap_add(&map, 0x10b, "10b")); 16 | 17 | uintmap_first(&map, &idx); 18 | ok1(idx > 0xF); 19 | idx = 0xF; 20 | ok1(strcmp(uintmap_after(&map, &idx), "103") == 0); 21 | 22 | uintmap_clear(&map); 23 | 24 | /* This exits depending on whether all tests passed */ 25 | return exit_status(); 26 | } 27 | -------------------------------------------------------------------------------- /ccan/invbloom/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/io/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/io/fdpass/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/isaac/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/iscsi/LICENCE: -------------------------------------------------------------------------------- 1 | ../../licenses/GPL-3 -------------------------------------------------------------------------------- /ccan/iscsi/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/GPL-3 -------------------------------------------------------------------------------- /ccan/iscsi/_info: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | #include 3 | #include 4 | 5 | /** 6 | * iscsi - async library for iscsi functionality 7 | * 8 | * The iscsi module is a work in progress. 9 | * 10 | * It aims to become a full async library for iscsi functionality, 11 | * including all features required to establish and maintain a iscsi 12 | * session, as well as a low level scsi library to create scsi cdb's 13 | * and parse/unmarshall data-in structures. 14 | * 15 | * License: GPL (v3 or any later version) 16 | * Author: Ronnie Sahlberg 17 | */ 18 | int main(int argc, char *argv[]) 19 | { 20 | if (argc != 2) 21 | return 1; 22 | 23 | if (strcmp(argv[1], "depends") == 0) { 24 | printf("ccan/compiler\n"); 25 | return 0; 26 | } 27 | 28 | return 1; 29 | } 30 | 31 | -------------------------------------------------------------------------------- /ccan/iscsi/test/run.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | int main(void) 13 | { 14 | struct iscsi_context *iscsi; 15 | 16 | plan_tests(2); 17 | 18 | iscsi = iscsi_create_context("some name"); 19 | ok1(iscsi); 20 | ok1(iscsi_destroy_context(iscsi) == 0); 21 | 22 | /* This exits depending on whether all tests passed */ 23 | return exit_status(); 24 | } 25 | -------------------------------------------------------------------------------- /ccan/jacobson_karels/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/jacobson_karels/_info: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | #include 3 | #include 4 | 5 | /** 6 | * jacobson_karels - Jacobson/Karels Round Trip Time algorithm 7 | * 8 | * This implements the Jacobson/Karels algorithm for estimating round 9 | * trip time and appropriate timeouts over a network link. 10 | * 11 | * Author: David Gibson 12 | * License: LGPL (v2.1 or any later version) 13 | */ 14 | int main(int argc, char *argv[]) 15 | { 16 | /* Expect exactly one argument */ 17 | if (argc != 2) 18 | return 1; 19 | 20 | if (strcmp(argv[1], "depends") == 0) { 21 | printf("ccan/minmax\n"); 22 | return 0; 23 | } 24 | 25 | return 1; 26 | } 27 | -------------------------------------------------------------------------------- /ccan/jacobson_karels/test/run-nouse.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char *argv[]) 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /ccan/jacobson_karels/test/run.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static void first_test(void) 5 | { 6 | struct jacobson_karels_state s; 7 | 8 | jacobson_karels_init(&s, 0, 0); 9 | jacobson_karels_update(&s, 200); 10 | 11 | ok1(jacobson_karels_timeout(&s, 2, 1000) == 225); 12 | } 13 | 14 | int main(void) 15 | { 16 | /* This is how many tests you plan to run */ 17 | plan_tests(1); 18 | 19 | first_test(); 20 | 21 | /* This exits depending on whether all tests passed */ 22 | return exit_status(); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/jmap/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/jmap/tools/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS=-Wall -Werror -O3 -I../../.. 2 | LDLIBS=-lJudy 3 | 4 | speed: speed.o 5 | 6 | speed.o: speed.c ../jmap.h 7 | -------------------------------------------------------------------------------- /ccan/jset/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/json/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/json/test/common.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | static char *chomp(char *s) 8 | { 9 | char *e; 10 | 11 | if (s == NULL || *s == 0) 12 | return s; 13 | 14 | e = strchr(s, 0); 15 | if (e[-1] == '\n') 16 | *--e = 0; 17 | return s; 18 | } 19 | -------------------------------------------------------------------------------- /ccan/json_escape/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/json_out/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/json_out/test/run-debugging.c: -------------------------------------------------------------------------------- 1 | #define CCAN_JSON_OUT_DEBUG 1 2 | #include "run.c" 3 | -------------------------------------------------------------------------------- /ccan/lbalance/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/GPL-3 -------------------------------------------------------------------------------- /ccan/lbalance/tools/Makefile: -------------------------------------------------------------------------------- 1 | #! /usr/bin/make 2 | CCANDIR=../../.. 3 | 4 | CCAN_OBJS:=ccan-jmap.o ccan-time.o 5 | 6 | CFLAGS=-I$(CCANDIR) -Wall -g #-O2 7 | LDLIBS=-lJudy 8 | 9 | lbalance: lbalance.c $(CCAN_OBJS) 10 | 11 | clean: 12 | rm -f lbalance $(CCAN_OBJS) 13 | 14 | ccan-jmap.o: $(CCANDIR)/ccan/jmap/jmap.c 15 | $(CC) $(CFLAGS) -c -o $@ $< 16 | 17 | ccan-time.o: $(CCANDIR)/ccan/time/time.c 18 | $(CC) $(CFLAGS) -c -o $@ $< 19 | -------------------------------------------------------------------------------- /ccan/likely/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/likely/test/run.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | static bool one_seems_likely(unsigned int val) 7 | { 8 | if (likely(val == 1)) 9 | return true; 10 | return false; 11 | } 12 | 13 | static bool one_seems_unlikely(unsigned int val) 14 | { 15 | if (unlikely(val == 1)) 16 | return true; 17 | return false; 18 | } 19 | 20 | int main(void) 21 | { 22 | plan_tests(4); 23 | 24 | /* Without debug, we can only check that it doesn't effect functions. */ 25 | ok1(one_seems_likely(1)); 26 | ok1(!one_seems_likely(2)); 27 | ok1(one_seems_unlikely(1)); 28 | ok1(!one_seems_unlikely(2)); 29 | exit(exit_status()); 30 | } 31 | -------------------------------------------------------------------------------- /ccan/list/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/list/test/helper.h: -------------------------------------------------------------------------------- 1 | /* These are in a separate C file so we can test undefined structures. */ 2 | struct opaque; 3 | typedef struct opaque opaque_t; 4 | 5 | opaque_t *create_opaque_blob(void); 6 | bool if_blobs_know_the_secret(opaque_t *blob); 7 | void destroy_opaque_blob(opaque_t *blob); 8 | 9 | 10 | -------------------------------------------------------------------------------- /ccan/list/test/run-check-nonconst.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "helper.h" 5 | 6 | struct child { 7 | const char *name; 8 | struct list_node list; 9 | }; 10 | 11 | int main(void) 12 | { 13 | struct child c1, c2; 14 | struct list_head list = LIST_HEAD_INIT(list); 15 | 16 | plan_tests(1); 17 | 18 | list_add(&list, &c1.list); 19 | list_add_tail(list_check(&list, "Bad list!"), &c2.list); 20 | list_del_from(list_check(&list, "Bad list!"), 21 | list_check_node(&c2.list, "Bad node!")); 22 | list_del_from(list_check(&list, "Bad list!"), 23 | list_check_node(&c1.list, "Bad node!")); 24 | ok1(list_empty(list_check(&list, "Bad emptied list"))); 25 | 26 | return exit_status(); 27 | } 28 | -------------------------------------------------------------------------------- /ccan/list/test/run-with-debug.c: -------------------------------------------------------------------------------- 1 | /* Just like run.c, but with all debug checks enabled. */ 2 | #define CCAN_LIST_DEBUG 1 3 | #include 4 | -------------------------------------------------------------------------------- /ccan/lpq/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/lpq/lpq.c: -------------------------------------------------------------------------------- 1 | /* GNU LGPL version 2 (or later) - see LICENSE file for details */ 2 | #include 3 | 4 | #include 5 | 6 | #include 7 | 8 | static int lpq_cmp(const struct lpq_ *pq, size_t offset, 9 | const struct lpq_link *al, const struct lpq_link *bl) 10 | { 11 | void *a = (char *)al - offset; 12 | void *b = (char *)bl - offset; 13 | 14 | return total_order_cmp(pq->order, a, b); 15 | } 16 | 17 | struct lpq_link **lpq_frontp_(struct lpq_ *pq, size_t offset) 18 | { 19 | struct lpq_link **frontp = &pq->list; 20 | struct lpq_link **p; 21 | 22 | if (lpq_empty_(pq)) 23 | return NULL; 24 | 25 | for (p = &(pq->list->next); *p; p = &(*p)->next) { 26 | if (lpq_cmp(pq, offset, *p, *frontp) >= 0) 27 | frontp = p; 28 | } 29 | 30 | return frontp; 31 | } 32 | -------------------------------------------------------------------------------- /ccan/lqueue/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/lstack/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/md4/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/GPL-2 -------------------------------------------------------------------------------- /ccan/mem/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/mem/_info: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | #include 3 | #include 4 | 5 | /** 6 | * mem - Provide mem*() functions if missing from C library 7 | * 8 | * This code implements some string.h mem*() functions if they're not 9 | * already available in the C library. Functions included are: 10 | * memmem() 11 | * 12 | * License: CC0 13 | */ 14 | int main(int argc, char *argv[]) 15 | { 16 | /* Expect exactly one argument */ 17 | if (argc != 2) 18 | return 1; 19 | 20 | if (strcmp(argv[1], "depends") == 0) { 21 | printf("ccan/compiler"); 22 | return 0; 23 | } 24 | 25 | if (strcmp(argv[1], "testdepends") == 0) { 26 | return 0; 27 | } 28 | 29 | return 1; 30 | } 31 | -------------------------------------------------------------------------------- /ccan/mem/bench/.gitignore: -------------------------------------------------------------------------------- 1 | speed 2 | -------------------------------------------------------------------------------- /ccan/mem/bench/Makefile: -------------------------------------------------------------------------------- 1 | CCANDIR=../../.. 2 | CFLAGS=-Wall -Werror -O3 -I$(CCANDIR) 3 | #CFLAGS=-Wall -Werror -g -I$(CCANDIR) 4 | 5 | all: speed 6 | 7 | CCAN_OBJS:=ccan-mem.o ccan-time.o 8 | 9 | speed: speed.o $(CCAN_OBJS) 10 | 11 | clean: 12 | rm -f speed *.o 13 | 14 | ccan-time.o: $(CCANDIR)/ccan/time/time.c 15 | $(CC) $(CFLAGS) -c -o $@ $< 16 | ccan-mem.o: $(CCANDIR)/ccan/mem/mem.c 17 | $(CC) $(CFLAGS) -c -o $@ $< 18 | -------------------------------------------------------------------------------- /ccan/mem/test/api-memcheck.c: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | int main(void) 9 | { 10 | char haystack[] = "abcd\0efgh"; 11 | char *p; 12 | const char *pc; 13 | 14 | /* This is how many tests you plan to run */ 15 | plan_tests(4); 16 | 17 | p = memcheck(haystack, sizeof(haystack)); 18 | ok1(p == haystack); 19 | pc = memcheck(haystack, sizeof(haystack)); 20 | ok1(pc == haystack); 21 | p = memcheck(p, sizeof(haystack)); 22 | ok1(p == haystack); 23 | pc = memcheck(pc, sizeof(haystack)); 24 | ok1(pc == haystack); 25 | 26 | /* This exits depending on whether all tests passed */ 27 | return exit_status(); 28 | } 29 | -------------------------------------------------------------------------------- /ccan/mem/test/compile_fail-memcheck.c: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | #include 4 | #include 5 | 6 | int main(void) 7 | { 8 | const char *haystack = "abcd\0efgh"; 9 | char *p; 10 | 11 | #ifdef FAIL 12 | #if !HAVE_TYPEOF 13 | #error "Can't fail without typeof" 14 | #else 15 | /* Should catch const discard errors. */ 16 | p = memcheck(haystack, sizeof(haystack)); 17 | #endif 18 | #else 19 | p = memcheck((char *)haystack, sizeof(haystack)); 20 | #endif 21 | 22 | return p == haystack ? 0 : 1; 23 | } 24 | -------------------------------------------------------------------------------- /ccan/membuf/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/minmax/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/minmax/test/compile_fail-wrongsign.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static int function(void) 4 | { 5 | #ifdef FAIL 6 | return min(1, 1U); 7 | #if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P 8 | #error "Unfortunately we don't fail if the typechecks are noops." 9 | #endif 10 | #else 11 | return 0; 12 | #endif 13 | } 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | function(); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /ccan/minmax/test/compile_fail-wrongsize.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static int function(void) 4 | { 5 | #ifdef FAIL 6 | return min(1, 1L); 7 | #if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P 8 | #error "Unfortunately we don't fail if the typechecks are noops." 9 | #endif 10 | #else 11 | return 0; 12 | #endif 13 | } 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | function(); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /ccan/net/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/net/tools/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS=-g -Wall -W -I../../.. 2 | 3 | test-net: test-net.o net.o noerr.o 4 | 5 | net.o: ../net.c 6 | $(COMPILE.c) $(OUTPUT_OPTION) $< 7 | 8 | noerr.o: ../../noerr/noerr.c 9 | $(COMPILE.c) $(OUTPUT_OPTION) $< 10 | -------------------------------------------------------------------------------- /ccan/nfs/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/GPL-3 -------------------------------------------------------------------------------- /ccan/nfs/libnfs-raw-nfsacl.c: -------------------------------------------------------------------------------- 1 | /* Licensed under GPLv3+ - see LICENSE file for details */ 2 | /* 3 | * Please do not edit this file. 4 | * It was generated using rpcgen. 5 | */ 6 | 7 | #include "rpc/nfsacl.h" 8 | -------------------------------------------------------------------------------- /ccan/nfs/rpc/nfsacl.x: -------------------------------------------------------------------------------- 1 | /* deducted from wireshark traces */ 2 | 3 | 4 | program NFSACL_PROGRAM { 5 | version NFSACL_V3 { 6 | void NFSACL3_NULL(void) = 0; 7 | } = 3; 8 | } = 100227; 9 | -------------------------------------------------------------------------------- /ccan/nfs/rpc/portmap.x: -------------------------------------------------------------------------------- 1 | /* 2 | * From RFC1833 3 | */ 4 | 5 | const PMAP_PORT = 111; /* portmapper port number */ 6 | 7 | struct mapping { 8 | unsigned int prog; 9 | unsigned int vers; 10 | unsigned int prot; 11 | unsigned int port; 12 | }; 13 | 14 | struct call_args { 15 | unsigned int prog; 16 | unsigned int vers; 17 | unsigned int proc; 18 | opaque args<>; 19 | }; 20 | 21 | 22 | program PMAP_PROGRAM { 23 | version PMAP_V2 { 24 | void 25 | PMAP_NULL(void) = 0; 26 | 27 | bool 28 | PMAP_SET(mapping) = 1; 29 | 30 | bool 31 | PMAP_UNSET(mapping) = 2; 32 | 33 | unsigned int 34 | PMAP_GETPORT(mapping) = 3; 35 | } = 2; 36 | } = 100000; 37 | 38 | -------------------------------------------------------------------------------- /ccan/noerr/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/objset/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/ogg_to_pcm/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/GPL-2 -------------------------------------------------------------------------------- /ccan/opt/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/GPL-2 -------------------------------------------------------------------------------- /ccan/opt/test/compile_ok-const-arg.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main(void) 8 | { 9 | opt_register_noarg("-v", opt_version_and_exit, 10 | (const char *)"1.2.3", 11 | (const char *)"Print version"); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /ccan/opt/test/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef CCAN_OPT_TEST_UTILS_H 2 | #define CCAN_OPT_TEST_UTILS_H 3 | #include 4 | #include 5 | 6 | bool parse_args(int *argc, char ***argv, ...); 7 | bool parse_early_args(int *argc, char ***argv, ...); 8 | bool parse_early_args_incomplete(int *argc, char ***argv, ...); 9 | extern char *err_output; 10 | void save_err_output(const char *fmt, ...); 11 | void reset_options(void); 12 | 13 | extern unsigned int test_cb_called; 14 | char *test_noarg(void *arg); 15 | char *test_arg(const char *optarg, const char *arg); 16 | bool show_arg(char *buf, size_t len, const char *arg); 17 | 18 | extern struct opt_table short_table[]; 19 | extern struct opt_table long_table[]; 20 | extern struct opt_table long_and_short_table[]; 21 | extern struct opt_table subtables[]; 22 | #endif /* CCAN_OPT_TEST_UTILS_H */ 23 | -------------------------------------------------------------------------------- /ccan/order/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/order/test/compile_fail_1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include "fancy_cmp.h" 8 | 9 | #ifdef FAIL 10 | typedef int item_t; 11 | #else 12 | typedef struct item item_t; 13 | #endif 14 | 15 | int main(void) 16 | { 17 | total_order_cb(cb0, struct item, struct cmp_info *) = fancy_cmp; 18 | _total_order_cb cb1 = total_order_cast(fancy_cmp, 19 | item_t, struct cmp_info *); 20 | 21 | printf("%p %p\n", cb0, cb1); 22 | 23 | exit(0); 24 | } 25 | -------------------------------------------------------------------------------- /ccan/order/test/compile_fail_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include "fancy_cmp.h" 8 | 9 | #ifdef FAIL 10 | typedef int ctx_t; 11 | #else 12 | typedef struct cmp_info ctx_t; 13 | #endif 14 | 15 | int main(void) 16 | { 17 | total_order_cb(cb0, struct item, struct cmp_info *) = fancy_cmp; 18 | _total_order_cb cb1 = total_order_cast(fancy_cmp, struct item, 19 | ctx_t *); 20 | 21 | printf("%p %p\n", cb0, cb1); 22 | 23 | exit(0); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /ccan/order/test/compile_ok.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include "fancy_cmp.h" 8 | 9 | int main(void) 10 | { 11 | total_order_cb(cb0, struct item, struct cmp_info *) = fancy_cmp; 12 | _total_order_cb cb1 = total_order_cast(fancy_cmp, 13 | struct item, struct cmp_info *); 14 | total_order_noctx_cb cb_noctx = fancy_cmp_noctx; 15 | 16 | printf("%p %p %p\n", cb0, cb1, cb_noctx); 17 | 18 | exit(0); 19 | } 20 | -------------------------------------------------------------------------------- /ccan/permutation/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/pipecmd/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/pr_log/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/pr_log/test/run-debug.c: -------------------------------------------------------------------------------- 1 | #define DEBUG 1 2 | #include 3 | #include 4 | #include 5 | 6 | int main(void) 7 | { 8 | plan_tests(6); 9 | debug = 3; 10 | ok1(!debug_is(4)); 11 | debug = 1; 12 | ok1(debug_is(0)); 13 | ok1(debug_is(1)); 14 | ok1(!debug_is(2)); 15 | ok1(!debug_is(3)); 16 | 17 | pr_emerg("Emerg\n"); 18 | pr_alert("Alert\n"); 19 | pr_crit("Crit\n"); 20 | pr_error("Error\n"); 21 | pr_warn("Warn\n"); 22 | pr_notice("Notice\n"); 23 | pr_info("Info\n"); 24 | pr_debug("Debug\n"); 25 | 26 | pr_devel("Devel\n"); 27 | 28 | debug = INT_MIN; 29 | setenv("DEBUG", "1", 1); 30 | ok1(debug_is(1)); 31 | 32 | /* malformed check */ 33 | pr_log_(":4> 1\n"); 34 | pr_log_(" 2\n"); 35 | pr_log_("<1} 3\n"); 36 | 37 | return exit_status(); 38 | } 39 | -------------------------------------------------------------------------------- /ccan/pr_log/test/run-disable.c: -------------------------------------------------------------------------------- 1 | #define CCAN_PR_LOG_DISABLE 1 2 | #include 3 | #include 4 | #include 5 | 6 | int main(void) 7 | { 8 | plan_tests(7); 9 | ok1(!debug_is(4)); 10 | ok1(!debug_is(0)); 11 | ok1(!debug_is(1)); 12 | ok1(!debug_is(2)); 13 | ok1(!debug_is(3)); 14 | 15 | pr_emerg("Emerg\n"); 16 | pr_alert("Alert\n"); 17 | pr_crit("Crit\n"); 18 | pr_error("Error\n"); 19 | pr_warn("Warn\n"); 20 | pr_notice("Notice\n"); 21 | pr_info("Info\n"); 22 | pr_debug("Debug\n"); 23 | 24 | pr_devel("Devel\n"); 25 | 26 | setenv("DEBUG", "1", 1); 27 | ok1(!debug_is(1)); 28 | 29 | /* malformed check */ 30 | pr_log_(":4> 1\n"); 31 | pr_log_(" 2\n"); 32 | pr_log_("<1} 3\n"); 33 | 34 | ok1(debug_level() == -1); 35 | 36 | return exit_status(); 37 | } 38 | -------------------------------------------------------------------------------- /ccan/ptr_valid/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/ptr_valid/_info: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | #include 3 | #include 4 | 5 | /** 6 | * ptr_valid - test whether a pointer is safe to dereference. 7 | * 8 | * This little helper tells you if an address is mapped; it doesn't tell you 9 | * if it's read-only (or execute only). 10 | * 11 | * License: BSD-MIT 12 | * 13 | * Ccanlint: 14 | * // Our child actually crashes, but that's OK! 15 | * tests_pass_valgrind test/run.c:--child-silent-after-fork=yes 16 | */ 17 | int main(int argc, char *argv[]) 18 | { 19 | /* Expect exactly one argument */ 20 | if (argc != 2) 21 | return 1; 22 | 23 | if (strcmp(argv[1], "depends") == 0) { 24 | printf("ccan/noerr\n"); 25 | return 0; 26 | } 27 | 28 | return 1; 29 | } 30 | -------------------------------------------------------------------------------- /ccan/ptrint/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/ptrint/test/run.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | static ptrdiff_t testvals[] = { 9 | -INT_MAX, -1, 0, 1, 2, 17, INT_MAX, 10 | }; 11 | 12 | int main(void) 13 | { 14 | int i; 15 | 16 | /* This is how many tests you plan to run */ 17 | plan_tests(2 * ARRAY_SIZE(testvals)); 18 | 19 | for (i = 0; i < ARRAY_SIZE(testvals); i++) { 20 | ptrdiff_t val = testvals[i]; 21 | void *ptr = int2ptr(val); 22 | 23 | ok1(ptr2int(ptr) == val); 24 | ok1(!val == !ptr); 25 | } 26 | 27 | /* This exits depending on whether all tests passed */ 28 | return exit_status(); 29 | } 30 | -------------------------------------------------------------------------------- /ccan/pushpull/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/pushpull/pushpull.h: -------------------------------------------------------------------------------- 1 | /* CC0 license (public domain) - see LICENSE file for details */ 2 | #ifndef CCAN_PUSHPULL_H 3 | #define CCAN_PUSHPULL_H 4 | /* You can also include these independently, if you don't need both. */ 5 | #include 6 | #include 7 | #endif /* CCAN_PUSHPULL_H */ 8 | -------------------------------------------------------------------------------- /ccan/rbtree/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/GPL-3 -------------------------------------------------------------------------------- /ccan/rbuf/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/rbuf/test/run-open.c: -------------------------------------------------------------------------------- 1 | #include 2 | /* Include the C files directly. */ 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | int main(void) 11 | { 12 | struct rbuf in; 13 | 14 | /* This is how many tests you plan to run */ 15 | plan_tests(5); 16 | 17 | ok1(!rbuf_open(&in, "nonexistent-file", NULL, 0, NULL)); 18 | ok1(errno == ENOENT); 19 | ok1(rbuf_open(&in, "test/run-open.c", NULL, 0, NULL)); 20 | ok1(close(in.fd) == 0); 21 | /* If this fails to stat, it should fall back */ 22 | ok1(rbuf_good_size(in.fd) == 4096); 23 | 24 | return exit_status(); 25 | } 26 | -------------------------------------------------------------------------------- /ccan/read_write_all/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/read_write_all/read_write_all.h: -------------------------------------------------------------------------------- 1 | /* Licensed under LGPLv2+ - see LICENSE file for details */ 2 | #ifndef _CCAN_READ_WRITE_H 3 | #define _CCAN_READ_WRITE_H 4 | #include 5 | #include 6 | 7 | bool write_all(int fd, const void *data, size_t size); 8 | bool read_all(int fd, void *data, size_t size); 9 | 10 | #endif /* _CCAN_READ_WRITE_H */ 11 | -------------------------------------------------------------------------------- /ccan/rfc822/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/rfc822/examples/.gitignore: -------------------------------------------------------------------------------- 1 | headernames 2 | -------------------------------------------------------------------------------- /ccan/rfc822/examples/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS= -I../../.. ../../rfc822.o \ 2 | ../../talloc/talloc.o ../../grab_file/grab_file.o \ 3 | ../../list/list.o ../../noerr/noerr.o 4 | 5 | EXAMPLES = headernames 6 | 7 | all: $(EXAMPLES) 8 | 9 | clean: 10 | rm -f $(EXAMPLES) 11 | -------------------------------------------------------------------------------- /ccan/rfc822/test/helper.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void failtest_setup(int argc, char *argv[]); 4 | void allocation_failure_check(void); 5 | 6 | #define CHECK_HEADER_NUMTESTS 4 7 | void check_header(struct rfc822_msg *msg, struct rfc822_header *h, 8 | const char *name, const char *val, 9 | enum rfc822_header_errors experr, int crlf); 10 | -------------------------------------------------------------------------------- /ccan/rszshm/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/APACHE-2 -------------------------------------------------------------------------------- /ccan/rune/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/rune/internal.h: -------------------------------------------------------------------------------- 1 | #ifndef CCAN_RUNE_INTERNAL_H 2 | #define CCAN_RUNE_INTERNAL_H 3 | /* MIT (BSD) license - see LICENSE file for details */ 4 | void rune_sha256_endmarker(struct sha256_ctx *shactx); 5 | void rune_sha256_add_restr(struct sha256_ctx *shactx, 6 | struct rune_restr *restr); 7 | bool runestr_eq(const char *a, const char *b); 8 | #endif /* CCAN_RUNE_INTERNAL_H */ 9 | -------------------------------------------------------------------------------- /ccan/short_types/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/short_types/test/run-endian.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main(void) 8 | { 9 | plan_tests(6); 10 | 11 | ok1(sizeof(be64) == 8); 12 | ok1(sizeof(be32) == 4); 13 | ok1(sizeof(be16) == 2); 14 | 15 | ok1(sizeof(le64) == 8); 16 | ok1(sizeof(le32) == 4); 17 | ok1(sizeof(le16) == 2); 18 | 19 | return exit_status(); 20 | } 21 | -------------------------------------------------------------------------------- /ccan/short_types/test/run.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main(void) 7 | { 8 | plan_tests(16); 9 | 10 | ok1(sizeof(u64) == 8); 11 | ok1(sizeof(s64) == 8); 12 | ok1(sizeof(u32) == 4); 13 | ok1(sizeof(s32) == 4); 14 | ok1(sizeof(u16) == 2); 15 | ok1(sizeof(s16) == 2); 16 | ok1(sizeof(u8) == 1); 17 | ok1(sizeof(s8) == 1); 18 | 19 | /* Signedness tests. */ 20 | ok1((u64)-1 > 0); 21 | ok1((u32)-1 > 0); 22 | ok1((u16)-1 > 0); 23 | ok1((u8)-1 > 0); 24 | ok1((s64)-1 < 0); 25 | ok1((s32)-1 < 0); 26 | ok1((s16)-1 < 0); 27 | ok1((s8)-1 < 0); 28 | 29 | return exit_status(); 30 | } 31 | -------------------------------------------------------------------------------- /ccan/siphash/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/GPL-2 -------------------------------------------------------------------------------- /ccan/sparse_bsearch/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/str/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/str/base32/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/str/base32/_info: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | #include 3 | #include 4 | 5 | /** 6 | * str/base32 - RFC4648 base32 encoder/decoder. 7 | * 8 | * This code implements RFC4638 encoding, but you should use bech32 for most 9 | * things anyway. 10 | * 11 | * License: CC0 (Public domain) 12 | * Author: Rusty Russell 13 | */ 14 | int main(int argc, char *argv[]) 15 | { 16 | /* Expect exactly one argument */ 17 | if (argc != 2) 18 | return 1; 19 | 20 | if (strcmp(argv[1], "depends") == 0) { 21 | printf("ccan/endian\n"); 22 | return 0; 23 | } 24 | 25 | return 1; 26 | } 27 | -------------------------------------------------------------------------------- /ccan/str/hex/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/str/str.c: -------------------------------------------------------------------------------- 1 | /* CC0 (Public domain) - see LICENSE file for details */ 2 | #include 3 | 4 | size_t strcount(const char *haystack, const char *needle) 5 | { 6 | size_t i = 0, nlen = strlen(needle); 7 | 8 | while ((haystack = strstr(haystack, needle)) != NULL) { 9 | i++; 10 | haystack += nlen; 11 | } 12 | return i; 13 | } 14 | -------------------------------------------------------------------------------- /ccan/str/test/compile_fail-STR_MAX_CHARS.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct s { 4 | int val; 5 | }; 6 | 7 | int main(void) 8 | { 9 | struct s 10 | #ifdef FAIL 11 | #if !HAVE_TYPEOF 12 | #error We need typeof to check STR_MAX_CHARS. 13 | #endif 14 | #else 15 | /* A pointer is OK. */ 16 | * 17 | #endif 18 | val; 19 | char str[STR_MAX_CHARS(val)]; 20 | 21 | str[0] = '\0'; 22 | return str[0] ? 0 : 1; 23 | } 24 | -------------------------------------------------------------------------------- /ccan/str/test/compile_fail-isalnum.c: -------------------------------------------------------------------------------- 1 | #define CCAN_STR_DEBUG 1 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | (void)argc; 7 | #ifdef FAIL 8 | #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF 9 | #error We need typeof to check isalnum. 10 | #endif 11 | char 12 | #else 13 | unsigned char 14 | #endif 15 | c = argv[0][0]; 16 | 17 | #ifdef FAIL 18 | /* Fake fail on unsigned char platforms. */ 19 | BUILD_ASSERT((char)255 < 0); 20 | #endif 21 | 22 | return isalnum(c); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/str/test/compile_fail-isalpha.c: -------------------------------------------------------------------------------- 1 | #define CCAN_STR_DEBUG 1 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | (void)argc; 7 | #ifdef FAIL 8 | #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF 9 | #error We need typeof to check isalpha. 10 | #endif 11 | char 12 | #else 13 | unsigned char 14 | #endif 15 | c = argv[0][0]; 16 | 17 | #ifdef FAIL 18 | /* Fake fail on unsigned char platforms. */ 19 | BUILD_ASSERT((char)255 < 0); 20 | #endif 21 | 22 | return isalpha(c); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/str/test/compile_fail-isascii.c: -------------------------------------------------------------------------------- 1 | #define CCAN_STR_DEBUG 1 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | (void)argc; 7 | #ifdef FAIL 8 | #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF 9 | #error We need typeof to check isascii. 10 | #endif 11 | char 12 | #else 13 | unsigned char 14 | #endif 15 | c = argv[0][0]; 16 | 17 | #ifdef FAIL 18 | /* Fake fail on unsigned char platforms. */ 19 | BUILD_ASSERT((char)255 < 0); 20 | #endif 21 | 22 | return isascii(c); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/str/test/compile_fail-isblank.c: -------------------------------------------------------------------------------- 1 | #define CCAN_STR_DEBUG 1 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | (void)argc; 7 | #ifdef FAIL 8 | #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF || !HAVE_ISBLANK 9 | #error We need typeof to check isblank. 10 | #endif 11 | char 12 | #else 13 | unsigned char 14 | #endif 15 | c = argv[0][0]; 16 | 17 | #ifdef FAIL 18 | /* Fake fail on unsigned char platforms. */ 19 | BUILD_ASSERT((char)255 < 0); 20 | #endif 21 | 22 | #if HAVE_ISBLANK 23 | return isblank(c); 24 | #else 25 | return c; 26 | #endif 27 | } 28 | -------------------------------------------------------------------------------- /ccan/str/test/compile_fail-iscntrl.c: -------------------------------------------------------------------------------- 1 | #define CCAN_STR_DEBUG 1 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | (void)argc; 7 | #ifdef FAIL 8 | #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF 9 | #error We need typeof to check iscntrl. 10 | #endif 11 | char 12 | #else 13 | unsigned char 14 | #endif 15 | c = argv[0][0]; 16 | 17 | #ifdef FAIL 18 | /* Fake fail on unsigned char platforms. */ 19 | BUILD_ASSERT((char)255 < 0); 20 | #endif 21 | 22 | return iscntrl(c); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/str/test/compile_fail-isdigit.c: -------------------------------------------------------------------------------- 1 | #define CCAN_STR_DEBUG 1 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | (void)argc; 7 | #ifdef FAIL 8 | #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF 9 | #error We need typeof to check isdigit. 10 | #endif 11 | char 12 | #else 13 | unsigned char 14 | #endif 15 | c = argv[0][0]; 16 | 17 | #ifdef FAIL 18 | /* Fake fail on unsigned char platforms. */ 19 | BUILD_ASSERT((char)255 < 0); 20 | #endif 21 | 22 | return isdigit(c); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/str/test/compile_fail-islower.c: -------------------------------------------------------------------------------- 1 | #define CCAN_STR_DEBUG 1 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | (void)argc; 7 | #ifdef FAIL 8 | #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF 9 | #error We need typeof to check islower. 10 | #endif 11 | char 12 | #else 13 | unsigned char 14 | #endif 15 | c = argv[0][0]; 16 | 17 | #ifdef FAIL 18 | /* Fake fail on unsigned char platforms. */ 19 | BUILD_ASSERT((char)255 < 0); 20 | #endif 21 | 22 | return islower(c); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/str/test/compile_fail-isprint.c: -------------------------------------------------------------------------------- 1 | #define CCAN_STR_DEBUG 1 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | (void)argc; 7 | #ifdef FAIL 8 | #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF 9 | #error We need typeof to check isprint. 10 | #endif 11 | char 12 | #else 13 | unsigned char 14 | #endif 15 | c = argv[0][0]; 16 | 17 | #ifdef FAIL 18 | /* Fake fail on unsigned char platforms. */ 19 | BUILD_ASSERT((char)255 < 0); 20 | #endif 21 | 22 | return isprint(c); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/str/test/compile_fail-ispunct.c: -------------------------------------------------------------------------------- 1 | #define CCAN_STR_DEBUG 1 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | (void)argc; 7 | #ifdef FAIL 8 | #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF 9 | #error We need typeof to check ispunct. 10 | #endif 11 | char 12 | #else 13 | unsigned char 14 | #endif 15 | c = argv[0][0]; 16 | 17 | #ifdef FAIL 18 | /* Fake fail on unsigned char platforms. */ 19 | BUILD_ASSERT((char)255 < 0); 20 | #endif 21 | 22 | return ispunct(c); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/str/test/compile_fail-isspace.c: -------------------------------------------------------------------------------- 1 | #define CCAN_STR_DEBUG 1 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | (void)argc; 7 | #ifdef FAIL 8 | #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF 9 | #error We need typeof to check isspace. 10 | #endif 11 | char 12 | #else 13 | unsigned char 14 | #endif 15 | c = argv[0][0]; 16 | 17 | #ifdef FAIL 18 | /* Fake fail on unsigned char platforms. */ 19 | BUILD_ASSERT((char)255 < 0); 20 | #endif 21 | 22 | return isspace(c); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/str/test/compile_fail-isupper.c: -------------------------------------------------------------------------------- 1 | #define CCAN_STR_DEBUG 1 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | (void)argc; 7 | #ifdef FAIL 8 | #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF 9 | #error We need typeof to check isupper. 10 | #endif 11 | char 12 | #else 13 | unsigned char 14 | #endif 15 | c = argv[0][0]; 16 | 17 | #ifdef FAIL 18 | /* Fake fail on unsigned char platforms. */ 19 | BUILD_ASSERT((char)255 < 0); 20 | #endif 21 | 22 | return isupper(c); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/str/test/compile_fail-isxdigit.c: -------------------------------------------------------------------------------- 1 | #define CCAN_STR_DEBUG 1 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | (void)argc; 7 | #ifdef FAIL 8 | #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF 9 | #error We need typeof to check isxdigit. 10 | #endif 11 | char 12 | #else 13 | unsigned char 14 | #endif 15 | c = argv[0][0]; 16 | 17 | #ifdef FAIL 18 | /* Fake fail on unsigned char platforms. */ 19 | BUILD_ASSERT((char)255 < 0); 20 | #endif 21 | 22 | return isxdigit(c); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/str/test/compile_fail-strchr.c: -------------------------------------------------------------------------------- 1 | #define CCAN_STR_DEBUG 1 2 | #include 3 | 4 | int main(void) 5 | { 6 | #ifdef FAIL 7 | #if !HAVE_TYPEOF 8 | #error We need typeof to check strstr. 9 | #endif 10 | #else 11 | const 12 | #endif 13 | char *ret; 14 | const char *str = "hello"; 15 | 16 | ret = strchr(str, 'l'); 17 | return ret ? 0 : 1; 18 | } 19 | -------------------------------------------------------------------------------- /ccan/str/test/compile_fail-strrchr.c: -------------------------------------------------------------------------------- 1 | #define CCAN_STR_DEBUG 1 2 | #include 3 | 4 | int main(void) 5 | { 6 | #ifdef FAIL 7 | #if !HAVE_TYPEOF 8 | #error We need typeof to check strstr. 9 | #endif 10 | #else 11 | const 12 | #endif 13 | char *ret; 14 | const char *str = "hello"; 15 | 16 | ret = strrchr(str, 'l'); 17 | return ret ? 0 : 1; 18 | } 19 | -------------------------------------------------------------------------------- /ccan/str/test/compile_fail-strstr.c: -------------------------------------------------------------------------------- 1 | #define CCAN_STR_DEBUG 1 2 | #include 3 | 4 | int main(void) 5 | { 6 | #ifdef FAIL 7 | #if !HAVE_TYPEOF 8 | #error We need typeof to check strstr. 9 | #endif 10 | #else 11 | const 12 | #endif 13 | char *ret; 14 | const char *str = "hello"; 15 | 16 | ret = strstr(str, "hell"); 17 | return ret ? 0 : 1; 18 | } 19 | -------------------------------------------------------------------------------- /ccan/str/test/compile_ok-STR_MAX_CHARS-static.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | static char str[STR_MAX_CHARS(int)]; 6 | 7 | return str[0] ? 0 : 1; 8 | } 9 | -------------------------------------------------------------------------------- /ccan/str/test/debug.c: -------------------------------------------------------------------------------- 1 | /* We can't use the normal "#include the .c file" trick, since this is 2 | contaminated by str.h's macro overrides. So we put it in all tests 3 | like this. */ 4 | #define CCAN_STR_DEBUG 1 5 | #include 6 | -------------------------------------------------------------------------------- /ccan/strgrp/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-3 -------------------------------------------------------------------------------- /ccan/strgrp/test/api_all_similar_insert_two.c: -------------------------------------------------------------------------------- 1 | #include "../test/helpers.h" 2 | 3 | int main(void) { 4 | struct strgrp *ctx; 5 | create(ctx, 0); 6 | return one_group_from_two(ctx, "a", NULL, "b", NULL); 7 | } 8 | -------------------------------------------------------------------------------- /ccan/strgrp/test/api_almost_different_25_insert_two.c: -------------------------------------------------------------------------------- 1 | #include "../test/helpers.h" 2 | 3 | int main(void) { 4 | struct strgrp *ctx; 5 | create(ctx, 0.25); 6 | return one_group_from_two(ctx, "abcde", NULL, "zyxab", NULL); 7 | } 8 | -------------------------------------------------------------------------------- /ccan/strgrp/test/api_almost_different_50_insert_two.c: -------------------------------------------------------------------------------- 1 | #include "../test/helpers.h" 2 | 3 | int main(void) { 4 | struct strgrp *ctx; 5 | create(ctx, 0.50); 6 | return one_group_from_two(ctx, "abcde", NULL, "zyabc", NULL); 7 | } 8 | -------------------------------------------------------------------------------- /ccan/strgrp/test/api_almost_different_75_insert_two.c: -------------------------------------------------------------------------------- 1 | #include "../test/helpers.h" 2 | 3 | int main(void) { 4 | struct strgrp *ctx; 5 | create(ctx, 0.50); 6 | return one_group_from_two(ctx, "abcde", NULL, "zabcd", NULL); 7 | } 8 | -------------------------------------------------------------------------------- /ccan/strgrp/test/api_almost_similar_25_insert_two.c: -------------------------------------------------------------------------------- 1 | #include "../test/helpers.h" 2 | 3 | int main(void) { 4 | struct strgrp *ctx; 5 | create(ctx, 0.25); 6 | return two_groups_from_two(ctx, "abcde", NULL, "zyxwa", NULL); 7 | } 8 | -------------------------------------------------------------------------------- /ccan/strgrp/test/api_almost_similar_50_insert_two.c: -------------------------------------------------------------------------------- 1 | #include "../test/helpers.h" 2 | 3 | int main(void) { 4 | struct strgrp *ctx; 5 | create(ctx, 0.50); 6 | return two_groups_from_two(ctx, "abcde", NULL, "zyxab", NULL); 7 | } 8 | -------------------------------------------------------------------------------- /ccan/strgrp/test/api_almost_similar_75_insert_two.c: -------------------------------------------------------------------------------- 1 | #include "../test/helpers.h" 2 | 3 | int main(void) { 4 | struct strgrp *ctx; 5 | create(ctx, 0.75); 6 | return two_groups_from_two(ctx, "abcde", NULL, "zyabc", NULL); 7 | } 8 | -------------------------------------------------------------------------------- /ccan/strgrp/test/api_exact_match_insert_two.c: -------------------------------------------------------------------------------- 1 | #include "../test/helpers.h" 2 | 3 | int main(void) { 4 | struct strgrp *ctx; 5 | create(ctx, 1.0); 6 | return one_group_from_two(ctx, "a", NULL, "a", NULL); 7 | } 8 | -------------------------------------------------------------------------------- /ccan/strgrp/test/api_illegal_none_similar_insert_two.c: -------------------------------------------------------------------------------- 1 | #include "../test/helpers.h" 2 | 3 | int main(void) { 4 | struct strgrp *ctx; 5 | create(ctx, 1.1); 6 | return one_group_from_two(ctx, "a", NULL, "a", NULL); 7 | } 8 | -------------------------------------------------------------------------------- /ccan/strgrp/test/api_insert_duplicate.c: -------------------------------------------------------------------------------- 1 | #include "../test/helpers.h" 2 | 3 | int main(void) { 4 | struct strgrp *ctx; 5 | create(ctx, DEFAULT_SIMILARITY); 6 | return one_group_from_two(ctx, "a", (void *)"1", "a", (void *)"2"); 7 | } 8 | -------------------------------------------------------------------------------- /ccan/strgrp/test/api_insert_one.c: -------------------------------------------------------------------------------- 1 | #include "../test/helpers.h" 2 | 3 | int main(void) { 4 | const char k[] = "a"; 5 | struct strgrp *ctx; 6 | const struct strgrp_grp *grp; 7 | struct strgrp_grp_iter *iter; 8 | const struct strgrp_item *item; 9 | 10 | plan_tests(5); 11 | create(ctx, DEFAULT_SIMILARITY); 12 | grp = strgrp_add(ctx, k, NULL); 13 | ok1(streq(k, strgrp_grp_key(grp))); 14 | iter = strgrp_grp_iter_new(grp); 15 | item = strgrp_grp_iter_next(iter); 16 | ok1(item); 17 | ok1(streq(k, strgrp_item_key(item))); 18 | ok1(!strgrp_item_value(item)); 19 | ok1(!strgrp_grp_iter_next(iter)); 20 | strgrp_grp_iter_free(iter); 21 | strgrp_free(ctx); 22 | return exit_status(); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/strgrp/test/api_insert_two_distinct.c: -------------------------------------------------------------------------------- 1 | #include "../test/helpers.h" 2 | 3 | int main(void) { 4 | struct strgrp *ctx; 5 | create(ctx, DEFAULT_SIMILARITY); 6 | return two_groups_from_two(ctx, "a", NULL, "b", NULL); 7 | } 8 | -------------------------------------------------------------------------------- /ccan/strgrp/test/api_iterate_no_groups.c: -------------------------------------------------------------------------------- 1 | #include "../test/helpers.h" 2 | 3 | int main(void) { 4 | struct strgrp *ctx; 5 | struct strgrp_iter *iter; 6 | 7 | plan_tests(1); 8 | create(ctx, DEFAULT_SIMILARITY); 9 | iter = strgrp_iter_new(ctx); 10 | ok1(!strgrp_iter_next(iter)); 11 | strgrp_iter_free(iter); 12 | strgrp_free(ctx); 13 | return exit_status(); 14 | } 15 | -------------------------------------------------------------------------------- /ccan/strgrp/test/api_iterate_one_group.c: -------------------------------------------------------------------------------- 1 | #include "../test/helpers.h" 2 | 3 | int main(void) { 4 | struct strgrp *ctx; 5 | struct strgrp_iter *iter; 6 | 7 | plan_tests(2); 8 | create(ctx, DEFAULT_SIMILARITY); 9 | strgrp_add(ctx, "a", NULL); 10 | iter = strgrp_iter_new(ctx); 11 | ok1(strgrp_iter_next(iter)); 12 | ok1(!strgrp_iter_next(iter)); 13 | strgrp_iter_free(iter); 14 | strgrp_free(ctx); 15 | return exit_status(); 16 | } 17 | -------------------------------------------------------------------------------- /ccan/strgrp/test/api_iterate_two_groups.c: -------------------------------------------------------------------------------- 1 | #include "../test/helpers.h" 2 | 3 | int main(void) { 4 | struct strgrp *ctx; 5 | struct strgrp_iter *iter; 6 | 7 | plan_tests(3); 8 | create(ctx, DEFAULT_SIMILARITY); 9 | strgrp_add(ctx, "a", NULL); 10 | strgrp_add(ctx, "b", NULL); 11 | iter = strgrp_iter_new(ctx); 12 | ok1(strgrp_iter_next(iter)); 13 | ok1(strgrp_iter_next(iter)); 14 | ok1(!strgrp_iter_next(iter)); 15 | strgrp_iter_free(iter); 16 | strgrp_free(ctx); 17 | return exit_status(); 18 | } 19 | -------------------------------------------------------------------------------- /ccan/strgrp/test/api_new_free.c: -------------------------------------------------------------------------------- 1 | #include "../test/helpers.h" 2 | 3 | int main(void) { 4 | struct strgrp *ctx; 5 | 6 | plan_tests(1); 7 | create(ctx, DEFAULT_SIMILARITY); 8 | strgrp_free(ctx); 9 | pass("Successfully initialised strgrp instance"); 10 | return exit_status(); 11 | } 12 | -------------------------------------------------------------------------------- /ccan/strgrp/test/api_test_free_cb.c: -------------------------------------------------------------------------------- 1 | #include "../test/helpers.h" 2 | 3 | static void 4 | data_cb(void *data) { 5 | ok1(streq("1", (char *)data)); 6 | } 7 | 8 | int main(void) { 9 | struct strgrp *ctx; 10 | 11 | plan_tests(1); 12 | create(ctx, DEFAULT_SIMILARITY); 13 | strgrp_add(ctx, "a", (void *)"1"); 14 | strgrp_free_cb(ctx, &data_cb); 15 | return exit_status(); 16 | } 17 | -------------------------------------------------------------------------------- /ccan/strgrp/test/api_test_print.c: -------------------------------------------------------------------------------- 1 | #include "../test/helpers.h" 2 | 3 | int main(void) { 4 | struct strgrp *ctx; 5 | 6 | plan_tests(1); 7 | create(ctx, DEFAULT_SIMILARITY); 8 | strgrp_add(ctx, "a", (void *)"1"); 9 | strgrp_add(ctx, "a", (void *)"2"); 10 | strgrp_add(ctx, "b", (void *)"3"); 11 | strgrp_print(ctx); 12 | strgrp_free(ctx); 13 | pass("No errors"); 14 | return exit_status(); 15 | } 16 | -------------------------------------------------------------------------------- /ccan/strgrp/test/helpers.h: -------------------------------------------------------------------------------- 1 | #ifndef STRGRP_TEST_HELPERS 2 | #define STRGRP_TEST_HELPERS 3 | #include 4 | #include "ccan/str/str.h" 5 | #include "ccan/tap/tap.h" 6 | #include "../strgrp.h" 7 | 8 | #define DEFAULT_SIMILARITY 0.85 9 | 10 | #define create(dst, similarity) \ 11 | do { \ 12 | dst = strgrp_new(similarity); \ 13 | if (!dst) { \ 14 | fail("strgrp_new() returned NULL reference"); \ 15 | return 1; \ 16 | } \ 17 | } while (0) 18 | 19 | int 20 | one_group_from_two(struct strgrp *ctx, 21 | const char *const k1, void *v1, 22 | const char *const k2, void *v2); 23 | 24 | int 25 | two_groups_from_two(struct strgrp *ctx, 26 | const char *const k1, void *v1, 27 | const char *const k2, void *v2); 28 | 29 | #endif /* STRGRP_TEST_HELPERS */ 30 | -------------------------------------------------------------------------------- /ccan/stringbuilder/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/stringmap/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-3CLAUSE -------------------------------------------------------------------------------- /ccan/strmap/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/strmap/test/run-iterate-const.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static bool found = false; 6 | 7 | /* Make sure const args work. */ 8 | static bool find_string(const char *str UNNEEDED, char *member, const char *cmp) 9 | { 10 | if (strcmp(member, cmp) == 0) 11 | found = true; 12 | return false; 13 | } 14 | 15 | int main(void) 16 | { 17 | STRMAP(char *) map; 18 | 19 | plan_tests(3); 20 | 21 | strmap_init(&map); 22 | ok1(strmap_add(&map, "hello", "hello")); 23 | ok1(strmap_add(&map, "world", "world")); 24 | strmap_iterate(&map, find_string, (const char *)"hello"); 25 | ok1(found); 26 | strmap_clear(&map); 27 | 28 | /* This exits depending on whether all tests passed */ 29 | return exit_status(); 30 | } 31 | -------------------------------------------------------------------------------- /ccan/strset/test/run-iterate-const.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static bool found = false; 6 | 7 | /* Make sure const args work. */ 8 | static bool find_string(const char *str, const char *cmp) 9 | { 10 | if (strcmp(str, cmp) == 0) 11 | found = true; 12 | return true; 13 | } 14 | 15 | int main(void) 16 | { 17 | struct strset set; 18 | 19 | plan_tests(3); 20 | 21 | strset_init(&set); 22 | ok1(strset_add(&set, "hello")); 23 | ok1(strset_add(&set, "world")); 24 | strset_iterate(&set, find_string, (const char *)"hello"); 25 | ok1(found); 26 | strset_clear(&set); 27 | 28 | /* This exits depending on whether all tests passed */ 29 | return exit_status(); 30 | } 31 | -------------------------------------------------------------------------------- /ccan/structeq/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/structeq/test/compile_fail-different.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct mydata1 { 4 | int start, end; 5 | }; 6 | 7 | struct mydata2 { 8 | int start, end; 9 | }; 10 | 11 | STRUCTEQ_DEF(mydata1, 0, start, end); 12 | 13 | int main(void) 14 | { 15 | struct mydata1 a = { 0, 100 }; 16 | #ifdef FAIL 17 | struct mydata2 18 | #else 19 | struct mydata1 20 | #endif 21 | b = { 0, 100 }; 22 | 23 | return mydata1_eq(&a, &b); 24 | } 25 | -------------------------------------------------------------------------------- /ccan/structeq/test/compile_fail-expect-any-padding.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct mydata { 4 | int start, end; 5 | int pad; 6 | }; 7 | #ifdef FAIL 8 | #define PADDING -1 /* We have more than 1 byte padding */ 9 | #else 10 | #define PADDING sizeof(int) 11 | #endif 12 | 13 | STRUCTEQ_DEF(mydata, PADDING, start, end); 14 | 15 | int main(void) 16 | { 17 | struct mydata a = { 0, 100 }; 18 | 19 | return mydata_eq(&a, &a); 20 | } 21 | -------------------------------------------------------------------------------- /ccan/structeq/test/compile_fail-expect-padding.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct mydata { 4 | int start, end; 5 | }; 6 | #ifdef FAIL 7 | #define PADDING 1 8 | #else 9 | #define PADDING 0 10 | #endif 11 | 12 | STRUCTEQ_DEF(mydata, PADDING, start, end); 13 | 14 | int main(void) 15 | { 16 | struct mydata a = { 0, 100 }; 17 | 18 | return mydata_eq(&a, &a); 19 | } 20 | -------------------------------------------------------------------------------- /ccan/structeq/test/compile_fail-unexpceted-padding.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct mydata { 4 | int start, end; 5 | int pad; 6 | }; 7 | #ifdef FAIL 8 | #define PADDING 0 9 | #else 10 | #define PADDING sizeof(int) 11 | #endif 12 | 13 | STRUCTEQ_DEF(mydata, PADDING, start, end); 14 | 15 | int main(void) 16 | { 17 | struct mydata a = { 0, 100 }; 18 | 19 | return mydata_eq(&a, &a); 20 | } 21 | -------------------------------------------------------------------------------- /ccan/structeq/test/compile_fail-unexpected-negative-padding.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct mydata { 4 | int start, end; 5 | int pad; 6 | }; 7 | #ifdef FAIL 8 | #define PADDING -1 9 | #else 10 | #define PADDING -(int)sizeof(int) 11 | #endif 12 | 13 | STRUCTEQ_DEF(mydata, PADDING, start, end); 14 | 15 | int main(void) 16 | { 17 | struct mydata a = { 0, 100 }; 18 | 19 | return mydata_eq(&a, &a); 20 | } 21 | -------------------------------------------------------------------------------- /ccan/structeq/test/run-with-padding.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* In theory, this could be generated without padding, if alignof(int) were 0, 5 | * and test would fail. Call me when that happens. */ 6 | struct mydata { 7 | char start; 8 | int end; 9 | }; 10 | 11 | STRUCTEQ_DEF(mydata, sizeof(int) - sizeof(char), start, end); 12 | 13 | int main(void) 14 | { 15 | struct mydata a, b; 16 | 17 | /* This is how many tests you plan to run */ 18 | plan_tests(3); 19 | 20 | a.start = 0; 21 | a.end = 100; 22 | ok1(mydata_eq(&a, &a)); 23 | 24 | b = a; 25 | ok1(mydata_eq(&a, &b)); 26 | 27 | b.end++; 28 | ok1(!mydata_eq(&a, &b)); 29 | 30 | /* This exits depending on whether all tests passed */ 31 | return exit_status(); 32 | } 33 | -------------------------------------------------------------------------------- /ccan/structeq/test/run.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct mydata { 5 | int start, end; 6 | }; 7 | 8 | STRUCTEQ_DEF(mydata, 0, start, end); 9 | 10 | int main(void) 11 | { 12 | struct mydata a, b; 13 | 14 | /* This is how many tests you plan to run */ 15 | plan_tests(3); 16 | 17 | a.start = 0; 18 | a.end = 100; 19 | ok1(mydata_eq(&a, &a)); 20 | 21 | b = a; 22 | ok1(mydata_eq(&a, &b)); 23 | 24 | b.end++; 25 | ok1(!mydata_eq(&a, &b)); 26 | 27 | /* This exits depending on whether all tests passed */ 28 | return exit_status(); 29 | } 30 | -------------------------------------------------------------------------------- /ccan/take/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/take/test/run-debug.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define CCAN_TAKE_DEBUG 1 5 | #include 6 | #include 7 | #include 8 | 9 | int main(void) 10 | { 11 | const char *p = "hi"; 12 | 13 | plan_tests(14); 14 | 15 | /* We can take NULL. */ 16 | ok1(take(NULL) == NULL); 17 | ok1(is_taken(NULL)); 18 | ok1(strstr(taken_any(), "run-debug.c:16:")); 19 | ok1(taken(NULL)); /* Undoes take() */ 20 | ok1(!is_taken(NULL)); 21 | ok1(!taken(NULL)); 22 | ok1(!taken_any()); 23 | 24 | /* We can take a real pointer. */ 25 | ok1(take(p) == p); 26 | ok1(is_taken(p)); 27 | ok1(strends(taken_any(), "run-debug.c:25:p")); 28 | ok1(taken(p)); /* Undoes take() */ 29 | ok1(!is_taken(p)); 30 | ok1(!taken(p)); 31 | ok1(!taken_any()); 32 | 33 | return exit_status(); 34 | } 35 | -------------------------------------------------------------------------------- /ccan/tal/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/tal/autoptr/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/tal/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS=-O3 -Wall -flto -I../../.. 2 | #CFLAGS=-O3 -Wall -I../../.. 3 | #CFLAGS=-g -Wall -I../../.. 4 | LDFLAGS=-O3 -flto 5 | LDLIBS=-lrt 6 | 7 | all: speed samba-allocs 8 | 9 | speed: speed.o tal.o talloc.o time.o list.o take.o str.o 10 | samba-allocs: samba-allocs.o tal.o talloc.o time.o list.o take.o 11 | 12 | tal.o: ../tal.c 13 | $(CC) $(CFLAGS) -c -o $@ $< 14 | str.o: ../str/str.c 15 | $(CC) $(CFLAGS) -c -o $@ $< 16 | talloc.o: ../../talloc/talloc.c 17 | $(CC) $(CFLAGS) -c -o $@ $< 18 | time.o: ../../time/time.c 19 | $(CC) $(CFLAGS) -c -o $@ $< 20 | list.o: ../../list/list.c 21 | $(CC) $(CFLAGS) -c -o $@ $< 22 | take.o: ../../take/take.c 23 | $(CC) $(CFLAGS) -c -o $@ $< 24 | 25 | clean: 26 | rm -f speed samba-allocs *.o 27 | -------------------------------------------------------------------------------- /ccan/tal/grab_file/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/tal/link/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/tal/path/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/tal/path/test/run-ext_off.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(void) 6 | { 7 | plan_tests(9); 8 | 9 | ok1(path_ext_off("foo") == 3); 10 | ok1(path_ext_off(".foo") == 4); 11 | ok1(path_ext_off("bar.foo") == 3); 12 | ok1(path_ext_off("bar/foo") == 7); 13 | ok1(path_ext_off("bar/.foo") == 8); 14 | ok1(path_ext_off(".bar/foo") == 8); 15 | ok1(path_ext_off("foo.bar/foo") == 11); 16 | ok1(path_ext_off("foo.bar/foo.") == 11); 17 | ok1(path_ext_off("foo.bar/foo..") == 12); 18 | return exit_status(); 19 | } 20 | -------------------------------------------------------------------------------- /ccan/tal/path/test/run-is_abs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(void) 6 | { 7 | plan_tests(5); 8 | 9 | ok1(path_is_abs(PATH_SEP_STR "foo")); 10 | ok1(!path_is_abs("foo")); 11 | ok1(!path_is_abs("foo" PATH_SEP_STR)); 12 | 13 | ok1(path_is_abs(PATH_SEP_STR "foo" PATH_SEP_STR)); 14 | ok1(path_is_abs(PATH_SEP_STR ".")); 15 | return exit_status(); 16 | } 17 | -------------------------------------------------------------------------------- /ccan/tal/stack/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/tal/stack/stack.c: -------------------------------------------------------------------------------- 1 | /* Licensed under BSD-MIT - see LICENSE file for details */ 2 | 3 | #include 4 | #include 5 | 6 | static tal_t *h = NULL; 7 | 8 | static void _free_frame(tal_t *o) 9 | { 10 | h = tal_parent(o); 11 | } 12 | 13 | tal_t *tal_newframe_(const char *label) 14 | { 15 | h = tal_label(h, char, label); 16 | assert(h != NULL); 17 | tal_add_destructor(h, _free_frame); 18 | return h; 19 | } 20 | 21 | tal_t *tal_curframe(void) 22 | { 23 | return h; 24 | } 25 | -------------------------------------------------------------------------------- /ccan/tal/str/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/tal/str/test/helper.h: -------------------------------------------------------------------------------- 1 | /* tal/talloc can't implement tal_first/tal_next. */ 2 | #ifdef TAL_USE_TALLOC 3 | static inline bool no_children(const void *ctx) 4 | { 5 | return talloc_total_blocks(ctx) == 1; 6 | } 7 | 8 | static inline bool single_child(const void *ctx, const void *child) 9 | { 10 | return talloc_total_blocks(ctx) == 2 && tal_parent(child) == ctx; 11 | } 12 | #else 13 | static inline bool no_children(const void *ctx) 14 | { 15 | return !tal_first(ctx); 16 | } 17 | 18 | static inline bool single_child(const void *ctx, const void *child) 19 | { 20 | return tal_first(ctx) == child && !tal_next(child) && !tal_first(child); 21 | } 22 | #endif 23 | -------------------------------------------------------------------------------- /ccan/tal/str/test/run-fmt-terminate.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "helper.h" 7 | 8 | /* Empty format string: should still terminate! */ 9 | int main(void) 10 | { 11 | char *str; 12 | const char *fmt = ""; 13 | 14 | plan_tests(2); 15 | /* GCC complains about empty format string, complains about non-literal 16 | * with no args... */ 17 | str = tal_fmt(NULL, fmt, ""); 18 | ok1(!strcmp(str, "")); 19 | ok1(tal_count(str) == strlen(str) + 1); 20 | tal_free(str); 21 | 22 | return exit_status(); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/tal/str/test/run-strndup.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "helper.h" 7 | 8 | int main(void) 9 | { 10 | char *str, *copy; 11 | 12 | plan_tests(2); 13 | str = malloc(5); 14 | memcpy(str, "hello", 5); 15 | /* We should be fine to strndup src without nul terminator. */ 16 | copy = tal_strndup(NULL, str, 5); 17 | ok1(!strcmp(copy, "hello")); 18 | ok1(tal_count(copy) == strlen(copy) + 1); 19 | tal_free(copy); 20 | free(str); 21 | 22 | return exit_status(); 23 | } 24 | -------------------------------------------------------------------------------- /ccan/tal/talloc/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../licenses/LGPL-3 -------------------------------------------------------------------------------- /ccan/tal/talloc/test/run-count.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(void) 6 | { 7 | char *p1, *p2; 8 | 9 | plan_tests(12); 10 | 11 | p1 = tal(NULL, char); 12 | ok1(p1); 13 | ok1(tal_count(p1) == 1); 14 | 15 | p2 = tal_arr(p1, char, 1); 16 | ok1(p2); 17 | ok1(tal_count(p2) == 1); 18 | ok1(tal_resize(&p2, 2)); 19 | ok1(tal_count(p2) == 2); 20 | ok1(tal_check(NULL, NULL)); 21 | tal_free(p2); 22 | 23 | p2 = tal_arrz(p1, char, 7); 24 | ok1(p2); 25 | ok1(tal_count(p2) == 7); 26 | ok1(tal_resize(&p2, 0)); 27 | ok1(tal_count(p2) == 0); 28 | ok1(tal_check(NULL, NULL)); 29 | tal_free(p2); 30 | tal_free(p1); 31 | 32 | return exit_status(); 33 | } 34 | -------------------------------------------------------------------------------- /ccan/tal/talloc/test/run-expand.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(void) 6 | { 7 | int *a; 8 | const int arr[] = { 1, 2 }; 9 | 10 | plan_tests(14); 11 | talloc_enable_null_tracking_no_autofree(); 12 | 13 | a = tal_arrz(NULL, int, 1); 14 | ok1(a); 15 | 16 | ok1(tal_expand(&a, arr, 2)); 17 | ok1(tal_count(a) == 3); 18 | ok1(a[0] == 0); 19 | ok1(a[1] == 1); 20 | ok1(a[2] == 2); 21 | 22 | ok1(tal_expand(&a, take(tal_arrz(NULL, int, 1)), 1)); 23 | ok1(tal_count(a) == 4); 24 | ok1(a[0] == 0); 25 | ok1(a[1] == 1); 26 | ok1(a[2] == 2); 27 | ok1(a[3] == 0); 28 | ok1(talloc_total_blocks(NULL) == 2); 29 | ok1(talloc_total_blocks(a) == 1); 30 | 31 | tal_free(a); 32 | 33 | talloc_disable_null_tracking(); 34 | return exit_status(); 35 | } 36 | -------------------------------------------------------------------------------- /ccan/tal/talloc/test/run-free.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | static void destroy_errno(char *p) 7 | { 8 | errno = ENOENT; 9 | } 10 | 11 | int main(void) 12 | { 13 | char *p; 14 | 15 | plan_tests(2); 16 | 17 | p = tal(NULL, char); 18 | ok1(tal_add_destructor(p, destroy_errno)); 19 | 20 | /* Errno save/restored across free. */ 21 | errno = EINVAL; 22 | tal_free(p); 23 | ok1(errno == EINVAL); 24 | 25 | return exit_status(); 26 | } 27 | -------------------------------------------------------------------------------- /ccan/tal/talloc/test/run-named-nolabels.c: -------------------------------------------------------------------------------- 1 | #define CCAN_TAL_NO_LABELS 2 | #include 3 | #include 4 | #include 5 | 6 | int main(void) 7 | { 8 | int *p; 9 | char name[] = "test name"; 10 | 11 | plan_tests(5); 12 | 13 | p = tal(NULL, int); 14 | ok1(tal_name(p) == NULL); 15 | 16 | tal_set_name(p, "some literal"); 17 | ok1(strcmp(tal_name(p), "some literal") == 0); 18 | 19 | tal_set_name(p, name); 20 | ok1(strcmp(tal_name(p), name) == 0); 21 | /* You can't reuse my pointer though! */ 22 | ok1(tal_name(p) != name); 23 | 24 | tal_set_name(p, "some other literal"); 25 | ok1(strcmp(tal_name(p), "some other literal") == 0); 26 | 27 | tal_free(p); 28 | 29 | return exit_status(); 30 | } 31 | -------------------------------------------------------------------------------- /ccan/tal/talloc/test/run-named.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(void) 6 | { 7 | int *p; 8 | char name[] = "test name"; 9 | 10 | plan_tests(6); 11 | 12 | p = tal(NULL, int); 13 | ok1(strcmp(tal_name(p), "int") == 0); 14 | 15 | tal_set_name(p, "some literal"); 16 | ok1(strcmp(tal_name(p), "some literal") == 0); 17 | 18 | tal_set_name(p, name); 19 | ok1(strcmp(tal_name(p), name) == 0); 20 | /* You can't reuse my pointer though! */ 21 | ok1(tal_name(p) != name); 22 | 23 | tal_set_name(p, "some other literal"); 24 | ok1(strcmp(tal_name(p), "some other literal") == 0); 25 | 26 | tal_free(p); 27 | 28 | p = tal_arr(NULL, int, 2); 29 | ok1(strcmp(tal_name(p), "int[]") == 0); 30 | tal_free(p); 31 | 32 | return exit_status(); 33 | } 34 | -------------------------------------------------------------------------------- /ccan/tal/test/run-expand.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(void) 6 | { 7 | int *a; 8 | const int arr[] = { 1, 2 }; 9 | 10 | plan_tests(13); 11 | 12 | a = tal_arrz(NULL, int, 1); 13 | ok1(a); 14 | 15 | ok1(tal_expand(&a, arr, 2)); 16 | ok1(tal_count(a) == 3); 17 | ok1(a[0] == 0); 18 | ok1(a[1] == 1); 19 | ok1(a[2] == 2); 20 | 21 | ok1(tal_expand(&a, take(tal_arrz(NULL, int, 1)), 1)); 22 | ok1(tal_count(a) == 4); 23 | ok1(a[0] == 0); 24 | ok1(a[1] == 1); 25 | ok1(a[2] == 2); 26 | ok1(a[3] == 0); 27 | ok1(tal_first(NULL) == a && !tal_next(a) && !tal_first(a)); 28 | 29 | tal_free(a); 30 | 31 | tal_cleanup(); 32 | return exit_status(); 33 | } 34 | -------------------------------------------------------------------------------- /ccan/tal/test/run-free.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static void destroy_errno(char *p UNNEEDED) 6 | { 7 | /* Errno restored for all the destructors. */ 8 | ok1(errno == EINVAL); 9 | errno = ENOENT; 10 | } 11 | 12 | int main(void) 13 | { 14 | char *p; 15 | 16 | plan_tests(5); 17 | 18 | p = tal(NULL, char); 19 | ok1(tal_add_destructor(p, destroy_errno)); 20 | ok1(tal_add_destructor(p, destroy_errno)); 21 | 22 | /* Errno save/restored across free. */ 23 | errno = EINVAL; 24 | tal_free(p); 25 | ok1(errno == EINVAL); 26 | 27 | tal_cleanup(); 28 | return exit_status(); 29 | } 30 | -------------------------------------------------------------------------------- /ccan/tal/test/run-named-nolabels.c: -------------------------------------------------------------------------------- 1 | #define CCAN_TAL_NO_LABELS 2 | #include 3 | #include 4 | #include 5 | 6 | int main(void) 7 | { 8 | int *p; 9 | char name[] = "test name"; 10 | 11 | plan_tests(5); 12 | 13 | p = tal(NULL, int); 14 | ok1(tal_name(p) == NULL); 15 | 16 | tal_set_name(p, "some literal"); 17 | ok1(strcmp(tal_name(p), "some literal") == 0); 18 | 19 | tal_set_name(p, name); 20 | ok1(strcmp(tal_name(p), name) == 0); 21 | /* You can't reuse my pointer though! */ 22 | ok1(tal_name(p) != name); 23 | 24 | tal_set_name(p, "some other literal"); 25 | ok1(strcmp(tal_name(p), "some other literal") == 0); 26 | 27 | tal_free(p); 28 | 29 | tal_cleanup(); 30 | return exit_status(); 31 | } 32 | -------------------------------------------------------------------------------- /ccan/tal/test/run-named.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(void) 6 | { 7 | int *p; 8 | char name[] = "test name"; 9 | 10 | plan_tests(6); 11 | 12 | p = tal(NULL, int); 13 | ok1(strcmp(tal_name(p), "int") == 0); 14 | 15 | tal_set_name(p, "some literal"); 16 | ok1(strcmp(tal_name(p), "some literal") == 0); 17 | 18 | tal_set_name(p, name); 19 | ok1(strcmp(tal_name(p), name) == 0); 20 | /* You can't reuse my pointer though! */ 21 | ok1(tal_name(p) != name); 22 | 23 | tal_set_name(p, "some other literal"); 24 | ok1(strcmp(tal_name(p), "some other literal") == 0); 25 | 26 | tal_free(p); 27 | 28 | p = tal_arr(NULL, int, 2); 29 | ok1(strcmp(tal_name(p), "int[]") == 0); 30 | tal_free(p); 31 | 32 | tal_cleanup(); 33 | return exit_status(); 34 | } 35 | -------------------------------------------------------------------------------- /ccan/tal/test/run-resizez.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(void) 6 | { 7 | char *parent, *c; 8 | int i; 9 | 10 | plan_tests(1 + 3 * 100 + 98); 11 | 12 | parent = tal(NULL, char); 13 | ok1(parent); 14 | 15 | for (i = 0; i < 100; i++) { 16 | c = tal_arr(parent, char, 1); 17 | ok1(tal_resizez(&c, i)); 18 | ok1(tal_count(c) == i); 19 | ok1(tal_parent(c) == parent); 20 | if (i > 1) 21 | ok1(c[i-1] == '\0'); 22 | } 23 | tal_free(parent); 24 | 25 | tal_cleanup(); 26 | return exit_status(); 27 | } 28 | -------------------------------------------------------------------------------- /ccan/talloc/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/talloc/test/compile_fail-talloc_set.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | int *p; 6 | 7 | talloc_set( 8 | #ifdef FAIL 9 | p 10 | #else 11 | &p 12 | #endif 13 | , NULL); 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /ccan/talloc/test/run-corruption1.c: -------------------------------------------------------------------------------- 1 | /* failtest with valgrind caught this read-after-free. */ 2 | #include 3 | #include 4 | #include 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | void *root, *p1; 9 | 10 | plan_tests(2); 11 | talloc_enable_null_tracking(); 12 | root = talloc_new(NULL); 13 | p1 = talloc_strdup(root, "foo"); 14 | talloc_increase_ref_count(p1); 15 | talloc_free(root); 16 | ok1(strcmp(p1, "foo") == 0); 17 | talloc_unlink(NULL, p1); 18 | 19 | /* This closes the leak, but make sure we're not freeing unexpected. */ 20 | ok1(!talloc_chunk_from_ptr(null_context)->child); 21 | talloc_disable_null_tracking(); 22 | 23 | return exit_status(); 24 | } 25 | -------------------------------------------------------------------------------- /ccan/talloc/test/run-test_autofree.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static int destroy_int(int *p) 6 | { 7 | ok1(*p == 7); 8 | _exit(0); 9 | } 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | int *p; 14 | 15 | /* If autofree context doesn't work, we won't run all tests! */ 16 | plan_tests(1); 17 | 18 | p = talloc(talloc_autofree_context(), int); 19 | *p = 7; 20 | talloc_set_destructor(p, destroy_int); 21 | 22 | /* Note! We fail here, unless destructor called! */ 23 | exit(1); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /ccan/tally/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-3 -------------------------------------------------------------------------------- /ccan/tally/test/run-divlu64.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) 5 | { 6 | unsigned int i, j; 7 | 8 | plan_tests(5985); 9 | /* Simple tests. */ 10 | for (i = 0; i < 127; i++) { 11 | uint64_t u1, u0; 12 | if (i < 64) { 13 | u1 = 0; 14 | u0 = 1ULL << i; 15 | j = 0; 16 | } else { 17 | u1 = 1ULL << (i - 64); 18 | u0 = 0; 19 | j = i - 63; 20 | } 21 | for (; j < 63; j++) { 22 | uint64_t answer; 23 | if (j > i) 24 | answer = 0; 25 | else 26 | answer = 1ULL << (i - j); 27 | ok1(divlu64(u1, u0, 1ULL << j) == answer); 28 | } 29 | } 30 | return exit_status(); 31 | } 32 | -------------------------------------------------------------------------------- /ccan/tally/test/run-mean.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) 5 | { 6 | int i; 7 | struct tally *tally = tally_new(0); 8 | ssize_t min, max; 9 | 10 | max = (ssize_t)~(1ULL << (sizeof(max)*CHAR_BIT - 1)); 11 | min = (ssize_t)(1ULL << (sizeof(max)*CHAR_BIT - 1)); 12 | 13 | plan_tests(100 + 100); 14 | /* Simple mean test: should always be 0. */ 15 | for (i = 0; i < 100; i++) { 16 | tally_add(tally, i); 17 | tally_add(tally, -i); 18 | ok1(tally_mean(tally) == 0); 19 | } 20 | 21 | /* Works for big values too... */ 22 | for (i = 0; i < 100; i++) { 23 | tally_add(tally, max - i); 24 | tally_add(tally, min + 1 + i); 25 | ok1(tally_mean(tally) == 0); 26 | } 27 | 28 | free(tally); 29 | return exit_status(); 30 | } 31 | -------------------------------------------------------------------------------- /ccan/tally/test/run-min-max.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) 5 | { 6 | int i; 7 | struct tally *tally = tally_new(0); 8 | 9 | plan_tests(100 * 4); 10 | /* Test max, min and num. */ 11 | for (i = 0; i < 100; i++) { 12 | tally_add(tally, i); 13 | ok1(tally_num(tally) == i*2 + 1); 14 | tally_add(tally, -i); 15 | ok1(tally_num(tally) == i*2 + 2); 16 | ok1(tally_max(tally) == i); 17 | ok1(tally_min(tally) == -i); 18 | } 19 | free(tally); 20 | return exit_status(); 21 | } 22 | -------------------------------------------------------------------------------- /ccan/tally/test/run-renormalize.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) 5 | { 6 | struct tally *tally = tally_new(2); 7 | 8 | plan_tests(4); 9 | tally->min = 0; 10 | tally->max = 0; 11 | tally->counts[0] = 1; 12 | 13 | /* This renormalize should do nothing. */ 14 | renormalize(tally, 0, 1); 15 | ok1(tally->counts[0] == 1); 16 | ok1(tally->counts[1] == 0); 17 | tally->counts[1]++; 18 | 19 | /* This renormalize should collapse both into bucket 0. */ 20 | renormalize(tally, 0, 3); 21 | ok1(tally->counts[0] == 2); 22 | ok1(tally->counts[1] == 0); 23 | 24 | free(tally); 25 | return exit_status(); 26 | } 27 | -------------------------------------------------------------------------------- /ccan/tcon/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/tcon/test/compile_fail-container1w.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | struct inner { 8 | int inner_val; 9 | }; 10 | 11 | struct outer { 12 | int outer_val; 13 | struct inner inner; 14 | }; 15 | 16 | struct info_base { 17 | char *infop; 18 | }; 19 | 20 | int main(void) 21 | { 22 | TCON_WRAP(struct info_base, 23 | TCON_CONTAINER(concan, struct outer, inner)) info; 24 | struct outer ovar = { 0, { 0 } }; 25 | #ifdef FAIL 26 | #if !HAVE_TYPEOF 27 | #error We cannot detect type problems without HAVE_TYPEOF 28 | #endif 29 | int *innerp = &ovar.outer_val; 30 | #else 31 | struct inner *innerp = &ovar.inner; 32 | #endif 33 | 34 | return tcon_container_of(&info, concan, innerp) == &ovar; 35 | } 36 | -------------------------------------------------------------------------------- /ccan/tcon/test/compile_fail-container2w.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | struct inner { 8 | int inner_val; 9 | }; 10 | 11 | struct outer { 12 | int outer_val; 13 | struct inner inner; 14 | }; 15 | 16 | struct info_base { 17 | char *infop; 18 | }; 19 | 20 | int main(void) 21 | { 22 | TCON_WRAP(struct info_base, 23 | TCON_CONTAINER(concan, struct outer, inner)) info; 24 | struct outer ovar; 25 | #ifdef FAIL 26 | #if !HAVE_TYPEOF 27 | #error We cannot detect type problems without HAVE_TYPEOF 28 | #endif 29 | char *outerp = NULL; 30 | #else 31 | struct outer *outerp = &ovar; 32 | #endif 33 | 34 | return tcon_member_of(&info, concan, outerp) == &ovar.inner; 35 | } 36 | -------------------------------------------------------------------------------- /ccan/tcon/test/compile_fail-container3w.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | struct inner { 8 | int inner_val; 9 | }; 10 | 11 | struct outer { 12 | int outer_val; 13 | struct inner inner; 14 | }; 15 | 16 | struct info_base { 17 | char *infop; 18 | }; 19 | 20 | int main(void) 21 | { 22 | TCON_WRAP(struct info_base, 23 | TCON_CONTAINER(concan, struct outer, inner)) info; 24 | struct outer ovar = { 0, { 0 } }; 25 | #ifdef FAIL 26 | #if !HAVE_TYPEOF 27 | #error We cannot detect type problems without HAVE_TYPEOF 28 | #endif 29 | int *outerp; 30 | #else 31 | struct outer *outerp; 32 | #endif 33 | 34 | outerp = tcon_container_of(&info, concan, &ovar.inner); 35 | return outerp != NULL; 36 | } 37 | -------------------------------------------------------------------------------- /ccan/tcon/test/compile_fail-container4.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | struct inner { 8 | int inner_val; 9 | }; 10 | 11 | struct outer { 12 | int outer_val; 13 | struct inner inner; 14 | }; 15 | 16 | struct info_base { 17 | char *infop; 18 | }; 19 | 20 | struct info_tcon { 21 | struct info_base base; 22 | TCON(TCON_CONTAINER(concan, struct outer, inner)); 23 | }; 24 | 25 | int main(void) 26 | { 27 | struct info_tcon info; 28 | struct outer ovar; 29 | #ifdef FAIL 30 | #if !HAVE_TYPEOF 31 | #error We cannot detect type problems without HAVE_TYPEOF 32 | #endif 33 | int *innerp; 34 | #else 35 | struct inner *innerp; 36 | #endif 37 | 38 | innerp = tcon_member_of(&info, concan, &ovar); 39 | return innerp != NULL; 40 | } 41 | -------------------------------------------------------------------------------- /ccan/tcon/test/compile_fail-container4w.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | struct inner { 8 | int inner_val; 9 | }; 10 | 11 | struct outer { 12 | int outer_val; 13 | struct inner inner; 14 | }; 15 | 16 | struct info_base { 17 | char *infop; 18 | }; 19 | 20 | int main(void) 21 | { 22 | TCON_WRAP(struct info_base, 23 | TCON_CONTAINER(concan, struct outer, inner)) info; 24 | struct outer ovar; 25 | #ifdef FAIL 26 | #if !HAVE_TYPEOF 27 | #error We cannot detect type problems without HAVE_TYPEOF 28 | #endif 29 | int *innerp; 30 | #else 31 | struct inner *innerp; 32 | #endif 33 | 34 | innerp = tcon_member_of(&info, concan, &ovar); 35 | return innerp != NULL; 36 | } 37 | -------------------------------------------------------------------------------- /ccan/tcon/test/compile_fail-tcon_cast.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct container { 5 | void *p; 6 | }; 7 | 8 | struct int_and_charp_container { 9 | struct container raw; 10 | TCON(int *tc1; char *tc2); 11 | }; 12 | 13 | int main(void) 14 | { 15 | struct int_and_charp_container icon; 16 | #ifdef FAIL 17 | #if !HAVE_TYPEOF 18 | #error We cannot detect type problems without HAVE_TYPEOF 19 | #endif 20 | char * 21 | #else 22 | int * 23 | #endif 24 | x; 25 | 26 | icon.raw.p = NULL; 27 | x = tcon_cast(&icon, tc1, icon.raw.p); 28 | return x != NULL ? 0 : 1; 29 | } 30 | -------------------------------------------------------------------------------- /ccan/tcon/test/compile_fail-tcon_cast_wrap.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct container { 5 | void *p; 6 | }; 7 | 8 | int main(void) 9 | { 10 | TCON_WRAP(struct container, 11 | int *tc1; char *tc2) icon; 12 | #ifdef FAIL 13 | #if !HAVE_TYPEOF 14 | #error We cannot detect type problems without HAVE_TYPEOF 15 | #endif 16 | char * 17 | #else 18 | int * 19 | #endif 20 | x; 21 | 22 | tcon_unwrap(&icon)->p = NULL; 23 | x = tcon_cast(&icon, tc1, tcon_unwrap(&icon)->p); 24 | return x != NULL ? 0 : 1; 25 | } 26 | -------------------------------------------------------------------------------- /ccan/tcon/test/compile_fail-wrap.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct container { 5 | void *p; 6 | }; 7 | 8 | int main(void) 9 | { 10 | TCON_WRAP(struct container, int *canary) icon; 11 | #ifdef FAIL 12 | char * 13 | #else 14 | int * 15 | #endif 16 | x = NULL; 17 | 18 | tcon_unwrap(tcon_check(&icon, canary, x))->p = x; 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /ccan/tcon/test/compile_fail.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct container { 5 | void *p; 6 | }; 7 | 8 | struct int_container { 9 | struct container raw; 10 | TCON(int *canary); 11 | }; 12 | 13 | int main(void) 14 | { 15 | struct int_container icon; 16 | #ifdef FAIL 17 | char * 18 | #else 19 | int * 20 | #endif 21 | x = NULL; 22 | 23 | tcon_check(&icon, canary, x)->raw.p = x; 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /ccan/tcon/test/compile_ok-container.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | struct inner { 8 | int inner_val; 9 | }; 10 | 11 | struct outer { 12 | int outer_val; 13 | struct inner inner; 14 | }; 15 | 16 | struct info_base { 17 | char *infop; 18 | }; 19 | 20 | struct info_tcon { 21 | struct info_base base; 22 | TCON(TCON_CONTAINER(fi, struct outer, inner)); 23 | }; 24 | 25 | int main(void) 26 | { 27 | /* Const should work! */ 28 | const struct outer *ovar = NULL; 29 | struct outer *o; 30 | struct info_tcon info; 31 | 32 | o = tcon_container_of(&info, fi, &ovar->inner); 33 | return (o == ovar); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /ccan/tcon/test/compile_ok-void.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct container { 5 | void *p; 6 | }; 7 | 8 | struct void_container { 9 | struct container raw; 10 | TCON(void *canary); 11 | }; 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | struct void_container vcon; 16 | TCON_WRAP(struct container, void *canary) vconw; 17 | 18 | (void)argc; 19 | tcon_check(&vcon, canary, NULL)->raw.p = NULL; 20 | tcon_check(&vcon, canary, argv[0])->raw.p = NULL; 21 | tcon_check(&vcon, canary, main)->raw.p = NULL; 22 | 23 | tcon_unwrap(tcon_check(&vconw, canary, NULL))->p = NULL; 24 | tcon_unwrap(tcon_check(&vconw, canary, argv[0]))->p = NULL; 25 | tcon_unwrap(tcon_check(&vconw, canary, main))->p = NULL; 26 | 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /ccan/tcon/test/run-wrap.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | typedef TCON_WRAP(int, char *canary) canaried_int; 6 | 7 | int main(void) 8 | { 9 | canaried_int ci = TCON_WRAP_INIT(0); 10 | 11 | plan_tests(2); 12 | 13 | ok1(*tcon_unwrap(&ci) == 0); 14 | *tcon_unwrap(&ci) = 17; 15 | ok1(*tcon_unwrap(&ci) == 17); 16 | 17 | return exit_status(); 18 | } 19 | -------------------------------------------------------------------------------- /ccan/time/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/timer/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-2.1 -------------------------------------------------------------------------------- /ccan/tlist/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-3 -------------------------------------------------------------------------------- /ccan/tlist/test/compile_fail-tlist_for_each.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | TLIST_TYPE(children, struct child); 4 | 5 | struct child { 6 | const char *name; 7 | struct list_node list; 8 | }; 9 | 10 | struct cousin { 11 | const char *name; 12 | struct list_node list; 13 | }; 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | struct tlist_children children; 18 | struct child child = { "child" }; 19 | #ifdef FAIL 20 | #if !HAVE_FLEXIBLE_ARRAY_MEMBER 21 | #error Need flexible array members to check type 22 | #endif 23 | struct cousin *c; 24 | #else 25 | struct child *c; 26 | #endif 27 | 28 | tlist_init(&children); 29 | tlist_add(&children, &child, list); 30 | 31 | tlist_for_each(&children, c, list) 32 | (void) c; /* Suppress unused-but-set-variable warning. */ 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /ccan/tlist/test/compile_fail-tlist_for_each_safe.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | TLIST_TYPE(children, struct child); 4 | 5 | struct child { 6 | const char *name; 7 | struct list_node list; 8 | }; 9 | 10 | struct cousin { 11 | const char *name; 12 | struct list_node list; 13 | }; 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | struct tlist_children children; 18 | struct child child = { "child" }; 19 | #ifdef FAIL 20 | #if !HAVE_FLEXIBLE_ARRAY_MEMBER 21 | #error Need flexible array members to check type 22 | #endif 23 | struct cousin *c, *n; 24 | #else 25 | struct child *c, *n; 26 | #endif 27 | 28 | tlist_init(&children); 29 | tlist_add(&children, &child, list); 30 | 31 | tlist_for_each_safe(&children, c, n, list); 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /ccan/tlist/test/compile_fail-tlist_next.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | TLIST_TYPE(children, struct child); 4 | 5 | struct child { 6 | const char *name; 7 | struct list_node list; 8 | }; 9 | 10 | struct cousin { 11 | const char *name; 12 | struct list_node list; 13 | }; 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | struct tlist_children children; 18 | struct child child = { "child" }; 19 | #ifdef FAIL 20 | #if !HAVE_FLEXIBLE_ARRAY_MEMBER 21 | #error Need flexible array members to check type 22 | #endif 23 | struct cousin *p; 24 | #else 25 | struct child *p; 26 | #endif 27 | 28 | tlist_init(&children); 29 | tlist_add(&children, &child, list); 30 | p = tlist_next(&children, &child, list); 31 | (void) p; 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /ccan/tlist/test/compile_fail-tlist_next2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | TLIST_TYPE(children, struct child); 4 | 5 | struct child { 6 | const char *name; 7 | struct list_node list; 8 | }; 9 | 10 | struct cousin { 11 | const char *name; 12 | struct list_node list; 13 | }; 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | struct tlist_children children; 18 | struct child child = { "child" }; 19 | #ifdef FAIL 20 | #if !HAVE_FLEXIBLE_ARRAY_MEMBER 21 | #error Need flexible array members to check type 22 | #endif 23 | struct cousin *p = NULL; 24 | #else 25 | struct child *p = NULL; 26 | #endif 27 | 28 | tlist_init(&children); 29 | tlist_add(&children, &child, list); 30 | (void)tlist_next(&children, p, list); 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /ccan/tlist/test/compile_fail-tlist_prev.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | TLIST_TYPE(children, struct child); 4 | 5 | struct child { 6 | const char *name; 7 | struct list_node list; 8 | }; 9 | 10 | struct cousin { 11 | const char *name; 12 | struct list_node list; 13 | }; 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | struct tlist_children children; 18 | struct child child = { "child" }; 19 | #ifdef FAIL 20 | #if !HAVE_FLEXIBLE_ARRAY_MEMBER 21 | #error Need flexible array members to check type 22 | #endif 23 | struct cousin *p; 24 | #else 25 | struct child *p; 26 | #endif 27 | 28 | tlist_init(&children); 29 | tlist_add(&children, &child, list); 30 | p = tlist_prev(&children, &child, list); 31 | (void) p; 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /ccan/tlist/test/compile_fail-tlist_prev2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | TLIST_TYPE(children, struct child); 4 | 5 | struct child { 6 | const char *name; 7 | struct list_node list; 8 | }; 9 | 10 | struct cousin { 11 | const char *name; 12 | struct list_node list; 13 | }; 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | struct tlist_children children; 18 | struct child child = { "child" }; 19 | #ifdef FAIL 20 | #if !HAVE_FLEXIBLE_ARRAY_MEMBER 21 | #error Need flexible array members to check type 22 | #endif 23 | struct cousin *p = NULL; 24 | #else 25 | struct child *p = NULL; 26 | #endif 27 | 28 | tlist_init(&children); 29 | tlist_add(&children, &child, list); 30 | (void)tlist_prev(&children, p, list); 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /ccan/tlist/test/compile_fail-tlist_tail.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | TLIST_TYPE(children, struct child); 4 | 5 | struct child { 6 | const char *name; 7 | struct list_node list; 8 | }; 9 | 10 | struct cousin { 11 | const char *name; 12 | struct list_node list; 13 | }; 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | struct tlist_children children; 18 | struct child child = { "child" }; 19 | #ifdef FAIL 20 | struct cousin *c; 21 | #else 22 | struct child *c; 23 | #endif 24 | 25 | tlist_init(&children); 26 | tlist_add(&children, &child, list); 27 | 28 | c = tlist_tail(&children, list); 29 | (void) c; /* Suppress unused-but-set-variable warning. */ 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /ccan/tlist/test/compile_fail-tlist_top.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | TLIST_TYPE(children, struct child); 4 | 5 | struct child { 6 | const char *name; 7 | struct list_node list; 8 | }; 9 | 10 | struct cousin { 11 | const char *name; 12 | struct list_node list; 13 | }; 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | struct tlist_children children; 18 | struct child child = { "child" }; 19 | #ifdef FAIL 20 | struct cousin *c; 21 | #else 22 | struct child *c; 23 | #endif 24 | 25 | tlist_init(&children); 26 | tlist_add(&children, &child, list); 27 | 28 | c = tlist_top(&children, list); 29 | (void) c; /* Suppress unused-but-set-variable warning. */ 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /ccan/tlist2/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-3 -------------------------------------------------------------------------------- /ccan/tlist2/test/compile_fail-tlist_add_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct child { 4 | const char *name; 5 | struct list_node list; 6 | }; 7 | 8 | struct cousin { 9 | const char *name; 10 | struct list_node list; 11 | }; 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | TLIST2(struct child, list) children; 16 | TLIST2(struct cousin, list) cousins; 17 | struct child child = { "child" }; 18 | struct cousin cousin = { "cousin" }; 19 | 20 | tlist2_init(&children); 21 | tlist2_init(&cousins); 22 | tlist2_add(&children, &child); 23 | tlist2_add(&cousins, &cousin); 24 | tlist2_del_from(&cousins, &cousin); 25 | #ifdef FAIL 26 | #if !HAVE_FLEXIBLE_ARRAY_MEMBER 27 | #error Need flexible array members to check type 28 | #endif 29 | tlist2_add(&children, &cousin); 30 | #endif 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /ccan/tlist2/test/compile_fail-tlist_add_tail_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct child { 4 | const char *name; 5 | struct list_node list; 6 | }; 7 | 8 | struct cousin { 9 | const char *name; 10 | struct list_node list; 11 | }; 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | TLIST2(struct child, list) children; 16 | TLIST2(struct cousin, list) cousins; 17 | struct child child = { "child" }; 18 | struct cousin cousin = { "cousin" }; 19 | 20 | tlist2_init(&children); 21 | tlist2_init(&cousins); 22 | tlist2_add(&children, &child); 23 | tlist2_add(&cousins, &cousin); 24 | tlist2_del_from(&cousins, &cousin); 25 | #ifdef FAIL 26 | #if !HAVE_FLEXIBLE_ARRAY_MEMBER 27 | #error Need flexible array members to check type 28 | #endif 29 | tlist2_add_tail(&children, &cousin); 30 | #endif 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /ccan/tlist2/test/compile_fail-tlist_del_from_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct child { 4 | const char *name; 5 | struct list_node list; 6 | }; 7 | 8 | struct cousin { 9 | const char *name; 10 | struct list_node list; 11 | }; 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | TLIST2(struct child, list) children; 16 | TLIST2(struct cousin, list) cousins; 17 | struct child child = { "child" }; 18 | struct cousin cousin = { "cousin" }; 19 | 20 | tlist2_init(&children); 21 | tlist2_init(&cousins); 22 | tlist2_add(&children, &child); 23 | tlist2_add(&cousins, &cousin); 24 | #ifdef FAIL 25 | #if !HAVE_FLEXIBLE_ARRAY_MEMBER 26 | #error Need flexible array members to check type 27 | #endif 28 | tlist2_del_from(&children, &cousin); 29 | #endif 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /ccan/tlist2/test/compile_fail-tlist_for_each_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct child { 4 | const char *name; 5 | struct list_node list; 6 | }; 7 | 8 | struct cousin { 9 | const char *name; 10 | struct list_node list; 11 | }; 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | TLIST2(struct child, list) children; 16 | struct child child = { "child" }; 17 | #ifdef FAIL 18 | #if !HAVE_FLEXIBLE_ARRAY_MEMBER 19 | #error Need flexible array members to check type 20 | #endif 21 | struct cousin *c; 22 | #else 23 | struct child *c; 24 | #endif 25 | 26 | tlist2_init(&children); 27 | tlist2_add(&children, &child); 28 | 29 | tlist2_for_each(&children, c) 30 | (void) c; /* Suppress unused-but-set-variable warning. */ 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /ccan/tlist2/test/compile_fail-tlist_for_each_safe_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct child { 4 | const char *name; 5 | struct list_node list; 6 | }; 7 | 8 | struct cousin { 9 | const char *name; 10 | struct list_node list; 11 | }; 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | TLIST2(struct child, list) children; 16 | struct child child = { "child" }; 17 | #ifdef FAIL 18 | #if !HAVE_FLEXIBLE_ARRAY_MEMBER 19 | #error Need flexible array members to check type 20 | #endif 21 | struct cousin *c, *n; 22 | #else 23 | struct child *c, *n; 24 | #endif 25 | 26 | tlist2_init(&children); 27 | tlist2_add(&children, &child); 28 | 29 | tlist2_for_each_safe(&children, c, n); 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /ccan/tlist2/test/compile_fail-tlist_tail_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct child { 4 | const char *name; 5 | struct list_node list; 6 | }; 7 | 8 | struct cousin { 9 | const char *name; 10 | struct list_node list; 11 | }; 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | TLIST2(struct child, list) children; 16 | struct child child = { "child" }; 17 | #ifdef FAIL 18 | struct cousin *c; 19 | #else 20 | struct child *c; 21 | #endif 22 | 23 | tlist2_init(&children); 24 | tlist2_add(&children, &child); 25 | 26 | c = tlist2_tail(&children); 27 | (void) c; /* Suppress unused-but-set-variable warning. */ 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /ccan/tlist2/test/compile_fail-tlist_top_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct child { 4 | const char *name; 5 | struct list_node list; 6 | }; 7 | 8 | struct cousin { 9 | const char *name; 10 | struct list_node list; 11 | }; 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | TLIST2(struct child, list) children; 16 | struct child child = { "child" }; 17 | #ifdef FAIL 18 | struct cousin *c; 19 | #else 20 | struct child *c; 21 | #endif 22 | 23 | tlist2_init(&children); 24 | tlist2_add(&children, &child); 25 | 26 | c = tlist2_top(&children); 27 | (void) c; /* Suppress unused-but-set-variable warning. */ 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /ccan/ttxml/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/GPL-3 -------------------------------------------------------------------------------- /ccan/ttxml/test/test.xml1: -------------------------------------------------------------------------------- 1 | 2 | foobar 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /ccan/ttxml/test/test.xml2: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /ccan/ttxml/test/test.xml3: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /ccan/ttxml/test/test.xml4: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /ccan/typesafe_cb/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /ccan/typesafe_cb/test/compile_fail-cast_if_type-promotable.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static void _set_some_value(void *val) 5 | { 6 | (void)val; 7 | } 8 | 9 | #define set_some_value(expr) \ 10 | _set_some_value(typesafe_cb_cast(void *, long, (expr))) 11 | 12 | int main(void) 13 | { 14 | #ifdef FAIL 15 | bool x = 0; 16 | #if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P 17 | #error "Unfortunately we don't fail if typesafe_cb_cast is a noop." 18 | #endif 19 | #else 20 | long x = 0; 21 | #endif 22 | set_some_value(x); 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /ccan/typesafe_cb/test/compile_fail-typesafe_cb-int.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void _callback(void (*fn)(void *arg), void *arg); 5 | void _callback(void (*fn)(void *arg), void *arg) 6 | { 7 | fn(arg); 8 | } 9 | 10 | /* Callback is set up to warn if arg isn't a pointer (since it won't 11 | * pass cleanly to _callback's second arg. */ 12 | #define callback(fn, arg) \ 13 | _callback(typesafe_cb(void, (fn), (arg)), (arg)) 14 | 15 | void my_callback(int something); 16 | void my_callback(int something) 17 | { 18 | (void)something; 19 | } 20 | 21 | int main(void) 22 | { 23 | #ifdef FAIL 24 | /* This fails due to arg, not due to cast. */ 25 | callback(my_callback, 100); 26 | #endif 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /ccan/typesafe_cb/test/compile_fail-typesafe_cb_cast.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void _set_some_value(void *val); 4 | 5 | void _set_some_value(void *val) 6 | { 7 | (void)val; 8 | } 9 | 10 | #define set_some_value(expr) \ 11 | _set_some_value(typesafe_cb_cast(void *, unsigned long, (expr))) 12 | 13 | int main(void) 14 | { 15 | #ifdef FAIL 16 | int x = 0; 17 | set_some_value(x); 18 | #if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P 19 | #error "Unfortunately we don't fail if typesafe_cb_cast is a noop." 20 | #endif 21 | #else 22 | void *p = 0; 23 | set_some_value(p); 24 | #endif 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /ccan/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static void _register_callback(void (*cb)(void *arg, int x), void *arg) 5 | { 6 | (void)cb; 7 | (void)arg; 8 | } 9 | #define register_callback(cb, arg) \ 10 | _register_callback(typesafe_cb_postargs(void, void *, (cb), (arg), int), (arg)) 11 | 12 | static void my_callback(char *p, int x) 13 | { 14 | (void)p; 15 | (void)x; 16 | } 17 | 18 | int main(void) 19 | { 20 | #ifdef FAIL 21 | int *p; 22 | #if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P 23 | #error "Unfortunately we don't fail if typesafe_cb_cast is a noop." 24 | #endif 25 | #else 26 | char *p; 27 | #endif 28 | p = NULL; 29 | register_callback(my_callback, p); 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /ccan/typesafe_cb/test/compile_fail-typesafe_cb_preargs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static void _register_callback(void (*cb)(int x, void *arg), void *arg) 5 | { 6 | (void)cb; 7 | (void)arg; 8 | } 9 | 10 | #define register_callback(cb, arg) \ 11 | _register_callback(typesafe_cb_preargs(void, void *, (cb), (arg), int), (arg)) 12 | 13 | static void my_callback(int x, char *p) 14 | { 15 | (void)p; 16 | (void)x; 17 | } 18 | 19 | int main(void) 20 | { 21 | #ifdef FAIL 22 | int *p; 23 | #if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P 24 | #error "Unfortunately we don't fail if typesafe_cb_cast is a noop." 25 | #endif 26 | #else 27 | char *p; 28 | #endif 29 | p = NULL; 30 | register_callback(my_callback, p); 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /ccan/typesafe_cb/test/compile_ok-typesafe_cb-NULL.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* NULL args for callback function should be OK for normal and _def. */ 5 | 6 | static void _register_callback(void (*cb)(const void *arg), const void *arg) 7 | { 8 | (void)cb; 9 | (void)arg; 10 | } 11 | 12 | #define register_callback(cb, arg) \ 13 | _register_callback(typesafe_cb(void, const void *, (cb), (arg)), (arg)) 14 | 15 | int main(void) 16 | { 17 | register_callback(NULL, "hello world"); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /ccan/ungraph/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/utf8/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/version/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/BSD-MIT -------------------------------------------------------------------------------- /ccan/version/test/compile_fail.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) 5 | { 6 | #ifdef FAIL 7 | struct version a; 8 | a = 0; /* no direct assignment */ 9 | #endif 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /ccan/wwviaudio/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/GPL-2 -------------------------------------------------------------------------------- /ccan/xstring/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/APACHE-2 -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | default: ccanlint.1 configurator.1 2 | 3 | %.1: %.1.txt 4 | a2x --format=manpage $< 5 | 6 | distclean: 7 | rm -f ccanlint.1 configurator.1 8 | -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/src/Makefile: -------------------------------------------------------------------------------- 1 | P_NAME := libclibutils.a 2 | P_C_SRCS := $(wildcard *.c) 3 | P_C_OBJS := ${P_C_SRCS:.c=.o} 4 | P_OBJS := $(P_C_OBJS) 5 | P_INCLUDE_DIRS := ../inc 6 | CPPFLAGS += $(foreach includedir,$(P_INCLUDE_DIRS),-I$(includedir)) 7 | LDFLAGS += $(foreach librarydir,$(P_LIBRARY_DIRS),-L$(librarydir)) 8 | LDFLAGS += $(foreach library,$(P_LIBRARIES),-l$(library)) 9 | CXX := gcc 10 | CC := gcc -g -Wall -Wextra -Wparentheses -pedantic 11 | 12 | .PHONY: all clean 13 | all: $(P_NAME) 14 | $(P_NAME): $(P_OBJS) 15 | ar rcs $(P_NAME) $(P_OBJS) 16 | clean: 17 | @- $(RM) $(P_NAME) 18 | @- $(RM) $(P_OBJS) 19 | @- $(RM) core* 20 | @- $(RM) tags 21 | 22 | -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/test/Makefile: -------------------------------------------------------------------------------- 1 | P_NAME := tstclibutils 2 | P_C_SRCS := $(wildcard *.c) 3 | P_C_OBJS := ${P_C_SRCS:.c=.o} 4 | P_INCLUDE_DIRS := ../inc 5 | P_LIBRARY_DIRS := ../src 6 | P_LIBRARIES := clibutils 7 | CPPFLAGS += $(foreach includedir,$(P_INCLUDE_DIRS),-I$(includedir)) 8 | LDFLAGS += $(foreach librarydir,$(P_LIBRARY_DIRS),-L$(librarydir)) 9 | LDFLAGS += $(foreach library,$(P_LIBRARIES),-l$(library)) 10 | CC := gcc -Wall -g 11 | CCFLAGS := -Wall -g 12 | 13 | .PHONY: all clean 14 | all: $(P_NAME) 15 | $(P_NAME): $(P_C_OBJS) 16 | $(CC) $(CCFLAGS) $(P_C_OBJS) -o $(P_NAME) $(LDFLAGS) 17 | clean: 18 | @- $(RM) $(P_NAME) 19 | @- $(RM) $(P_C_OBJS) 20 | @- $(RM) core* 21 | @- $(RM) tags 22 | 23 | -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils.ncb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils.ncb -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils.suo -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/BuildLog.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/BuildLog.htm -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/c_array.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/c_array.obj -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/c_deque.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/c_deque.obj -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/c_heap.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/c_heap.obj -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/c_map.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/c_map.obj -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/c_rb.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/c_rb.obj -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/c_set.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/c_set.obj -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/c_slist.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/c_slist.obj -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/c_stack.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/c_stack.obj -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/c_util.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/c_util.obj -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/clibutils.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/clibutils.idb -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/clibutils.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/clibutils.lib -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/clibutils.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/clibutils_Debug/clibutils.pdb -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/BuildLog.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/BuildLog.htm -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/mt.dep: -------------------------------------------------------------------------------- 1 | Manifest resource last updated at 12:03:46.09 on Mon 04/18/2011 2 | -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/t_c_array.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/t_c_array.obj -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/t_c_deque.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/t_c_deque.obj -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/t_c_heap.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/t_c_heap.obj -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/t_c_map.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/t_c_map.obj -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/t_c_rb.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/t_c_rb.obj -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/t_c_set.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/t_c_set.obj -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/t_c_slist.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/t_c_slist.obj -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/t_c_stack.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/t_c_stack.obj -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/t_clibutils.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/t_clibutils.obj -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/tclibutils.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/tclibutils.exe -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/tclibutils.exe.embed.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/tclibutils.exe.embed.manifest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/tclibutils.exe.embed.manifest.res -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/tclibutils.exe.intermediate.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/tclibutils.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/tclibutils.idb -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/tclibutils.ilk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/tclibutils.ilk -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/tclibutils.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/tclibutils.pdb -------------------------------------------------------------------------------- /junkcode/dongre.avinash@gmail.com-clibutils/win/tclibutils_Debug/tclibutils_pure.ini: -------------------------------------------------------------------------------- 1 | [Purify] 2 | 3 | -------------------------------------------------------------------------------- /junkcode/iasoule32@gmail.com-polynomial/_info.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "config.h" 4 | 5 | /** 6 | * polynomial_adt - A polynomial module with ability to add,sub,mul derivate/integrate, compose ... polynomials 7 | * 8 | * ..expansion in progress ... 9 | * 10 | * Example: 11 | * FULLY-COMPILABLE-INDENTED-TRIVIAL-BUT-USEFUL-EXAMPLE-HERE 12 | */ 13 | int main(int argc, char *argv[]) 14 | { 15 | if (argc != 2) 16 | return 1; 17 | 18 | if (strcmp(argv[1], "depends") == 0) { 19 | /* Nothing. */ 20 | return 0; 21 | } 22 | 23 | if (strcmp(argv[1], "libs") == 0) { 24 | printf("m\n"); 25 | return 0; 26 | } 27 | 28 | return 1; 29 | } 30 | -------------------------------------------------------------------------------- /junkcode/mansourmoufid@gmail.com-endianness/endianness.c: -------------------------------------------------------------------------------- 1 | #include 2 | /* returns 0 for little-endian, 1 for big-endian */ 3 | int main( void ) 4 | { 5 | static const uint64_t one = (uint64_t) 1; 6 | if ((uint8_t) 1 == *((uint8_t *) &one)) 7 | return 0; 8 | else 9 | return 1; 10 | } 11 | -------------------------------------------------------------------------------- /junkcode/rusty@rustcorp.com.au-ntdb/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/LGPL-3 -------------------------------------------------------------------------------- /junkcode/rusty@rustcorp.com.au-ntdb/doc/design.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/junkcode/rusty@rustcorp.com.au-ntdb/doc/design.pdf -------------------------------------------------------------------------------- /junkcode/rusty@rustcorp.com.au-ntdb/ntdb.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: ntdb 7 | Description: A (not-so) trivial database 8 | Version: @PACKAGE_VERSION@ 9 | Libs: @LIB_RPATH@ -L${libdir} -lntdb 10 | Cflags: -I${includedir} 11 | URL: http://tdb.samba.org/ 12 | -------------------------------------------------------------------------------- /junkcode/rusty@rustcorp.com.au-ntdb/test/failtest_helper.h: -------------------------------------------------------------------------------- 1 | #ifndef NTDB_TEST_FAILTEST_HELPER_H 2 | #define NTDB_TEST_FAILTEST_HELPER_H 3 | #include 4 | #include 5 | 6 | /* FIXME: Check these! */ 7 | #define URANDOM_OPEN "open.c", 62, FAILTEST_OPEN 8 | #define URANDOM_READ "open.c", 42, FAILTEST_READ 9 | 10 | bool exit_check_log(struct tlist_calls *history); 11 | bool failmatch(const struct failtest_call *call, 12 | const char *file, int line, enum failtest_call_type type); 13 | enum failtest_result block_repeat_failures(struct tlist_calls *history); 14 | 15 | /* Set this to suppress failure. */ 16 | extern bool failtest_suppress; 17 | 18 | #endif /* NTDB_TEST_LOGGING_H */ 19 | -------------------------------------------------------------------------------- /junkcode/rusty@rustcorp.com.au-ntdb/test/helpapi-external-agent.h: -------------------------------------------------------------------------------- 1 | #include "external-agent.h" 2 | 3 | /* This isn't possible with via the ntdb API, but this makes it link. */ 4 | enum agent_return external_agent_needs_rec(struct ntdb_context *ntdb) 5 | { 6 | return FAILED; 7 | } 8 | -------------------------------------------------------------------------------- /junkcode/rusty@rustcorp.com.au-ntdb/test/helprun-external-agent.h: -------------------------------------------------------------------------------- 1 | #include "external-agent.h" 2 | #include "../private.h" 3 | 4 | enum agent_return external_agent_needs_rec(struct ntdb_context *ntdb) 5 | { 6 | return ntdb_needs_recovery(ntdb) ? SUCCESS : FAILED; 7 | } 8 | -------------------------------------------------------------------------------- /junkcode/rusty@rustcorp.com.au-ntdb/test/lock-tracking.h: -------------------------------------------------------------------------------- 1 | #ifndef LOCK_TRACKING_H 2 | #define LOCK_TRACKING_H 3 | #include 4 | 5 | /* Set this if you want a callback after fnctl unlock. */ 6 | extern void (*unlock_callback)(int fd); 7 | 8 | /* Replacement fcntl. */ 9 | int fcntl_with_lockcheck(int fd, int cmd, ... /* arg */ ); 10 | 11 | /* Discard locking info: returns number of locks outstanding. */ 12 | unsigned int forget_locking(void); 13 | 14 | /* Number of errors in locking. */ 15 | extern int locking_errors; 16 | 17 | /* Suppress lock checking. */ 18 | extern bool suppress_lockcheck; 19 | 20 | /* Make all locks non-blocking. */ 21 | extern bool nonblocking_locks; 22 | 23 | /* Number of times we failed a lock because we made it non-blocking. */ 24 | extern int locking_would_block; 25 | #endif /* LOCK_TRACKING_H */ 26 | -------------------------------------------------------------------------------- /junkcode/rusty@rustcorp.com.au-ntdb/test/logging.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "tap-interface.h" 4 | #include "logging.h" 5 | 6 | unsigned tap_log_messages; 7 | const char *log_prefix = ""; 8 | char *log_last = NULL; 9 | bool suppress_logging; 10 | 11 | union ntdb_attribute tap_log_attr = { 12 | .log = { .base = { .attr = NTDB_ATTRIBUTE_LOG }, 13 | .fn = tap_log_fn } 14 | }; 15 | 16 | void tap_log_fn(struct ntdb_context *ntdb, 17 | enum ntdb_log_level level, 18 | enum NTDB_ERROR ecode, 19 | const char *message, void *priv) 20 | { 21 | if (suppress_logging) 22 | return; 23 | 24 | diag("ntdb log level %u: %s: %s%s", 25 | level, ntdb_errorstr(ecode), log_prefix, message); 26 | if (log_last) 27 | free(log_last); 28 | log_last = strdup(message); 29 | tap_log_messages++; 30 | } 31 | -------------------------------------------------------------------------------- /junkcode/rusty@rustcorp.com.au-ntdb/test/logging.h: -------------------------------------------------------------------------------- 1 | #ifndef NTDB_TEST_LOGGING_H 2 | #define NTDB_TEST_LOGGING_H 3 | #include "../ntdb.h" 4 | #include 5 | #include 6 | 7 | extern bool suppress_logging; 8 | extern const char *log_prefix; 9 | extern unsigned tap_log_messages; 10 | extern union ntdb_attribute tap_log_attr; 11 | extern char *log_last; 12 | 13 | void tap_log_fn(struct ntdb_context *ntdb, 14 | enum ntdb_log_level level, 15 | enum NTDB_ERROR ecode, 16 | const char *message, void *priv); 17 | #endif /* NTDB_TEST_LOGGING_H */ 18 | -------------------------------------------------------------------------------- /junkcode/rusty@rustcorp.com.au-ntdb/test/no-fsync.h: -------------------------------------------------------------------------------- 1 | #ifndef NTDB_NO_FSYNC_H 2 | #define NTDB_NO_FSYNC_H 3 | /* Obey $TDB_NO_FSYNC, a bit like tdb does (only note our NTDB_NOSYNC 4 | * does less) */ 5 | #define MAYBE_NOSYNC (getenv("TDB_NO_FSYNC") ? NTDB_NOSYNC : 0) 6 | #endif 7 | -------------------------------------------------------------------------------- /junkcode/rusty@rustcorp.com.au-ntdb/test/ntdb-source.h: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | #include "../check.c" 3 | #include "../free.c" 4 | #include "../hash.c" 5 | #include "../io.c" 6 | #include "../lock.c" 7 | #include "../open.c" 8 | #include "../summary.c" 9 | #include "../ntdb.c" 10 | #include "../transaction.c" 11 | #include "../traverse.c" 12 | -------------------------------------------------------------------------------- /junkcode/rusty@rustcorp.com.au-ntdb/test/run-001-fls.c: -------------------------------------------------------------------------------- 1 | #include "ntdb-source.h" 2 | #include "tap-interface.h" 3 | #include "helprun-external-agent.h" 4 | 5 | static unsigned int dumb_fls(uint64_t num) 6 | { 7 | int i; 8 | 9 | for (i = 63; i >= 0; i--) { 10 | if (num & (1ULL << i)) 11 | break; 12 | } 13 | return i + 1; 14 | } 15 | 16 | int main(int argc, char *argv[]) 17 | { 18 | unsigned int i, j; 19 | 20 | plan_tests(64 * 64 + 2); 21 | 22 | ok1(fls64(0) == 0); 23 | ok1(dumb_fls(0) == 0); 24 | 25 | for (i = 0; i < 64; i++) { 26 | for (j = 0; j < 64; j++) { 27 | uint64_t val = (1ULL << i) | (1ULL << j); 28 | ok(fls64(val) == dumb_fls(val), 29 | "%llu -> %u should be %u", (long long)val, 30 | fls64(val), dumb_fls(val)); 31 | } 32 | } 33 | return exit_status(); 34 | } 35 | -------------------------------------------------------------------------------- /junkcode/rusty@rustcorp.com.au-ntdb/test/tap-interface.c: -------------------------------------------------------------------------------- 1 | #include "tap-interface.h" 2 | 3 | unsigned tap_ok_count, tap_ok_target = -1U; 4 | -------------------------------------------------------------------------------- /junkcode/rusty@rustcorp.com.au-ntdb/tools/Makefile: -------------------------------------------------------------------------------- 1 | OBJS:=../../ntdb.o ../../hash.o ../../tally.o 2 | CFLAGS:=-I../../.. -I.. -Wall -g -O3 #-g -pg 3 | LDFLAGS:=-L../../.. 4 | 5 | default: ntdbtorture ntdbtool ntdbdump ntdbrestore mkntdb speed growtdb-bench 6 | 7 | ntdbdump: ntdbdump.c $(OBJS) 8 | ntdbrestore: ntdbrestore.c $(OBJS) 9 | ntdbtorture: ntdbtorture.c $(OBJS) 10 | ntdbtool: ntdbtool.c $(OBJS) 11 | mkntdb: mkntdb.c $(OBJS) 12 | speed: speed.c $(OBJS) 13 | growtdb-bench: growtdb-bench.c $(OBJS) 14 | 15 | clean: 16 | rm -f ntdbtorture ntdbdump ntdbrestore ntdbtool mkntdb speed growtdb-bench 17 | -------------------------------------------------------------------------------- /junkcode/rusty@rustcorp.com.au-ntdb/tools/mkntdb.c: -------------------------------------------------------------------------------- 1 | #include "ntdb.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | unsigned int i, num_recs; 10 | struct ntdb_context *ntdb; 11 | 12 | if (argc != 3 || (num_recs = atoi(argv[2])) == 0) 13 | errx(1, "Usage: mktdb "); 14 | 15 | ntdb = ntdb_open(argv[1], NTDB_DEFAULT, O_CREAT|O_TRUNC|O_RDWR, 0600,NULL); 16 | if (!ntdb) 17 | err(1, "Opening %s", argv[1]); 18 | 19 | for (i = 0; i < num_recs; i++) { 20 | NTDB_DATA d; 21 | 22 | d.dptr = (void *)&i; 23 | d.dsize = sizeof(i); 24 | if (ntdb_store(ntdb, d, d, NTDB_INSERT) != 0) 25 | err(1, "Failed to store record %i", i); 26 | } 27 | printf("Done\n"); 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /junkcode/tterribe@email.unc.edu-nmbrthry/choose.c: -------------------------------------------------------------------------------- 1 | #include "choose.h" 2 | #include "gcd.h" 3 | 4 | /*Computes the number of combinations of _n items, taken _m at a time without 5 | overflow. 6 | _n: The total number of items. 7 | _m: The number taken at a time. 8 | Return: The number of combinations of _n items taken _m at a time.*/ 9 | unsigned choose(int _n,int _m){ 10 | unsigned ret; 11 | int i; 12 | ret=1; 13 | for(i=1;i<=_m;_n--,i++){ 14 | int nmi; 15 | nmi=_n%i; 16 | if(nmi==0)ret*=_n/i; 17 | else if(ret%i==0)ret=(ret/i)*_n; 18 | else{ 19 | int d; 20 | d=gcd(i,nmi); 21 | ret=(ret/(i/d))*(_n/d); 22 | } 23 | } 24 | return ret; 25 | } 26 | -------------------------------------------------------------------------------- /junkcode/tterribe@email.unc.edu-nmbrthry/choose.h: -------------------------------------------------------------------------------- 1 | #if !defined(_choose_H) 2 | # define _choose_H (1) 3 | 4 | /*Computes the number of combinations of _n items, taken _m at a time without 5 | overflow. 6 | _n: The total number of items. 7 | _b: The number taken at a time. 8 | Return: The number of combinations of _n items taken _m at a time.*/ 9 | unsigned choose(int _n,int _m); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /junkcode/tterribe@email.unc.edu-nmbrthry/gcd.c: -------------------------------------------------------------------------------- 1 | #include "gcd.h" 2 | 3 | /*Computes the gcd of two integers, _a and _b. 4 | _a: The first integer of which to compute the gcd. 5 | _b: The second integer of which to compute the gcd. 6 | Return: The non-negative gcd of _a and _b. 7 | If _a and _b are both 0, then 0 is returned, though in reality the 8 | gcd is undefined, as any integer, no matter how large, will divide 0 9 | evenly.*/ 10 | int gcd(int _a,int _b){ 11 | /*Make both arguments non-negative. 12 | This forces the return value to be non-negative.*/ 13 | if(_a<0)_a=-_a; 14 | if(_b<0)_b=-_b; 15 | /*Simply use the Euclidean algorithm.*/ 16 | while(_b){ 17 | int r; 18 | r=_a%_b; 19 | _a=_b; 20 | _b=r; 21 | } 22 | return _a; 23 | } 24 | -------------------------------------------------------------------------------- /junkcode/tterribe@email.unc.edu-nmbrthry/gcd.h: -------------------------------------------------------------------------------- 1 | #if !defined(_gcd_H) 2 | # define _gcd_H (1) 3 | 4 | /*Computes the gcd of two integers, _a and _b. 5 | _a: The first integer of which to compute the gcd. 6 | _b: The second integer of which to compute the gcd. 7 | Return: The non-negative gcd of _a and _b. 8 | If _a and _b are both 0, then 0 is returned, though in reality the 9 | gcd is undefined, as any integer, no matter how large, will divide 0 10 | evenly.*/ 11 | int gcd(int _a,int _b); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /tools/ccanlint/test/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS=-g -Wall -I../../../ 2 | 3 | run-file_analysis: run-file_analysis.o ../../doc_extract-core.o ../../../libccan.a 4 | -------------------------------------------------------------------------------- /tools/ccanlint/tests/build.h: -------------------------------------------------------------------------------- 1 | #ifndef CCANLINT_BUILD_H 2 | #define CCANLINT_BUILD_H 3 | char *build_module(struct manifest *m, enum compile_type ctype, char **errstr); 4 | char *build_submodule(struct manifest *m, const char *flags, 5 | enum compile_type ctype); 6 | void build_objects(struct manifest *m, 7 | struct score *score, const char *flags, 8 | enum compile_type ctype); 9 | #endif /* CCANLINT_BUILD_H */ 10 | -------------------------------------------------------------------------------- /tools/ccanlint/tests/objects_build_without_features.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "reduce_features.h" 4 | #include "build.h" 5 | 6 | static void check_objs_build_without_features(struct manifest *m, 7 | unsigned int *timeleft UNNEEDED, 8 | struct score *score) 9 | { 10 | const char *flags = tal_fmt(score, "%s %s", 11 | REDUCE_FEATURES_FLAGS, cflags); 12 | build_objects(m, score, flags, COMPILE_NOFEAT); 13 | } 14 | 15 | struct ccanlint objects_build_without_features = { 16 | .key = "objects_build_without_features", 17 | .name = "Module object files can be built (without features)", 18 | .check = check_objs_build_without_features, 19 | .needs = "reduce_features objects_build" 20 | }; 21 | REGISTER_TEST(objects_build_without_features); 22 | 23 | -------------------------------------------------------------------------------- /tools/ccanlint/tests/reduce_features.h: -------------------------------------------------------------------------------- 1 | #ifndef CCANLINT_REDUCE_FEATURES_H 2 | #define CCANLINT_REDUCE_FEATURES_H 3 | extern bool features_were_reduced; 4 | 5 | #define REDUCE_FEATURES_FLAGS "-Ireduced-features" 6 | #endif /* CCANLINT_REDUCE_FEATURES_H */ 7 | -------------------------------------------------------------------------------- /tools/ccanlint/tests/tests_compile.h: -------------------------------------------------------------------------------- 1 | /* Objects to link with; ctype is variant for test helpers and other modules, 2 | own_ctype is (if link_with_module) for this module's objects. */ 3 | char *test_obj_list(const struct manifest *m, bool link_with_module, 4 | enum compile_type ctype, enum compile_type own_ctype); 5 | /* Library list as specified by ctype variant of _info. */ 6 | char *test_lib_list(const struct manifest *m, enum compile_type ctype); 7 | -------------------------------------------------------------------------------- /tools/ccanlint/tests/tests_pass.h: -------------------------------------------------------------------------------- 1 | /* Set in tests_pass. */ 2 | extern bool do_valgrind; 3 | extern const char *valgrind_suppress; 4 | 5 | extern struct ccanlint tests_pass_valgrind; 6 | -------------------------------------------------------------------------------- /tools/doc_extract.h: -------------------------------------------------------------------------------- 1 | #ifndef _DOC_EXTRACT_CORE_H 2 | #define _DOC_EXTRACT_CORE_H 3 | #include 4 | #include 5 | 6 | struct doc_section { 7 | struct list_node list; 8 | const char *function; 9 | const char *type; 10 | /* Where did I come from? */ 11 | unsigned int srcline; 12 | unsigned int num_lines; 13 | char **lines; 14 | }; 15 | 16 | struct list_head *extract_doc_sections(char **rawlines, const char *file); 17 | #endif /* _DOC_EXTRACT_CORE_H */ 18 | -------------------------------------------------------------------------------- /tools/list_files.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Script to list all files, for making tarballs. 3 | 4 | set -e 5 | if [ $# -eq 0 ]; then 6 | echo Usage: list_files.sh '...' >&2 7 | exit 1 8 | fi 9 | 10 | for d; do 11 | # git ls-files recurses, but we want ignores correct :( 12 | for f in `git ls-files $d | sed "s,^\($d/[^/]*\)/.*,\1," | uniq`; do 13 | # Include subdirs, unless it's a separate module. 14 | if [ -d "$f" ]; then 15 | if [ ! -f "$f"/_info ]; then 16 | $0 "$f" 17 | fi 18 | else 19 | echo "$f" 20 | fi 21 | done 22 | done 23 | -------------------------------------------------------------------------------- /tools/read_config_header.h: -------------------------------------------------------------------------------- 1 | #ifndef CCAN_TOOLS_READ_CONFIG_HEADER_H 2 | #define CCAN_TOOLS_READ_CONFIG_HEADER_H 3 | #include 4 | 5 | /* Get token if it's equal to token. */ 6 | bool get_token(const char **line, const char *token); 7 | 8 | /* Get an identifier token. */ 9 | char *get_symbol_token(void *ctx, const char **line); 10 | 11 | /* Read config header from config_dir/config.h: sets compiler/cflags. */ 12 | char *read_config_header(const char *config_dir, bool verbose); 13 | 14 | #endif /* CCAN_TOOLS_READ_CONFIG_HEADER_H */ 15 | -------------------------------------------------------------------------------- /tools/test_all.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # First, test normal config. 4 | if ! make -s; then 5 | echo Normal config failed. 6 | exit 1 7 | fi 8 | 9 | # Now, remove one HAVE_ at a time. 10 | cp config.h original-config.h 11 | trap "mv original-config.h config.h && rm -f .newconfig" EXIT 12 | 13 | while grep -q '1$' config.h; do 14 | tr '\012' @ < config.h | sed 's/1@/0@/' | tr @ '\012' > .newconfig 15 | diff -u config.h .newconfig 16 | mv .newconfig config.h 17 | if ! make -s; then 18 | echo Failed config: 19 | cat config.h 20 | exit 1 21 | fi 22 | done 23 | -------------------------------------------------------------------------------- /web/ccan-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/web/ccan-bg.png -------------------------------------------------------------------------------- /web/ccan.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/web/ccan.jpg -------------------------------------------------------------------------------- /web/ccan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustyrussell/ccan/734087370994b06caf4b91eb4027e039e15dd77a/web/ccan.png -------------------------------------------------------------------------------- /web/menulist.html: -------------------------------------------------------------------------------- 1 | 5 | 21 | -------------------------------------------------------------------------------- /web/staticjunkcode.php: -------------------------------------------------------------------------------- 1 | 7 |
8 |

Contents of CCAN

9 |

10 | 11 | 12 | read())) { 16 | if ($entry[0] != '.') { 17 | array_push($files, $entry); 18 | } 19 | } 20 | $d->close(); 21 | sort($files); 22 | 23 | foreach ($files as $file) { 24 | $size = round((filesize($argv[1]."/".$file) + 1023) / 1024); 25 | ?> 26 | 27 | 28 | 29 | 32 |
"> (K)
33 |

34 | 35 | --------------------------------------------------------------------------------