rugged 1.7.2 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +1 -0
- data/vendor/libgit2/CMakeLists.txt +23 -10
- data/vendor/libgit2/COPYING +195 -1
- data/vendor/libgit2/cmake/{FindIconv.cmake → FindIntlIconv.cmake} +6 -0
- data/vendor/libgit2/cmake/FindLLHTTP.cmake +39 -0
- data/vendor/libgit2/cmake/SelectGSSAPI.cmake +1 -1
- data/vendor/libgit2/cmake/SelectHTTPParser.cmake +23 -8
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +17 -8
- data/vendor/libgit2/cmake/SelectHashes.cmake +28 -11
- data/vendor/libgit2/cmake/SelectRegex.cmake +6 -1
- data/vendor/libgit2/cmake/SelectSSH.cmake +22 -17
- data/vendor/libgit2/cmake/SelectZlib.cmake +4 -0
- data/vendor/libgit2/deps/llhttp/CMakeLists.txt +8 -0
- data/vendor/libgit2/deps/llhttp/LICENSE-MIT +22 -0
- data/vendor/libgit2/deps/llhttp/api.c +510 -0
- data/vendor/libgit2/deps/llhttp/http.c +170 -0
- data/vendor/libgit2/deps/llhttp/llhttp.c +10168 -0
- data/vendor/libgit2/deps/llhttp/llhttp.h +897 -0
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +1 -1
- data/vendor/libgit2/deps/ntlmclient/crypt_builtin_md4.c +311 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +2 -1
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -20
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +4 -4
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +21 -21
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +5 -4
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +2 -1
- data/vendor/libgit2/deps/ntlmclient/utf8.h +1176 -721
- data/vendor/libgit2/deps/ntlmclient/util.h +11 -0
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +1 -0
- data/vendor/libgit2/deps/xdiff/xmerge.c +2 -2
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -1
- data/vendor/libgit2/deps/zlib/LICENSE +22 -0
- data/vendor/libgit2/deps/zlib/adler32.c +5 -27
- data/vendor/libgit2/deps/zlib/crc32.c +94 -167
- data/vendor/libgit2/deps/zlib/deflate.c +358 -435
- data/vendor/libgit2/deps/zlib/deflate.h +41 -10
- data/vendor/libgit2/deps/zlib/gzguts.h +13 -18
- data/vendor/libgit2/deps/zlib/infback.c +17 -30
- data/vendor/libgit2/deps/zlib/inffast.c +1 -4
- data/vendor/libgit2/deps/zlib/inffast.h +1 -1
- data/vendor/libgit2/deps/zlib/inflate.c +36 -102
- data/vendor/libgit2/deps/zlib/inftrees.c +6 -11
- data/vendor/libgit2/deps/zlib/inftrees.h +6 -6
- data/vendor/libgit2/deps/zlib/trees.c +287 -352
- data/vendor/libgit2/deps/zlib/zconf.h +23 -14
- data/vendor/libgit2/deps/zlib/zlib.h +202 -202
- data/vendor/libgit2/deps/zlib/zutil.c +18 -44
- data/vendor/libgit2/deps/zlib/zutil.h +13 -33
- data/vendor/libgit2/include/git2/annotated_commit.h +12 -5
- data/vendor/libgit2/include/git2/apply.h +27 -6
- data/vendor/libgit2/include/git2/attr.h +17 -4
- data/vendor/libgit2/include/git2/blame.h +133 -28
- data/vendor/libgit2/include/git2/blob.h +71 -28
- data/vendor/libgit2/include/git2/branch.h +22 -15
- data/vendor/libgit2/include/git2/buffer.h +6 -4
- data/vendor/libgit2/include/git2/cert.h +2 -1
- data/vendor/libgit2/include/git2/checkout.h +83 -32
- data/vendor/libgit2/include/git2/cherrypick.h +10 -3
- data/vendor/libgit2/include/git2/clone.h +25 -9
- data/vendor/libgit2/include/git2/commit.h +132 -3
- data/vendor/libgit2/include/git2/common.h +120 -63
- data/vendor/libgit2/include/git2/config.h +93 -23
- data/vendor/libgit2/include/git2/credential.h +30 -2
- data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
- data/vendor/libgit2/include/git2/deprecated.h +133 -3
- data/vendor/libgit2/include/git2/describe.h +13 -1
- data/vendor/libgit2/include/git2/diff.h +38 -8
- data/vendor/libgit2/include/git2/email.h +9 -29
- data/vendor/libgit2/include/git2/errors.h +46 -73
- data/vendor/libgit2/include/git2/filter.h +14 -7
- data/vendor/libgit2/include/git2/global.h +8 -1
- data/vendor/libgit2/include/git2/graph.h +3 -2
- data/vendor/libgit2/include/git2/ignore.h +10 -0
- data/vendor/libgit2/include/git2/index.h +99 -14
- data/vendor/libgit2/include/git2/indexer.h +21 -4
- data/vendor/libgit2/include/git2/mailmap.h +7 -1
- data/vendor/libgit2/include/git2/merge.h +46 -1
- data/vendor/libgit2/include/git2/message.h +2 -2
- data/vendor/libgit2/include/git2/net.h +3 -1
- data/vendor/libgit2/include/git2/notes.h +9 -6
- data/vendor/libgit2/include/git2/object.h +9 -8
- data/vendor/libgit2/include/git2/odb.h +91 -49
- data/vendor/libgit2/include/git2/odb_backend.h +80 -52
- data/vendor/libgit2/include/git2/oid.h +23 -24
- data/vendor/libgit2/include/git2/oidarray.h +7 -1
- data/vendor/libgit2/include/git2/pack.h +13 -1
- data/vendor/libgit2/include/git2/patch.h +2 -3
- data/vendor/libgit2/include/git2/pathspec.h +9 -0
- data/vendor/libgit2/include/git2/proxy.h +10 -0
- data/vendor/libgit2/include/git2/rebase.h +9 -6
- data/vendor/libgit2/include/git2/refdb.h +2 -2
- data/vendor/libgit2/include/git2/reflog.h +3 -2
- data/vendor/libgit2/include/git2/refs.h +9 -6
- data/vendor/libgit2/include/git2/refspec.h +14 -4
- data/vendor/libgit2/include/git2/remote.h +94 -18
- data/vendor/libgit2/include/git2/repository.h +57 -21
- data/vendor/libgit2/include/git2/reset.h +16 -3
- data/vendor/libgit2/include/git2/revert.h +9 -4
- data/vendor/libgit2/include/git2/revparse.h +3 -3
- data/vendor/libgit2/include/git2/revwalk.h +3 -2
- data/vendor/libgit2/include/git2/signature.h +46 -1
- data/vendor/libgit2/include/git2/stash.h +17 -3
- data/vendor/libgit2/include/git2/status.h +10 -6
- data/vendor/libgit2/include/git2/stdint.h +87 -85
- data/vendor/libgit2/include/git2/strarray.h +2 -3
- data/vendor/libgit2/include/git2/submodule.h +20 -9
- data/vendor/libgit2/include/git2/sys/alloc.h +12 -0
- data/vendor/libgit2/include/git2/sys/commit.h +77 -3
- data/vendor/libgit2/include/git2/sys/commit_graph.h +103 -62
- data/vendor/libgit2/include/git2/sys/config.h +80 -4
- data/vendor/libgit2/include/git2/sys/credential.h +4 -3
- data/vendor/libgit2/include/git2/sys/diff.h +21 -1
- data/vendor/libgit2/include/git2/sys/email.h +7 -0
- data/vendor/libgit2/include/git2/sys/errors.h +76 -0
- data/vendor/libgit2/include/git2/sys/filter.h +66 -3
- data/vendor/libgit2/include/git2/sys/hashsig.h +11 -0
- data/vendor/libgit2/include/git2/sys/index.h +3 -2
- data/vendor/libgit2/include/git2/sys/mempack.h +32 -2
- data/vendor/libgit2/include/git2/sys/merge.h +55 -7
- data/vendor/libgit2/include/git2/sys/midx.h +43 -4
- data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -3
- data/vendor/libgit2/include/git2/sys/openssl.h +8 -1
- data/vendor/libgit2/include/git2/sys/path.h +12 -1
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +40 -36
- data/vendor/libgit2/include/git2/sys/refs.h +3 -2
- data/vendor/libgit2/include/git2/sys/remote.h +8 -1
- data/vendor/libgit2/include/git2/sys/repository.h +63 -3
- data/vendor/libgit2/include/git2/sys/stream.h +11 -2
- data/vendor/libgit2/include/git2/sys/transport.h +24 -3
- data/vendor/libgit2/include/git2/tag.h +3 -1
- data/vendor/libgit2/include/git2/trace.h +9 -3
- data/vendor/libgit2/include/git2/transaction.h +3 -2
- data/vendor/libgit2/include/git2/transport.h +11 -3
- data/vendor/libgit2/include/git2/tree.h +16 -5
- data/vendor/libgit2/include/git2/types.h +19 -3
- data/vendor/libgit2/include/git2/version.h +44 -8
- data/vendor/libgit2/include/git2/worktree.h +16 -6
- data/vendor/libgit2/src/CMakeLists.txt +6 -4
- data/vendor/libgit2/src/cli/CMakeLists.txt +2 -2
- data/vendor/libgit2/src/cli/cmd.c +1 -1
- data/vendor/libgit2/src/cli/cmd.h +4 -0
- data/vendor/libgit2/src/cli/cmd_blame.c +287 -0
- data/vendor/libgit2/src/cli/cmd_cat_file.c +6 -8
- data/vendor/libgit2/src/cli/cmd_clone.c +5 -7
- data/vendor/libgit2/src/cli/cmd_config.c +241 -0
- data/vendor/libgit2/src/cli/cmd_hash_object.c +6 -8
- data/vendor/libgit2/src/cli/cmd_help.c +6 -7
- data/vendor/libgit2/src/cli/cmd_index_pack.c +114 -0
- data/vendor/libgit2/src/cli/cmd_init.c +102 -0
- data/vendor/libgit2/src/cli/common.c +168 -0
- data/vendor/libgit2/src/cli/common.h +63 -0
- data/vendor/libgit2/src/cli/error.h +1 -1
- data/vendor/libgit2/src/cli/main.c +52 -24
- data/vendor/libgit2/src/cli/opt.c +29 -3
- data/vendor/libgit2/src/cli/opt.h +21 -3
- data/vendor/libgit2/src/cli/opt_usage.c +102 -33
- data/vendor/libgit2/src/cli/opt_usage.h +6 -1
- data/vendor/libgit2/src/cli/progress.c +51 -2
- data/vendor/libgit2/src/cli/progress.h +12 -0
- data/vendor/libgit2/src/cli/unix/sighandler.c +2 -1
- data/vendor/libgit2/src/cli/win32/precompiled.h +1 -1
- data/vendor/libgit2/src/cli/win32/sighandler.c +1 -1
- data/vendor/libgit2/src/libgit2/CMakeLists.txt +26 -8
- data/vendor/libgit2/src/libgit2/apply.c +10 -13
- data/vendor/libgit2/src/libgit2/attr.c +30 -13
- data/vendor/libgit2/src/libgit2/attr_file.c +7 -2
- data/vendor/libgit2/src/libgit2/attr_file.h +2 -0
- data/vendor/libgit2/src/libgit2/attrcache.c +69 -33
- data/vendor/libgit2/src/libgit2/attrcache.h +5 -9
- data/vendor/libgit2/src/libgit2/blame.c +130 -44
- data/vendor/libgit2/src/libgit2/blame.h +1 -0
- data/vendor/libgit2/src/libgit2/cache.c +22 -17
- data/vendor/libgit2/src/libgit2/cache.h +7 -9
- data/vendor/libgit2/src/libgit2/checkout.c +34 -24
- data/vendor/libgit2/src/libgit2/checkout.h +0 -2
- data/vendor/libgit2/src/libgit2/cherrypick.c +1 -2
- data/vendor/libgit2/src/libgit2/clone.c +186 -166
- data/vendor/libgit2/src/libgit2/clone.h +4 -1
- data/vendor/libgit2/src/libgit2/commit.c +92 -0
- data/vendor/libgit2/src/libgit2/commit_graph.c +67 -56
- data/vendor/libgit2/src/libgit2/commit_graph.h +1 -2
- data/vendor/libgit2/src/libgit2/config.c +389 -298
- data/vendor/libgit2/src/libgit2/config.cmake.in +3 -0
- data/vendor/libgit2/src/libgit2/config.h +9 -4
- data/vendor/libgit2/src/libgit2/config_backend.h +8 -10
- data/vendor/libgit2/src/libgit2/config_cache.c +4 -5
- data/vendor/libgit2/src/libgit2/config_file.c +99 -88
- data/vendor/libgit2/src/libgit2/config_list.c +285 -0
- data/vendor/libgit2/src/libgit2/config_list.h +32 -0
- data/vendor/libgit2/src/libgit2/config_mem.c +194 -40
- data/vendor/libgit2/src/libgit2/config_parse.c +10 -9
- data/vendor/libgit2/src/libgit2/config_snapshot.c +24 -31
- data/vendor/libgit2/src/libgit2/describe.c +24 -24
- data/vendor/libgit2/src/libgit2/diff.c +1 -1
- data/vendor/libgit2/src/libgit2/diff_driver.c +12 -19
- data/vendor/libgit2/src/libgit2/diff_driver.h +2 -2
- data/vendor/libgit2/src/libgit2/diff_generate.c +3 -3
- data/vendor/libgit2/src/libgit2/diff_parse.c +2 -2
- data/vendor/libgit2/src/libgit2/diff_print.c +65 -9
- data/vendor/libgit2/src/libgit2/diff_tform.c +36 -8
- data/vendor/libgit2/src/libgit2/email.c +1 -0
- data/vendor/libgit2/src/libgit2/fetch.c +5 -3
- data/vendor/libgit2/src/libgit2/filter.c +5 -5
- data/vendor/libgit2/src/libgit2/git2.rc +3 -3
- data/vendor/libgit2/src/libgit2/grafts.c +18 -20
- data/vendor/libgit2/src/libgit2/grafts.h +0 -1
- data/vendor/libgit2/src/libgit2/graph.c +1 -1
- data/vendor/libgit2/src/libgit2/hashmap_oid.h +30 -0
- data/vendor/libgit2/src/libgit2/ignore.c +9 -5
- data/vendor/libgit2/src/libgit2/index.c +68 -90
- data/vendor/libgit2/src/libgit2/index.h +2 -2
- data/vendor/libgit2/src/libgit2/index_map.c +95 -0
- data/vendor/libgit2/src/libgit2/index_map.h +28 -0
- data/vendor/libgit2/src/libgit2/indexer.c +34 -38
- data/vendor/libgit2/src/libgit2/iterator.c +14 -8
- data/vendor/libgit2/src/libgit2/libgit2.c +153 -368
- data/vendor/libgit2/src/libgit2/mailmap.c +1 -1
- data/vendor/libgit2/src/libgit2/merge.c +42 -37
- data/vendor/libgit2/src/libgit2/merge_driver.c +2 -2
- data/vendor/libgit2/src/libgit2/midx.c +28 -15
- data/vendor/libgit2/src/libgit2/mwindow.c +38 -45
- data/vendor/libgit2/src/libgit2/mwindow.h +4 -0
- data/vendor/libgit2/src/libgit2/object.c +6 -5
- data/vendor/libgit2/src/libgit2/odb.c +5 -4
- data/vendor/libgit2/src/libgit2/odb_mempack.c +49 -17
- data/vendor/libgit2/src/libgit2/odb_pack.c +13 -5
- data/vendor/libgit2/src/libgit2/oid.c +32 -5
- data/vendor/libgit2/src/libgit2/oid.h +11 -0
- data/vendor/libgit2/src/libgit2/pack-objects.c +58 -31
- data/vendor/libgit2/src/libgit2/pack-objects.h +12 -4
- data/vendor/libgit2/src/libgit2/pack.c +30 -24
- data/vendor/libgit2/src/libgit2/pack.h +15 -10
- data/vendor/libgit2/src/libgit2/patch_parse.c +2 -2
- data/vendor/libgit2/src/libgit2/path.c +1 -1
- data/vendor/libgit2/src/libgit2/pathspec.c +1 -1
- data/vendor/libgit2/src/libgit2/push.c +79 -28
- data/vendor/libgit2/src/libgit2/push.h +1 -0
- data/vendor/libgit2/src/libgit2/refdb_fs.c +128 -61
- data/vendor/libgit2/src/libgit2/reflog.c +1 -2
- data/vendor/libgit2/src/libgit2/reflog.h +2 -0
- data/vendor/libgit2/src/libgit2/refs.c +26 -7
- data/vendor/libgit2/src/libgit2/refs.h +6 -1
- data/vendor/libgit2/src/libgit2/refspec.c +28 -1
- data/vendor/libgit2/src/libgit2/refspec.h +8 -0
- data/vendor/libgit2/src/libgit2/remote.c +121 -61
- data/vendor/libgit2/src/libgit2/repository.c +231 -51
- data/vendor/libgit2/src/libgit2/repository.h +10 -6
- data/vendor/libgit2/src/libgit2/revert.c +1 -2
- data/vendor/libgit2/src/libgit2/revparse.c +2 -2
- data/vendor/libgit2/src/libgit2/revwalk.c +13 -10
- data/vendor/libgit2/src/libgit2/revwalk.h +3 -3
- data/vendor/libgit2/src/libgit2/settings.c +468 -0
- data/vendor/libgit2/src/libgit2/settings.h +6 -2
- data/vendor/libgit2/src/libgit2/signature.c +132 -15
- data/vendor/libgit2/src/libgit2/signature.h +0 -1
- data/vendor/libgit2/src/libgit2/status.c +1 -1
- data/vendor/libgit2/src/libgit2/streams/mbedtls.c +54 -60
- data/vendor/libgit2/src/libgit2/streams/openssl.c +32 -7
- data/vendor/libgit2/src/libgit2/streams/openssl.h +2 -0
- data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.c +4 -0
- data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.h +3 -0
- data/vendor/libgit2/src/libgit2/streams/stransport.c +39 -7
- data/vendor/libgit2/src/libgit2/submodule.c +106 -63
- data/vendor/libgit2/src/libgit2/submodule.h +6 -7
- data/vendor/libgit2/src/libgit2/tag.c +1 -1
- data/vendor/libgit2/src/libgit2/trailer.c +6 -6
- data/vendor/libgit2/src/libgit2/transaction.c +26 -20
- data/vendor/libgit2/src/libgit2/transaction.h +4 -1
- data/vendor/libgit2/src/libgit2/transport.c +4 -1
- data/vendor/libgit2/src/libgit2/transports/credential.c +1 -1
- data/vendor/libgit2/src/libgit2/transports/http.c +1 -2
- data/vendor/libgit2/src/libgit2/transports/http.h +0 -10
- data/vendor/libgit2/src/libgit2/transports/httpclient.c +112 -72
- data/vendor/libgit2/src/libgit2/transports/httpparser.c +128 -0
- data/vendor/libgit2/src/libgit2/transports/httpparser.h +99 -0
- data/vendor/libgit2/src/libgit2/transports/local.c +8 -7
- data/vendor/libgit2/src/libgit2/transports/smart.c +20 -8
- data/vendor/libgit2/src/libgit2/transports/smart.h +4 -2
- data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +2 -2
- data/vendor/libgit2/src/libgit2/transports/smart_protocol.c +55 -10
- data/vendor/libgit2/src/libgit2/transports/ssh.c +41 -1103
- data/vendor/libgit2/src/libgit2/transports/ssh_exec.c +347 -0
- data/vendor/libgit2/src/libgit2/transports/ssh_exec.h +26 -0
- data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.c +1126 -0
- data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.h +28 -0
- data/vendor/libgit2/src/libgit2/transports/winhttp.c +35 -7
- data/vendor/libgit2/src/libgit2/tree.c +34 -26
- data/vendor/libgit2/src/libgit2/tree.h +3 -2
- data/vendor/libgit2/src/libgit2/worktree.c +14 -17
- data/vendor/libgit2/src/util/CMakeLists.txt +4 -6
- data/vendor/libgit2/src/util/alloc.c +4 -1
- data/vendor/libgit2/src/util/allocators/debugalloc.c +73 -0
- data/vendor/libgit2/src/{cli/cli.h → util/allocators/debugalloc.h} +6 -9
- data/vendor/libgit2/src/util/allocators/stdalloc.c +0 -10
- data/vendor/libgit2/src/util/array.h +18 -17
- data/vendor/libgit2/src/util/cc-compat.h +2 -0
- data/vendor/libgit2/src/util/ctype_compat.h +70 -0
- data/vendor/libgit2/src/util/date.c +22 -14
- data/vendor/libgit2/src/util/date.h +12 -0
- data/vendor/libgit2/src/util/errors.c +401 -0
- data/vendor/libgit2/src/{libgit2 → util}/errors.h +21 -17
- data/vendor/libgit2/src/util/fs_path.c +15 -4
- data/vendor/libgit2/src/util/fs_path.h +23 -0
- data/vendor/libgit2/src/util/futils.c +6 -5
- data/vendor/libgit2/src/util/futils.h +13 -4
- data/vendor/libgit2/src/util/git2_features.h.in +12 -1
- data/vendor/libgit2/src/util/git2_util.h +6 -0
- data/vendor/libgit2/src/util/hash/openssl.c +152 -0
- data/vendor/libgit2/src/util/hash/openssl.h +17 -1
- data/vendor/libgit2/src/util/hash/sha.h +4 -1
- data/vendor/libgit2/src/util/hashmap.h +424 -0
- data/vendor/libgit2/src/util/hashmap_str.h +43 -0
- data/vendor/libgit2/src/util/integer.h +3 -1
- data/vendor/libgit2/src/util/net.c +13 -7
- data/vendor/libgit2/src/util/net.h +2 -0
- data/vendor/libgit2/src/util/pool.c +1 -1
- data/vendor/libgit2/src/util/pool.h +5 -0
- data/vendor/libgit2/src/util/pqueue.h +1 -1
- data/vendor/libgit2/src/util/process.h +222 -0
- data/vendor/libgit2/src/util/rand.c +1 -7
- data/vendor/libgit2/src/util/regexp.c +1 -1
- data/vendor/libgit2/src/util/sortedcache.c +14 -13
- data/vendor/libgit2/src/util/sortedcache.h +3 -3
- data/vendor/libgit2/src/util/str.c +2 -2
- data/vendor/libgit2/src/util/strlist.c +108 -0
- data/vendor/libgit2/src/util/strlist.h +36 -0
- data/vendor/libgit2/src/util/unix/posix.h +0 -2
- data/vendor/libgit2/src/util/unix/process.c +629 -0
- data/vendor/libgit2/src/util/unix/realpath.c +23 -5
- data/vendor/libgit2/src/util/util.c +2 -2
- data/vendor/libgit2/src/util/util.h +4 -38
- data/vendor/libgit2/src/util/vector.c +3 -3
- data/vendor/libgit2/src/util/vector.h +2 -2
- data/vendor/libgit2/src/util/win32/posix_w32.c +29 -6
- data/vendor/libgit2/src/util/win32/process.c +506 -0
- metadata +45 -28
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -6
- data/vendor/libgit2/deps/http-parser/COPYING +0 -23
- data/vendor/libgit2/deps/http-parser/http_parser.c +0 -2182
- data/vendor/libgit2/deps/http-parser/http_parser.h +0 -305
- data/vendor/libgit2/deps/zlib/COPYING +0 -27
- data/vendor/libgit2/include/git2/sys/reflog.h +0 -21
- data/vendor/libgit2/src/libgit2/config_entries.c +0 -237
- data/vendor/libgit2/src/libgit2/config_entries.h +0 -24
- data/vendor/libgit2/src/libgit2/errors.c +0 -293
- data/vendor/libgit2/src/libgit2/idxmap.c +0 -157
- data/vendor/libgit2/src/libgit2/idxmap.h +0 -177
- data/vendor/libgit2/src/libgit2/libgit2.h +0 -15
- data/vendor/libgit2/src/libgit2/offmap.c +0 -101
- data/vendor/libgit2/src/libgit2/offmap.h +0 -133
- data/vendor/libgit2/src/libgit2/oidmap.c +0 -107
- data/vendor/libgit2/src/libgit2/oidmap.h +0 -128
- data/vendor/libgit2/src/libgit2/threadstate.c +0 -97
- data/vendor/libgit2/src/libgit2/threadstate.h +0 -22
- data/vendor/libgit2/src/libgit2/transports/ssh.h +0 -14
- data/vendor/libgit2/src/util/khash.h +0 -615
- data/vendor/libgit2/src/util/strmap.c +0 -100
- data/vendor/libgit2/src/util/strmap.h +0 -131
- /data/vendor/libgit2/cmake/{FindHTTPParser.cmake → FindHTTP_Parser.cmake} +0 -0
@@ -1,615 +0,0 @@
|
|
1
|
-
/* The MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2008, 2009, 2011 by Attractive Chaos <attractor@live.co.uk>
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
20
|
-
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
21
|
-
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
22
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
-
SOFTWARE.
|
24
|
-
*/
|
25
|
-
|
26
|
-
/*
|
27
|
-
An example:
|
28
|
-
|
29
|
-
#include "khash.h"
|
30
|
-
KHASH_MAP_INIT_INT(32, char)
|
31
|
-
int main() {
|
32
|
-
int ret, is_missing;
|
33
|
-
khiter_t k;
|
34
|
-
khash_t(32) *h = kh_init(32);
|
35
|
-
k = kh_put(32, h, 5, &ret);
|
36
|
-
kh_value(h, k) = 10;
|
37
|
-
k = kh_get(32, h, 10);
|
38
|
-
is_missing = (k == kh_end(h));
|
39
|
-
k = kh_get(32, h, 5);
|
40
|
-
kh_del(32, h, k);
|
41
|
-
for (k = kh_begin(h); k != kh_end(h); ++k)
|
42
|
-
if (kh_exist(h, k)) kh_value(h, k) = 1;
|
43
|
-
kh_destroy(32, h);
|
44
|
-
return 0;
|
45
|
-
}
|
46
|
-
*/
|
47
|
-
|
48
|
-
/*
|
49
|
-
2013-05-02 (0.2.8):
|
50
|
-
|
51
|
-
* Use quadratic probing. When the capacity is power of 2, stepping function
|
52
|
-
i*(i+1)/2 guarantees to traverse each bucket. It is better than double
|
53
|
-
hashing on cache performance and is more robust than linear probing.
|
54
|
-
|
55
|
-
In theory, double hashing should be more robust than quadratic probing.
|
56
|
-
However, my implementation is probably not for large hash tables, because
|
57
|
-
the second hash function is closely tied to the first hash function,
|
58
|
-
which reduce the effectiveness of double hashing.
|
59
|
-
|
60
|
-
Reference: http://research.cs.vt.edu/AVresearch/hashing/quadratic.php
|
61
|
-
|
62
|
-
2011-12-29 (0.2.7):
|
63
|
-
|
64
|
-
* Minor code clean up; no actual effect.
|
65
|
-
|
66
|
-
2011-09-16 (0.2.6):
|
67
|
-
|
68
|
-
* The capacity is a power of 2. This seems to dramatically improve the
|
69
|
-
speed for simple keys. Thank Zilong Tan for the suggestion. Reference:
|
70
|
-
|
71
|
-
- http://code.google.com/p/ulib/
|
72
|
-
- http://nothings.org/computer/judy/
|
73
|
-
|
74
|
-
* Allow to optionally use linear probing which usually has better
|
75
|
-
performance for random input. Double hashing is still the default as it
|
76
|
-
is more robust to certain non-random input.
|
77
|
-
|
78
|
-
* Added Wang's integer hash function (not used by default). This hash
|
79
|
-
function is more robust to certain non-random input.
|
80
|
-
|
81
|
-
2011-02-14 (0.2.5):
|
82
|
-
|
83
|
-
* Allow to declare global functions.
|
84
|
-
|
85
|
-
2009-09-26 (0.2.4):
|
86
|
-
|
87
|
-
* Improve portability
|
88
|
-
|
89
|
-
2008-09-19 (0.2.3):
|
90
|
-
|
91
|
-
* Corrected the example
|
92
|
-
* Improved interfaces
|
93
|
-
|
94
|
-
2008-09-11 (0.2.2):
|
95
|
-
|
96
|
-
* Improved speed a little in kh_put()
|
97
|
-
|
98
|
-
2008-09-10 (0.2.1):
|
99
|
-
|
100
|
-
* Added kh_clear()
|
101
|
-
* Fixed a compiling error
|
102
|
-
|
103
|
-
2008-09-02 (0.2.0):
|
104
|
-
|
105
|
-
* Changed to token concatenation which increases flexibility.
|
106
|
-
|
107
|
-
2008-08-31 (0.1.2):
|
108
|
-
|
109
|
-
* Fixed a bug in kh_get(), which has not been tested previously.
|
110
|
-
|
111
|
-
2008-08-31 (0.1.1):
|
112
|
-
|
113
|
-
* Added destructor
|
114
|
-
*/
|
115
|
-
|
116
|
-
|
117
|
-
#ifndef __AC_KHASH_H
|
118
|
-
#define __AC_KHASH_H
|
119
|
-
|
120
|
-
/*!
|
121
|
-
@header
|
122
|
-
|
123
|
-
Generic hash table library.
|
124
|
-
*/
|
125
|
-
|
126
|
-
#define AC_VERSION_KHASH_H "0.2.8"
|
127
|
-
|
128
|
-
#include <stdlib.h>
|
129
|
-
#include <string.h>
|
130
|
-
#include <limits.h>
|
131
|
-
|
132
|
-
/* compiler specific configuration */
|
133
|
-
|
134
|
-
typedef uint32_t khint32_t;
|
135
|
-
typedef uint64_t khint64_t;
|
136
|
-
|
137
|
-
#ifndef kh_inline
|
138
|
-
#ifdef _MSC_VER
|
139
|
-
#define kh_inline __inline
|
140
|
-
#elif defined(__GNUC__)
|
141
|
-
#define kh_inline __inline__
|
142
|
-
#else
|
143
|
-
#define kh_inline
|
144
|
-
#endif
|
145
|
-
#endif /* kh_inline */
|
146
|
-
|
147
|
-
typedef khint32_t khint_t;
|
148
|
-
typedef khint_t khiter_t;
|
149
|
-
|
150
|
-
#define __ac_isempty(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&2)
|
151
|
-
#define __ac_isdel(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&1)
|
152
|
-
#define __ac_iseither(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&3)
|
153
|
-
#define __ac_set_isdel_false(flag, i) (flag[i>>4]&=~(1ul<<((i&0xfU)<<1)))
|
154
|
-
#define __ac_set_isempty_false(flag, i) (flag[i>>4]&=~(2ul<<((i&0xfU)<<1)))
|
155
|
-
#define __ac_set_isboth_false(flag, i) (flag[i>>4]&=~(3ul<<((i&0xfU)<<1)))
|
156
|
-
#define __ac_set_isdel_true(flag, i) (flag[i>>4]|=1ul<<((i&0xfU)<<1))
|
157
|
-
|
158
|
-
#define __ac_fsize(m) ((m) < 16? 1 : (m)>>4)
|
159
|
-
|
160
|
-
#ifndef kroundup32
|
161
|
-
#define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x))
|
162
|
-
#endif
|
163
|
-
|
164
|
-
#ifndef kcalloc
|
165
|
-
#define kcalloc(N,Z) calloc(N,Z)
|
166
|
-
#endif
|
167
|
-
#ifndef kmalloc
|
168
|
-
#define kmalloc(Z) malloc(Z)
|
169
|
-
#endif
|
170
|
-
#ifndef krealloc
|
171
|
-
#define krealloc(P,Z) realloc(P,Z)
|
172
|
-
#endif
|
173
|
-
#ifndef kreallocarray
|
174
|
-
#define kreallocarray(P,N,Z) ((SIZE_MAX - N < Z) ? NULL : krealloc(P, (N*Z)))
|
175
|
-
#endif
|
176
|
-
#ifndef kfree
|
177
|
-
#define kfree(P) free(P)
|
178
|
-
#endif
|
179
|
-
|
180
|
-
static const double __ac_HASH_UPPER = 0.77;
|
181
|
-
|
182
|
-
#define __KHASH_TYPE(name, khkey_t, khval_t) \
|
183
|
-
typedef struct kh_##name##_s { \
|
184
|
-
khint_t n_buckets, size, n_occupied, upper_bound; \
|
185
|
-
khint32_t *flags; \
|
186
|
-
khkey_t *keys; \
|
187
|
-
khval_t *vals; \
|
188
|
-
} kh_##name##_t;
|
189
|
-
|
190
|
-
#define __KHASH_PROTOTYPES(name, khkey_t, khval_t) \
|
191
|
-
extern kh_##name##_t *kh_init_##name(void); \
|
192
|
-
extern void kh_destroy_##name(kh_##name##_t *h); \
|
193
|
-
extern void kh_clear_##name(kh_##name##_t *h); \
|
194
|
-
extern khint_t kh_get_##name(const kh_##name##_t *h, khkey_t key); \
|
195
|
-
extern int kh_resize_##name(kh_##name##_t *h, khint_t new_n_buckets); \
|
196
|
-
extern khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret); \
|
197
|
-
extern void kh_del_##name(kh_##name##_t *h, khint_t x);
|
198
|
-
|
199
|
-
#define __KHASH_IMPL(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \
|
200
|
-
SCOPE kh_##name##_t *kh_init_##name(void) { \
|
201
|
-
return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \
|
202
|
-
} \
|
203
|
-
SCOPE void kh_destroy_##name(kh_##name##_t *h) \
|
204
|
-
{ \
|
205
|
-
if (h) { \
|
206
|
-
kfree((void *)h->keys); kfree(h->flags); \
|
207
|
-
kfree((void *)h->vals); \
|
208
|
-
kfree(h); \
|
209
|
-
} \
|
210
|
-
} \
|
211
|
-
SCOPE void kh_clear_##name(kh_##name##_t *h) \
|
212
|
-
{ \
|
213
|
-
if (h && h->flags) { \
|
214
|
-
memset(h->flags, 0xaa, __ac_fsize(h->n_buckets) * sizeof(khint32_t)); \
|
215
|
-
h->size = h->n_occupied = 0; \
|
216
|
-
} \
|
217
|
-
} \
|
218
|
-
SCOPE khint_t kh_get_##name(const kh_##name##_t *h, khkey_t key) \
|
219
|
-
{ \
|
220
|
-
if (h->n_buckets) { \
|
221
|
-
khint_t k, i, last, mask, step = 0; \
|
222
|
-
mask = h->n_buckets - 1; \
|
223
|
-
k = __hash_func(key); i = k & mask; \
|
224
|
-
last = i; \
|
225
|
-
while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \
|
226
|
-
i = (i + (++step)) & mask; \
|
227
|
-
if (i == last) return h->n_buckets; \
|
228
|
-
} \
|
229
|
-
return __ac_iseither(h->flags, i)? h->n_buckets : i; \
|
230
|
-
} else return 0; \
|
231
|
-
} \
|
232
|
-
SCOPE int kh_resize_##name(kh_##name##_t *h, khint_t new_n_buckets) \
|
233
|
-
{ /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \
|
234
|
-
khint32_t *new_flags = 0; \
|
235
|
-
khint_t j = 1; \
|
236
|
-
{ \
|
237
|
-
kroundup32(new_n_buckets); \
|
238
|
-
if (new_n_buckets < 4) new_n_buckets = 4; \
|
239
|
-
if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 0; /* requested size is too small */ \
|
240
|
-
else { /* hash table size to be changed (shrink or expand); rehash */ \
|
241
|
-
new_flags = (khint32_t*)kreallocarray(NULL, __ac_fsize(new_n_buckets), sizeof(khint32_t)); \
|
242
|
-
if (!new_flags) return -1; \
|
243
|
-
memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \
|
244
|
-
if (h->n_buckets < new_n_buckets) { /* expand */ \
|
245
|
-
khkey_t *new_keys = (khkey_t*)kreallocarray((void *)h->keys, new_n_buckets, sizeof(khkey_t)); \
|
246
|
-
if (!new_keys) { kfree(new_flags); return -1; } \
|
247
|
-
h->keys = new_keys; \
|
248
|
-
if (kh_is_map) { \
|
249
|
-
khval_t *new_vals = (khval_t*)kreallocarray((void *)h->vals, new_n_buckets, sizeof(khval_t)); \
|
250
|
-
if (!new_vals) { kfree(new_flags); return -1; } \
|
251
|
-
h->vals = new_vals; \
|
252
|
-
} \
|
253
|
-
} /* otherwise shrink */ \
|
254
|
-
} \
|
255
|
-
} \
|
256
|
-
if (j) { /* rehashing is needed */ \
|
257
|
-
for (j = 0; j != h->n_buckets; ++j) { \
|
258
|
-
if (__ac_iseither(h->flags, j) == 0) { \
|
259
|
-
khkey_t key = h->keys[j]; \
|
260
|
-
khval_t val; \
|
261
|
-
khint_t new_mask; \
|
262
|
-
new_mask = new_n_buckets - 1; \
|
263
|
-
if (kh_is_map) val = h->vals[j]; \
|
264
|
-
__ac_set_isdel_true(h->flags, j); \
|
265
|
-
while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \
|
266
|
-
khint_t k, i, step = 0; \
|
267
|
-
k = __hash_func(key); \
|
268
|
-
i = k & new_mask; \
|
269
|
-
while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask; \
|
270
|
-
__ac_set_isempty_false(new_flags, i); \
|
271
|
-
if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { /* kick out the existing element */ \
|
272
|
-
{ khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \
|
273
|
-
if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \
|
274
|
-
__ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \
|
275
|
-
} else { /* write the element and jump out of the loop */ \
|
276
|
-
h->keys[i] = key; \
|
277
|
-
if (kh_is_map) h->vals[i] = val; \
|
278
|
-
break; \
|
279
|
-
} \
|
280
|
-
} \
|
281
|
-
} \
|
282
|
-
} \
|
283
|
-
if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \
|
284
|
-
h->keys = (khkey_t*)kreallocarray((void *)h->keys, new_n_buckets, sizeof(khkey_t)); \
|
285
|
-
if (kh_is_map) h->vals = (khval_t*)kreallocarray((void *)h->vals, new_n_buckets, sizeof(khval_t)); \
|
286
|
-
} \
|
287
|
-
kfree(h->flags); /* free the working space */ \
|
288
|
-
h->flags = new_flags; \
|
289
|
-
h->n_buckets = new_n_buckets; \
|
290
|
-
h->n_occupied = h->size; \
|
291
|
-
h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \
|
292
|
-
} \
|
293
|
-
return 0; \
|
294
|
-
} \
|
295
|
-
SCOPE khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret) \
|
296
|
-
{ \
|
297
|
-
khint_t x; \
|
298
|
-
if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \
|
299
|
-
if (h->n_buckets > (h->size<<1)) { \
|
300
|
-
if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \
|
301
|
-
*ret = -1; return h->n_buckets; \
|
302
|
-
} \
|
303
|
-
} else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \
|
304
|
-
*ret = -1; return h->n_buckets; \
|
305
|
-
} \
|
306
|
-
} /* TODO: to implement automatically shrinking; resize() already support shrinking */ \
|
307
|
-
{ \
|
308
|
-
khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \
|
309
|
-
x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \
|
310
|
-
if (__ac_isempty(h->flags, i)) x = i; /* for speed up */ \
|
311
|
-
else { \
|
312
|
-
last = i; \
|
313
|
-
while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \
|
314
|
-
if (__ac_isdel(h->flags, i)) site = i; \
|
315
|
-
i = (i + (++step)) & mask; \
|
316
|
-
if (i == last) { x = site; break; } \
|
317
|
-
} \
|
318
|
-
if (x == h->n_buckets) { \
|
319
|
-
if (__ac_isempty(h->flags, i) && site != h->n_buckets) x = site; \
|
320
|
-
else x = i; \
|
321
|
-
} \
|
322
|
-
} \
|
323
|
-
} \
|
324
|
-
if (__ac_isempty(h->flags, x)) { /* not present at all */ \
|
325
|
-
h->keys[x] = key; \
|
326
|
-
__ac_set_isboth_false(h->flags, x); \
|
327
|
-
++h->size; ++h->n_occupied; \
|
328
|
-
*ret = 1; \
|
329
|
-
} else if (__ac_isdel(h->flags, x)) { /* deleted */ \
|
330
|
-
h->keys[x] = key; \
|
331
|
-
__ac_set_isboth_false(h->flags, x); \
|
332
|
-
++h->size; \
|
333
|
-
*ret = 2; \
|
334
|
-
} else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \
|
335
|
-
return x; \
|
336
|
-
} \
|
337
|
-
SCOPE void kh_del_##name(kh_##name##_t *h, khint_t x) \
|
338
|
-
{ \
|
339
|
-
if (x != h->n_buckets && !__ac_iseither(h->flags, x)) { \
|
340
|
-
__ac_set_isdel_true(h->flags, x); \
|
341
|
-
--h->size; \
|
342
|
-
} \
|
343
|
-
}
|
344
|
-
|
345
|
-
#define KHASH_DECLARE(name, khkey_t, khval_t) \
|
346
|
-
__KHASH_TYPE(name, khkey_t, khval_t) \
|
347
|
-
__KHASH_PROTOTYPES(name, khkey_t, khval_t)
|
348
|
-
|
349
|
-
#define KHASH_INIT2(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \
|
350
|
-
__KHASH_TYPE(name, khkey_t, khval_t) \
|
351
|
-
__KHASH_IMPL(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)
|
352
|
-
|
353
|
-
#define KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \
|
354
|
-
KHASH_INIT2(name, static kh_inline, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)
|
355
|
-
|
356
|
-
/* --- BEGIN OF HASH FUNCTIONS --- */
|
357
|
-
|
358
|
-
/*! @function
|
359
|
-
@abstract Integer hash function
|
360
|
-
@param key The integer [khint32_t]
|
361
|
-
@return The hash value [khint_t]
|
362
|
-
*/
|
363
|
-
#define kh_int_hash_func(key) (khint32_t)(key)
|
364
|
-
/*! @function
|
365
|
-
@abstract Integer comparison function
|
366
|
-
*/
|
367
|
-
#define kh_int_hash_equal(a, b) ((a) == (b))
|
368
|
-
/*! @function
|
369
|
-
@abstract 64-bit integer hash function
|
370
|
-
@param key The integer [khint64_t]
|
371
|
-
@return The hash value [khint_t]
|
372
|
-
*/
|
373
|
-
#define kh_int64_hash_func(key) (khint32_t)((key)>>33^(key)^(key)<<11)
|
374
|
-
/*! @function
|
375
|
-
@abstract 64-bit integer comparison function
|
376
|
-
*/
|
377
|
-
#define kh_int64_hash_equal(a, b) ((a) == (b))
|
378
|
-
/*! @function
|
379
|
-
@abstract const char* hash function
|
380
|
-
@param s Pointer to a null terminated string
|
381
|
-
@return The hash value
|
382
|
-
*/
|
383
|
-
static kh_inline khint_t __ac_X31_hash_string(const char *s)
|
384
|
-
{
|
385
|
-
khint_t h = (khint_t)*s;
|
386
|
-
if (h) for (++s ; *s; ++s) h = (h << 5) - h + (khint_t)*s;
|
387
|
-
return h;
|
388
|
-
}
|
389
|
-
/*! @function
|
390
|
-
@abstract Another interface to const char* hash function
|
391
|
-
@param key Pointer to a null terminated string [const char*]
|
392
|
-
@return The hash value [khint_t]
|
393
|
-
*/
|
394
|
-
#define kh_str_hash_func(key) __ac_X31_hash_string(key)
|
395
|
-
/*! @function
|
396
|
-
@abstract Const char* comparison function
|
397
|
-
*/
|
398
|
-
#define kh_str_hash_equal(a, b) (strcmp(a, b) == 0)
|
399
|
-
|
400
|
-
static kh_inline khint_t __ac_Wang_hash(khint_t key)
|
401
|
-
{
|
402
|
-
key += ~(key << 15);
|
403
|
-
key ^= (key >> 10);
|
404
|
-
key += (key << 3);
|
405
|
-
key ^= (key >> 6);
|
406
|
-
key += ~(key << 11);
|
407
|
-
key ^= (key >> 16);
|
408
|
-
return key;
|
409
|
-
}
|
410
|
-
#define kh_int_hash_func2(k) __ac_Wang_hash((khint_t)key)
|
411
|
-
|
412
|
-
/* --- END OF HASH FUNCTIONS --- */
|
413
|
-
|
414
|
-
/* Other convenient macros... */
|
415
|
-
|
416
|
-
/*!
|
417
|
-
@abstract Type of the hash table.
|
418
|
-
@param name Name of the hash table [symbol]
|
419
|
-
*/
|
420
|
-
#define khash_t(name) kh_##name##_t
|
421
|
-
|
422
|
-
/*! @function
|
423
|
-
@abstract Initiate a hash table.
|
424
|
-
@param name Name of the hash table [symbol]
|
425
|
-
@return Pointer to the hash table [khash_t(name)*]
|
426
|
-
*/
|
427
|
-
#define kh_init(name) kh_init_##name()
|
428
|
-
|
429
|
-
/*! @function
|
430
|
-
@abstract Destroy a hash table.
|
431
|
-
@param name Name of the hash table [symbol]
|
432
|
-
@param h Pointer to the hash table [khash_t(name)*]
|
433
|
-
*/
|
434
|
-
#define kh_destroy(name, h) kh_destroy_##name(h)
|
435
|
-
|
436
|
-
/*! @function
|
437
|
-
@abstract Reset a hash table without deallocating memory.
|
438
|
-
@param name Name of the hash table [symbol]
|
439
|
-
@param h Pointer to the hash table [khash_t(name)*]
|
440
|
-
*/
|
441
|
-
#define kh_clear(name, h) kh_clear_##name(h)
|
442
|
-
|
443
|
-
/*! @function
|
444
|
-
@abstract Resize a hash table.
|
445
|
-
@param name Name of the hash table [symbol]
|
446
|
-
@param h Pointer to the hash table [khash_t(name)*]
|
447
|
-
@param s New size [khint_t]
|
448
|
-
*/
|
449
|
-
#define kh_resize(name, h, s) kh_resize_##name(h, s)
|
450
|
-
|
451
|
-
/*! @function
|
452
|
-
@abstract Insert a key to the hash table.
|
453
|
-
@param name Name of the hash table [symbol]
|
454
|
-
@param h Pointer to the hash table [khash_t(name)*]
|
455
|
-
@param k Key [type of keys]
|
456
|
-
@param r Extra return code: -1 if the operation failed;
|
457
|
-
0 if the key is present in the hash table;
|
458
|
-
1 if the bucket is empty (never used); 2 if the element in
|
459
|
-
the bucket has been deleted [int*]
|
460
|
-
@return Iterator to the inserted element [khint_t]
|
461
|
-
*/
|
462
|
-
#define kh_put(name, h, k, r) kh_put_##name(h, k, r)
|
463
|
-
|
464
|
-
/*! @function
|
465
|
-
@abstract Retrieve a key from the hash table.
|
466
|
-
@param name Name of the hash table [symbol]
|
467
|
-
@param h Pointer to the hash table [khash_t(name)*]
|
468
|
-
@param k Key [type of keys]
|
469
|
-
@return Iterator to the found element, or kh_end(h) if the element is absent [khint_t]
|
470
|
-
*/
|
471
|
-
#define kh_get(name, h, k) kh_get_##name(h, k)
|
472
|
-
|
473
|
-
/*! @function
|
474
|
-
@abstract Remove a key from the hash table.
|
475
|
-
@param name Name of the hash table [symbol]
|
476
|
-
@param h Pointer to the hash table [khash_t(name)*]
|
477
|
-
@param k Iterator to the element to be deleted [khint_t]
|
478
|
-
*/
|
479
|
-
#define kh_del(name, h, k) kh_del_##name(h, k)
|
480
|
-
|
481
|
-
/*! @function
|
482
|
-
@abstract Test whether a bucket contains data.
|
483
|
-
@param h Pointer to the hash table [khash_t(name)*]
|
484
|
-
@param x Iterator to the bucket [khint_t]
|
485
|
-
@return 1 if containing data; 0 otherwise [int]
|
486
|
-
*/
|
487
|
-
#define kh_exist(h, x) (!__ac_iseither((h)->flags, (x)))
|
488
|
-
|
489
|
-
/*! @function
|
490
|
-
@abstract Get key given an iterator
|
491
|
-
@param h Pointer to the hash table [khash_t(name)*]
|
492
|
-
@param x Iterator to the bucket [khint_t]
|
493
|
-
@return Key [type of keys]
|
494
|
-
*/
|
495
|
-
#define kh_key(h, x) ((h)->keys[x])
|
496
|
-
|
497
|
-
/*! @function
|
498
|
-
@abstract Get value given an iterator
|
499
|
-
@param h Pointer to the hash table [khash_t(name)*]
|
500
|
-
@param x Iterator to the bucket [khint_t]
|
501
|
-
@return Value [type of values]
|
502
|
-
@discussion For hash sets, calling this results in segfault.
|
503
|
-
*/
|
504
|
-
#define kh_val(h, x) ((h)->vals[x])
|
505
|
-
|
506
|
-
/*! @function
|
507
|
-
@abstract Alias of kh_val()
|
508
|
-
*/
|
509
|
-
#define kh_value(h, x) ((h)->vals[x])
|
510
|
-
|
511
|
-
/*! @function
|
512
|
-
@abstract Get the start iterator
|
513
|
-
@param h Pointer to the hash table [khash_t(name)*]
|
514
|
-
@return The start iterator [khint_t]
|
515
|
-
*/
|
516
|
-
#define kh_begin(h) (khint_t)(0)
|
517
|
-
|
518
|
-
/*! @function
|
519
|
-
@abstract Get the end iterator
|
520
|
-
@param h Pointer to the hash table [khash_t(name)*]
|
521
|
-
@return The end iterator [khint_t]
|
522
|
-
*/
|
523
|
-
#define kh_end(h) ((h)->n_buckets)
|
524
|
-
|
525
|
-
/*! @function
|
526
|
-
@abstract Get the number of elements in the hash table
|
527
|
-
@param h Pointer to the hash table [khash_t(name)*]
|
528
|
-
@return Number of elements in the hash table [khint_t]
|
529
|
-
*/
|
530
|
-
#define kh_size(h) ((h)->size)
|
531
|
-
|
532
|
-
/*! @function
|
533
|
-
@abstract Get the number of buckets in the hash table
|
534
|
-
@param h Pointer to the hash table [khash_t(name)*]
|
535
|
-
@return Number of buckets in the hash table [khint_t]
|
536
|
-
*/
|
537
|
-
#define kh_n_buckets(h) ((h)->n_buckets)
|
538
|
-
|
539
|
-
/*! @function
|
540
|
-
@abstract Iterate over the entries in the hash table
|
541
|
-
@param h Pointer to the hash table [khash_t(name)*]
|
542
|
-
@param kvar Variable to which key will be assigned
|
543
|
-
@param vvar Variable to which value will be assigned
|
544
|
-
@param code Block of code to execute
|
545
|
-
*/
|
546
|
-
#define kh_foreach(h, kvar, vvar, code) { khint_t __i; \
|
547
|
-
for (__i = kh_begin(h); __i != kh_end(h); ++__i) { \
|
548
|
-
if (!kh_exist(h,__i)) continue; \
|
549
|
-
(kvar) = kh_key(h,__i); \
|
550
|
-
(vvar) = kh_val(h,__i); \
|
551
|
-
code; \
|
552
|
-
} }
|
553
|
-
|
554
|
-
/*! @function
|
555
|
-
@abstract Iterate over the values in the hash table
|
556
|
-
@param h Pointer to the hash table [khash_t(name)*]
|
557
|
-
@param vvar Variable to which value will be assigned
|
558
|
-
@param code Block of code to execute
|
559
|
-
*/
|
560
|
-
#define kh_foreach_value(h, vvar, code) { khint_t __i; \
|
561
|
-
for (__i = kh_begin(h); __i != kh_end(h); ++__i) { \
|
562
|
-
if (!kh_exist(h,__i)) continue; \
|
563
|
-
(vvar) = kh_val(h,__i); \
|
564
|
-
code; \
|
565
|
-
} }
|
566
|
-
|
567
|
-
/* More convenient interfaces */
|
568
|
-
|
569
|
-
/*! @function
|
570
|
-
@abstract Instantiate a hash set containing integer keys
|
571
|
-
@param name Name of the hash table [symbol]
|
572
|
-
*/
|
573
|
-
#define KHASH_SET_INIT_INT(name) \
|
574
|
-
KHASH_INIT(name, khint32_t, char, 0, kh_int_hash_func, kh_int_hash_equal)
|
575
|
-
|
576
|
-
/*! @function
|
577
|
-
@abstract Instantiate a hash map containing integer keys
|
578
|
-
@param name Name of the hash table [symbol]
|
579
|
-
@param khval_t Type of values [type]
|
580
|
-
*/
|
581
|
-
#define KHASH_MAP_INIT_INT(name, khval_t) \
|
582
|
-
KHASH_INIT(name, khint32_t, khval_t, 1, kh_int_hash_func, kh_int_hash_equal)
|
583
|
-
|
584
|
-
/*! @function
|
585
|
-
@abstract Instantiate a hash map containing 64-bit integer keys
|
586
|
-
@param name Name of the hash table [symbol]
|
587
|
-
*/
|
588
|
-
#define KHASH_SET_INIT_INT64(name) \
|
589
|
-
KHASH_INIT(name, khint64_t, char, 0, kh_int64_hash_func, kh_int64_hash_equal)
|
590
|
-
|
591
|
-
/*! @function
|
592
|
-
@abstract Instantiate a hash map containing 64-bit integer keys
|
593
|
-
@param name Name of the hash table [symbol]
|
594
|
-
@param khval_t Type of values [type]
|
595
|
-
*/
|
596
|
-
#define KHASH_MAP_INIT_INT64(name, khval_t) \
|
597
|
-
KHASH_INIT(name, khint64_t, khval_t, 1, kh_int64_hash_func, kh_int64_hash_equal)
|
598
|
-
|
599
|
-
typedef const char *kh_cstr_t;
|
600
|
-
/*! @function
|
601
|
-
@abstract Instantiate a hash map containing const char* keys
|
602
|
-
@param name Name of the hash table [symbol]
|
603
|
-
*/
|
604
|
-
#define KHASH_SET_INIT_STR(name) \
|
605
|
-
KHASH_INIT(name, kh_cstr_t, char, 0, kh_str_hash_func, kh_str_hash_equal)
|
606
|
-
|
607
|
-
/*! @function
|
608
|
-
@abstract Instantiate a hash map containing const char* keys
|
609
|
-
@param name Name of the hash table [symbol]
|
610
|
-
@param khval_t Type of values [type]
|
611
|
-
*/
|
612
|
-
#define KHASH_MAP_INIT_STR(name, khval_t) \
|
613
|
-
KHASH_INIT(name, kh_cstr_t, khval_t, 1, kh_str_hash_func, kh_str_hash_equal)
|
614
|
-
|
615
|
-
#endif /* __AC_KHASH_H */
|
@@ -1,100 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
-
*
|
4
|
-
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
-
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
-
*/
|
7
|
-
|
8
|
-
#include "strmap.h"
|
9
|
-
|
10
|
-
#define kmalloc git__malloc
|
11
|
-
#define kcalloc git__calloc
|
12
|
-
#define krealloc git__realloc
|
13
|
-
#define kreallocarray git__reallocarray
|
14
|
-
#define kfree git__free
|
15
|
-
#include "khash.h"
|
16
|
-
|
17
|
-
__KHASH_TYPE(str, const char *, void *)
|
18
|
-
|
19
|
-
__KHASH_IMPL(str, static kh_inline, const char *, void *, 1, kh_str_hash_func, kh_str_hash_equal)
|
20
|
-
|
21
|
-
int git_strmap_new(git_strmap **out)
|
22
|
-
{
|
23
|
-
*out = kh_init(str);
|
24
|
-
GIT_ERROR_CHECK_ALLOC(*out);
|
25
|
-
|
26
|
-
return 0;
|
27
|
-
}
|
28
|
-
|
29
|
-
void git_strmap_free(git_strmap *map)
|
30
|
-
{
|
31
|
-
kh_destroy(str, map);
|
32
|
-
}
|
33
|
-
|
34
|
-
void git_strmap_clear(git_strmap *map)
|
35
|
-
{
|
36
|
-
kh_clear(str, map);
|
37
|
-
}
|
38
|
-
|
39
|
-
size_t git_strmap_size(git_strmap *map)
|
40
|
-
{
|
41
|
-
return kh_size(map);
|
42
|
-
}
|
43
|
-
|
44
|
-
void *git_strmap_get(git_strmap *map, const char *key)
|
45
|
-
{
|
46
|
-
size_t idx = kh_get(str, map, key);
|
47
|
-
if (idx == kh_end(map) || !kh_exist(map, idx))
|
48
|
-
return NULL;
|
49
|
-
return kh_val(map, idx);
|
50
|
-
}
|
51
|
-
|
52
|
-
int git_strmap_set(git_strmap *map, const char *key, void *value)
|
53
|
-
{
|
54
|
-
size_t idx;
|
55
|
-
int rval;
|
56
|
-
|
57
|
-
idx = kh_put(str, map, key, &rval);
|
58
|
-
if (rval < 0)
|
59
|
-
return -1;
|
60
|
-
|
61
|
-
if (rval == 0)
|
62
|
-
kh_key(map, idx) = key;
|
63
|
-
|
64
|
-
kh_val(map, idx) = value;
|
65
|
-
|
66
|
-
return 0;
|
67
|
-
}
|
68
|
-
|
69
|
-
int git_strmap_delete(git_strmap *map, const char *key)
|
70
|
-
{
|
71
|
-
khiter_t idx = kh_get(str, map, key);
|
72
|
-
if (idx == kh_end(map))
|
73
|
-
return GIT_ENOTFOUND;
|
74
|
-
kh_del(str, map, idx);
|
75
|
-
return 0;
|
76
|
-
}
|
77
|
-
|
78
|
-
int git_strmap_exists(git_strmap *map, const char *key)
|
79
|
-
{
|
80
|
-
return kh_get(str, map, key) != kh_end(map);
|
81
|
-
}
|
82
|
-
|
83
|
-
int git_strmap_iterate(void **value, git_strmap *map, size_t *iter, const char **key)
|
84
|
-
{
|
85
|
-
size_t i = *iter;
|
86
|
-
|
87
|
-
while (i < map->n_buckets && !kh_exist(map, i))
|
88
|
-
i++;
|
89
|
-
|
90
|
-
if (i >= map->n_buckets)
|
91
|
-
return GIT_ITEROVER;
|
92
|
-
|
93
|
-
if (key)
|
94
|
-
*key = kh_key(map, i);
|
95
|
-
if (value)
|
96
|
-
*value = kh_val(map, i);
|
97
|
-
*iter = ++i;
|
98
|
-
|
99
|
-
return 0;
|
100
|
-
}
|