mathematical 1.5.12 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -30
- data/Rakefile +1 -0
- data/ext/mathematical/CMakeLists.txt +4 -1
- data/ext/mathematical/extconf.rb +4 -1
- data/ext/mathematical/lasem/NEWS +17 -0
- data/ext/mathematical/lasem/autogen.sh +5 -2
- data/ext/mathematical/lasem/configure.ac +3 -3
- data/ext/mathematical/lasem/po/cs.po +50 -18
- data/ext/mathematical/lasem/po/de.po +62 -26
- data/ext/mathematical/lasem/po/es.po +27 -18
- data/ext/mathematical/lasem/po/hu.po +50 -21
- data/ext/mathematical/lasem/po/id.po +49 -16
- data/ext/mathematical/lasem/po/lt.po +47 -18
- data/ext/mathematical/lasem/po/pl.po +53 -24
- data/ext/mathematical/lasem/po/pt_BR.po +70 -29
- data/ext/mathematical/lasem/po/sl.po +43 -29
- data/ext/mathematical/lasem/po/sr.po +67 -27
- data/ext/mathematical/lasem/po/sr@latin.po +67 -27
- data/ext/mathematical/lasem/po/sv.po +51 -18
- data/ext/mathematical/lasem/src/lasemrender.c +107 -14
- data/ext/mathematical/lasem/src/lsmitex.c +1 -0
- data/ext/mathematical/lasem/src/lsmsvgelement.c +0 -2
- data/ext/mathematical/lasem/src/lsmsvglength.c +2 -2
- data/ext/mathematical/lasem/src/lsmsvgmatrix.c +16 -0
- data/ext/mathematical/lasem/src/lsmsvgmatrix.h +2 -1
- data/ext/mathematical/lasem/src/lsmsvgsvgelement.c +8 -2
- data/ext/mathematical/lasem_overrides.c +3 -3
- data/ext/mathematical/lib/liblasem.dylib +0 -0
- data/ext/mathematical/lib/libmtex2MML.a +0 -0
- data/ext/mathematical/mathematical.c +1 -1
- data/ext/mathematical/mtex2MML/CMakeLists.txt +5 -0
- data/ext/mathematical/mtex2MML/README.md +3 -3
- data/ext/mathematical/mtex2MML/SUPPORTED.md +2 -0
- data/ext/mathematical/mtex2MML/appveyor.yml +15 -5
- data/ext/mathematical/mtex2MML/build/CMakeCache.txt +181 -116
- data/ext/mathematical/mtex2MML/build/CMakeFiles/3.6.1/CMakeCCompiler.cmake +67 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/3.6.1/CMakeCXXCompiler.cmake +68 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/{2.8.10.1 → 3.6.1}/CMakeDetermineCompilerABI_C.bin +0 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/{2.8.10.1 → 3.6.1}/CMakeDetermineCompilerABI_CXX.bin +0 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/3.6.1/CMakeSystem.cmake +15 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/{2.8.10.1 → 3.6.1}/CompilerIdC/CMakeCCompilerId.c +223 -55
- data/ext/mathematical/mtex2MML/build/CMakeFiles/{2.8.10.1/CompilerIdCXX → 3.6.1/CompilerIdC}/a.out +0 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/{2.8.10.1 → 3.6.1}/CompilerIdCXX/CMakeCXXCompilerId.cpp +202 -44
- data/ext/mathematical/mtex2MML/build/CMakeFiles/{2.8.10.1/CompilerIdC → 3.6.1/CompilerIdCXX}/a.out +0 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/CMakeDirectoryInformation.cmake +8 -8
- data/ext/mathematical/mtex2MML/build/CMakeFiles/CMakeOutput.log +405 -109
- data/ext/mathematical/mtex2MML/build/CMakeFiles/CMakeRuleHashes.txt +29 -29
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Continuous.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Continuous.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Continuous.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousBuild.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousBuild.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousBuild.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousConfigure.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousConfigure.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousConfigure.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousCoverage.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousCoverage.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousCoverage.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousMemCheck.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousMemCheck.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousMemCheck.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousStart.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousStart.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousStart.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousSubmit.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousSubmit.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousSubmit.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousTest.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousTest.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousTest.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousUpdate.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousUpdate.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousUpdate.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Experimental.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Experimental.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Experimental.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalBuild.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalBuild.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalBuild.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalConfigure.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalConfigure.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalConfigure.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalCoverage.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalCoverage.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalCoverage.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalMemCheck.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalMemCheck.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalMemCheck.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalStart.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalStart.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalStart.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalSubmit.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalSubmit.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalSubmit.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalTest.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalTest.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalTest.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalUpdate.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalUpdate.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalUpdate.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Makefile.cmake +68 -60
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Makefile2 +564 -522
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Nightly.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Nightly.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Nightly.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyBuild.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyBuild.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyBuild.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyConfigure.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyConfigure.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyConfigure.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyCoverage.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyCoverage.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyCoverage.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyMemCheck.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyMemCheck.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyMemCheck.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyMemoryCheck.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyMemoryCheck.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyMemoryCheck.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyStart.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyStart.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyStart.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlySubmit.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlySubmit.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlySubmit.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyTest.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyTest.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyTest.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyUpdate.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyUpdate.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyUpdate.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/TargetDirectories.txt +28 -21
- data/ext/mathematical/mtex2MML/build/CMakeFiles/feature_tests.bin +0 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/feature_tests.c +34 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/feature_tests.cxx +405 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/format.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/format.dir/build.make +13 -6
- data/ext/mathematical/mtex2MML/build/CMakeFiles/format.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML.dir/DependInfo.cmake +16 -18
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML.dir/build.make +55 -42
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML.dir/flags.make +5 -3
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML.dir/link.txt +1 -1
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML.dir/progress.make +1 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/C.includecache +115 -27
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/DependInfo.cmake +16 -18
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/build.make +54 -42
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/cmake_clean_target.cmake +1 -1
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/depend.internal +19 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/depend.make +18 -19
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/flags.make +5 -3
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/link.txt +2 -2
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/progress.make +9 -8
- data/ext/mathematical/mtex2MML/build/CMakeFiles/memcheck.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/memcheck.dir/build.make +13 -6
- data/ext/mathematical/mtex2MML/build/CMakeFiles/memcheck.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML.dir/DependInfo.cmake +16 -18
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML.dir/build.make +60 -47
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML.dir/flags.make +5 -3
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML.dir/link.txt +1 -1
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML.dir/progress.make +10 -9
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML_clar.dir/DependInfo.cmake +17 -18
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML_clar.dir/build.make +178 -124
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML_clar.dir/cmake_clean.cmake +5 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML_clar.dir/flags.make +5 -3
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML_clar.dir/link.txt +1 -1
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML_clar.dir/progress.make +27 -25
- data/ext/mathematical/mtex2MML/build/CMakeFiles/progress.marks +1 -1
- data/ext/mathematical/mtex2MML/build/CTestTestfile.cmake +2 -2
- data/ext/mathematical/mtex2MML/build/DartConfiguration.tcl +25 -7
- data/ext/mathematical/mtex2MML/build/Makefile +419 -307
- data/ext/mathematical/mtex2MML/build/cmake_install.cmake +32 -32
- data/ext/mathematical/mtex2MML/build/lexer.c +4317 -4379
- data/ext/mathematical/mtex2MML/build/libmtex2MML.a +0 -0
- data/ext/mathematical/mtex2MML/build/mtex2mml_export.h +12 -5
- data/ext/mathematical/mtex2MML/build/parser.c +5549 -5473
- data/ext/mathematical/mtex2MML/build/parser.h +499 -490
- data/ext/mathematical/mtex2MML/build/parser.output +93361 -92735
- data/ext/mathematical/mtex2MML/deps/strdup/package.json +2 -2
- data/ext/mathematical/mtex2MML/deps/strdup/strdup.c +2 -0
- data/ext/mathematical/mtex2MML/deps/strdup/strdup.h +2 -0
- data/ext/mathematical/mtex2MML/deps/uthash/package.json +2 -1
- data/ext/mathematical/mtex2MML/deps/uthash/utarray.h +42 -36
- data/ext/mathematical/mtex2MML/deps/uthash/uthash.h +334 -218
- data/ext/mathematical/mtex2MML/deps/uthash/utlist.h +282 -144
- data/ext/mathematical/mtex2MML/deps/uthash/utringbuffer.h +108 -0
- data/ext/mathematical/mtex2MML/deps/uthash/utstring.h +15 -10
- data/ext/mathematical/mtex2MML/script/bootstrap +6 -12
- data/ext/mathematical/mtex2MML/script/cibuild +47 -1
- data/ext/mathematical/mtex2MML/script/{release → tag} +1 -1
- data/ext/mathematical/mtex2MML/src/environment.c +73 -13
- data/ext/mathematical/mtex2MML/src/environment.h +1 -1
- data/ext/mathematical/mtex2MML/src/lexer.l +75 -53
- data/ext/mathematical/mtex2MML/src/main.c +65 -36
- data/ext/mathematical/mtex2MML/src/mtex2MML.h +5 -1
- data/ext/mathematical/mtex2MML/src/parser.y +67 -16
- data/ext/mathematical/mtex2MML/tests/basic.c +10 -0
- data/ext/mathematical/mtex2MML/tests/delimiters.c +95 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/layout/strut-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/mathvariant/cal-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/mathvariant/frak-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/mathvariant/mathcal-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/mathvariant/mathfrak-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/mathvariant/mathrm-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/mathvariant/mathscr-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/mathvariant/rm-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/mathvariant/scr-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/mathvariant/textrm-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/array/strip_excess_whitespace_in_array_attributes.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/basic/text_rendering.html +23 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/basic/text_rendering.txt +23 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/align.html +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/align.txt +3 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/alignat-1a.html +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/alignat-1a.txt +4 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/aligned_ex_spacing.html +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/aligned_ex_spacing.txt +4 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/basic_array.html +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/basic_array.txt +3 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/mixed_env.html +8 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/mixed_env.txt +11 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/performance/big_file.html +6 -6
- data/ext/mathematical/mtex2MML/tests/fixtures/symbols/gt.html +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/symbols/gt.txt +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/symbols/lt.html +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/symbols/lt.txt +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/symbols/textgreater.html +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/symbols/textgreater.txt +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/symbols/textless.html +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/symbols/textless.txt +1 -0
- data/ext/mathematical/mtex2MML/tests/symbols.c +69 -0
- data/lib/mathematical.rb +19 -1
- data/lib/mathematical/version.rb +1 -1
- data/mathematical.gemspec +2 -1
- data/test/mathematical/basic_test.rb +16 -3
- data/test/mathematical/fixtures/png/numeric_test_1.png +0 -0
- data/test/mathematical/fixtures/png/numeric_test_3.png +0 -0
- data/test/mathematical/fixtures/png/pmatrix.png +0 -0
- data/test/mathematical/maliciousness_test.rb +0 -1
- data/test/mathematical/multiples_test.rb +3 -0
- data/test/mathematical/png_test.rb +4 -1
- data/test/test_helper.rb +2 -0
- metadata +54 -18
- data/ext/mathematical/FindNewerRubies.cmake +0 -292
- data/ext/mathematical/mtex2MML/build.ps1 +0 -2
- data/ext/mathematical/mtex2MML/build/CMakeFiles/2.8.10.1/CMakeCCompiler.cmake +0 -55
- data/ext/mathematical/mtex2MML/build/CMakeFiles/2.8.10.1/CMakeCXXCompiler.cmake +0 -56
- data/ext/mathematical/mtex2MML/build/CMakeFiles/2.8.10.1/CMakeSystem.cmake +0 -15
- data/ext/mathematical/mtex2MML/src/y.output +0 -117655
@@ -1,10 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "strdup",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.2",
|
4
4
|
"repo": "clibs/strdup",
|
5
5
|
"description": "drop-in replacement for strdup(3) from libc",
|
6
6
|
"keywords": [ "string", "copy" ],
|
7
|
-
"license": "
|
7
|
+
"license": "Expat",
|
8
8
|
"src": [
|
9
9
|
"strdup.c",
|
10
10
|
"strdup.h"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright (c) 2008-
|
2
|
+
Copyright (c) 2008-2016, Troy D. Hanson http://troydhanson.github.com/uthash/
|
3
3
|
All rights reserved.
|
4
4
|
|
5
5
|
Redistribution and use in source and binary forms, with or without
|
@@ -26,7 +26,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
26
26
|
#ifndef UTARRAY_H
|
27
27
|
#define UTARRAY_H
|
28
28
|
|
29
|
-
#define UTARRAY_VERSION
|
29
|
+
#define UTARRAY_VERSION 2.0.1
|
30
30
|
|
31
31
|
#ifdef __GNUC__
|
32
32
|
#define _UNUSED_ __attribute__ ((__unused__))
|
@@ -39,7 +39,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
39
39
|
#include <stdlib.h> /* exit */
|
40
40
|
#include "../strdup/strdup.h"
|
41
41
|
|
42
|
+
#ifndef oom
|
42
43
|
#define oom() exit(-1)
|
44
|
+
#endif
|
43
45
|
|
44
46
|
typedef void (ctor_f)(void *dst, const void *src);
|
45
47
|
typedef void (dtor_f)(void *elt);
|
@@ -59,13 +61,13 @@ typedef struct {
|
|
59
61
|
|
60
62
|
#define utarray_init(a,_icd) do { \
|
61
63
|
memset(a,0,sizeof(UT_array)); \
|
62
|
-
(a)->icd
|
64
|
+
(a)->icd = *(_icd); \
|
63
65
|
} while(0)
|
64
66
|
|
65
67
|
#define utarray_done(a) do { \
|
66
68
|
if ((a)->n) { \
|
67
69
|
if ((a)->icd.dtor) { \
|
68
|
-
|
70
|
+
unsigned _ut_i; \
|
69
71
|
for(_ut_i=0; _ut_i < (a)->i; _ut_i++) { \
|
70
72
|
(a)->icd.dtor(utarray_eltptr(a,_ut_i)); \
|
71
73
|
} \
|
@@ -76,7 +78,8 @@ typedef struct {
|
|
76
78
|
} while(0)
|
77
79
|
|
78
80
|
#define utarray_new(a,_icd) do { \
|
79
|
-
a=(UT_array*)malloc(sizeof(UT_array));
|
81
|
+
(a) = (UT_array*)malloc(sizeof(UT_array)); \
|
82
|
+
if ((a) == NULL) oom(); \
|
80
83
|
utarray_init(a,_icd); \
|
81
84
|
} while(0)
|
82
85
|
|
@@ -86,9 +89,12 @@ typedef struct {
|
|
86
89
|
} while(0)
|
87
90
|
|
88
91
|
#define utarray_reserve(a,by) do { \
|
89
|
-
if (((a)->i+by) > (
|
90
|
-
|
91
|
-
|
92
|
+
if (((a)->i+(by)) > (a)->n) { \
|
93
|
+
char *utarray_tmp; \
|
94
|
+
while (((a)->i+(by)) > (a)->n) { (a)->n = ((a)->n ? (2*(a)->n) : 8); } \
|
95
|
+
utarray_tmp=(char*)realloc((a)->d, (a)->n*(a)->icd.sz); \
|
96
|
+
if (utarray_tmp == NULL) oom(); \
|
97
|
+
(a)->d=utarray_tmp; \
|
92
98
|
} \
|
93
99
|
} while(0)
|
94
100
|
|
@@ -113,10 +119,10 @@ typedef struct {
|
|
113
119
|
#define utarray_len(a) ((a)->i)
|
114
120
|
|
115
121
|
#define utarray_eltptr(a,j) (((j) < (a)->i) ? _utarray_eltptr(a,j) : NULL)
|
116
|
-
#define _utarray_eltptr(a,j) ((
|
122
|
+
#define _utarray_eltptr(a,j) ((a)->d + ((a)->icd.sz * (j)))
|
117
123
|
|
118
124
|
#define utarray_insert(a,p,j) do { \
|
119
|
-
if (j > (a)->i) utarray_resize(a,j);
|
125
|
+
if ((j) > (a)->i) utarray_resize(a,j); \
|
120
126
|
utarray_reserve(a,1); \
|
121
127
|
if ((j) < (a)->i) { \
|
122
128
|
memmove( _utarray_eltptr(a,(j)+1), _utarray_eltptr(a,j), \
|
@@ -129,7 +135,7 @@ typedef struct {
|
|
129
135
|
|
130
136
|
#define utarray_inserta(a,w,j) do { \
|
131
137
|
if (utarray_len(w) == 0) break; \
|
132
|
-
if (j > (a)->i) utarray_resize(a,j);
|
138
|
+
if ((j) > (a)->i) utarray_resize(a,j); \
|
133
139
|
utarray_reserve(a,utarray_len(w)); \
|
134
140
|
if ((j) < (a)->i) { \
|
135
141
|
memmove(_utarray_eltptr(a,(j)+utarray_len(w)), \
|
@@ -137,9 +143,9 @@ typedef struct {
|
|
137
143
|
((a)->i - (j))*((a)->icd.sz)); \
|
138
144
|
} \
|
139
145
|
if ((a)->icd.copy) { \
|
140
|
-
|
146
|
+
unsigned _ut_i; \
|
141
147
|
for(_ut_i=0;_ut_i<(w)->i;_ut_i++) { \
|
142
|
-
(a)->icd.copy(_utarray_eltptr(a,j+_ut_i), _utarray_eltptr(w,_ut_i));
|
148
|
+
(a)->icd.copy(_utarray_eltptr(a, (j) + _ut_i), _utarray_eltptr(w, _ut_i)); \
|
143
149
|
} \
|
144
150
|
} else { \
|
145
151
|
memcpy(_utarray_eltptr(a,j), _utarray_eltptr(w,0), \
|
@@ -149,55 +155,55 @@ typedef struct {
|
|
149
155
|
} while(0)
|
150
156
|
|
151
157
|
#define utarray_resize(dst,num) do { \
|
152
|
-
|
153
|
-
if (dst->i > (
|
158
|
+
unsigned _ut_i; \
|
159
|
+
if ((dst)->i > (unsigned)(num)) { \
|
154
160
|
if ((dst)->icd.dtor) { \
|
155
|
-
for(_ut_i=num; _ut_i < dst->i; _ut_i
|
156
|
-
(dst)->icd.dtor(
|
161
|
+
for (_ut_i = (num); _ut_i < (dst)->i; ++_ut_i) { \
|
162
|
+
(dst)->icd.dtor(_utarray_eltptr(dst, _ut_i)); \
|
157
163
|
} \
|
158
164
|
} \
|
159
|
-
} else if (dst->i < (
|
160
|
-
utarray_reserve(dst,num-dst->i);
|
165
|
+
} else if ((dst)->i < (unsigned)(num)) { \
|
166
|
+
utarray_reserve(dst, (num) - (dst)->i); \
|
161
167
|
if ((dst)->icd.init) { \
|
162
|
-
for(_ut_i=dst->i; _ut_i < num; _ut_i
|
163
|
-
(dst)->icd.init(
|
168
|
+
for (_ut_i = (dst)->i; _ut_i < (unsigned)(num); ++_ut_i) { \
|
169
|
+
(dst)->icd.init(_utarray_eltptr(dst, _ut_i)); \
|
164
170
|
} \
|
165
171
|
} else { \
|
166
|
-
memset(_utarray_eltptr(dst,dst->i),0,(dst)->icd.sz*(num-dst->i));
|
172
|
+
memset(_utarray_eltptr(dst, (dst)->i), 0, (dst)->icd.sz*((num) - (dst)->i)); \
|
167
173
|
} \
|
168
174
|
} \
|
169
|
-
dst->i = num;
|
175
|
+
(dst)->i = (num); \
|
170
176
|
} while(0)
|
171
177
|
|
172
178
|
#define utarray_concat(dst,src) do { \
|
173
|
-
utarray_inserta(
|
179
|
+
utarray_inserta(dst, src, utarray_len(dst)); \
|
174
180
|
} while(0)
|
175
181
|
|
176
182
|
#define utarray_erase(a,pos,len) do { \
|
177
183
|
if ((a)->icd.dtor) { \
|
178
|
-
|
179
|
-
for(_ut_i=0; _ut_i < len; _ut_i++) {
|
180
|
-
(a)->icd.dtor(utarray_eltptr(
|
184
|
+
unsigned _ut_i; \
|
185
|
+
for (_ut_i = 0; _ut_i < (len); _ut_i++) { \
|
186
|
+
(a)->icd.dtor(utarray_eltptr(a, (pos) + _ut_i)); \
|
181
187
|
} \
|
182
188
|
} \
|
183
|
-
if ((a)->i > (pos+len)) {
|
184
|
-
memmove(
|
185
|
-
((
|
189
|
+
if ((a)->i > ((pos) + (len))) { \
|
190
|
+
memmove(_utarray_eltptr(a, pos), _utarray_eltptr(a, (pos) + (len)), \
|
191
|
+
((a)->i - ((pos) + (len))) * (a)->icd.sz); \
|
186
192
|
} \
|
187
193
|
(a)->i -= (len); \
|
188
194
|
} while(0)
|
189
195
|
|
190
196
|
#define utarray_renew(a,u) do { \
|
191
|
-
if (a) utarray_clear(a);
|
192
|
-
else utarray_new(
|
197
|
+
if (a) utarray_clear(a); \
|
198
|
+
else utarray_new(a, u); \
|
193
199
|
} while(0)
|
194
200
|
|
195
201
|
#define utarray_clear(a) do { \
|
196
202
|
if ((a)->i > 0) { \
|
197
203
|
if ((a)->icd.dtor) { \
|
198
|
-
|
204
|
+
unsigned _ut_i; \
|
199
205
|
for(_ut_i=0; _ut_i < (a)->i; _ut_i++) { \
|
200
|
-
(a)->icd.dtor(
|
206
|
+
(a)->icd.dtor(_utarray_eltptr(a, _ut_i)); \
|
201
207
|
} \
|
202
208
|
} \
|
203
209
|
(a)->i = 0; \
|
@@ -214,7 +220,7 @@ typedef struct {
|
|
214
220
|
#define utarray_next(a,e) (((e)==NULL) ? utarray_front(a) : ((((a)->i) > (utarray_eltidx(a,e)+1)) ? _utarray_eltptr(a,utarray_eltidx(a,e)+1) : NULL))
|
215
221
|
#define utarray_prev(a,e) (((e)==NULL) ? utarray_back(a) : ((utarray_eltidx(a,e) > 0) ? _utarray_eltptr(a,utarray_eltidx(a,e)-1) : NULL))
|
216
222
|
#define utarray_back(a) (((a)->i) ? (_utarray_eltptr(a,(a)->i-1)) : NULL)
|
217
|
-
#define utarray_eltidx(a,e) (((char*)(e) >= (
|
223
|
+
#define utarray_eltidx(a,e) (((char*)(e) >= (a)->d) ? (((char*)(e) - (a)->d)/(a)->icd.sz) : -1)
|
218
224
|
|
219
225
|
/* last we pre-define a few icd for common utarrays of ints and strings */
|
220
226
|
static void utarray_str_cpy(void *dst, const void *src) {
|
@@ -223,7 +229,7 @@ static void utarray_str_cpy(void *dst, const void *src) {
|
|
223
229
|
}
|
224
230
|
static void utarray_str_dtor(void *elt) {
|
225
231
|
char **eltc = (char**)elt;
|
226
|
-
if (*eltc) free(*eltc);
|
232
|
+
if (*eltc != NULL) free(*eltc);
|
227
233
|
}
|
228
234
|
static const UT_icd ut_str_icd _UNUSED_ = {sizeof(char*),NULL,utarray_str_cpy,utarray_str_dtor};
|
229
235
|
static const UT_icd ut_int_icd _UNUSED_ = {sizeof(int),NULL,NULL,NULL};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright (c) 2003-
|
2
|
+
Copyright (c) 2003-2016, Troy D. Hanson http://troydhanson.github.com/uthash/
|
3
3
|
All rights reserved.
|
4
4
|
|
5
5
|
Redistribution and use in source and binary forms, with or without
|
@@ -24,6 +24,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
24
|
#ifndef UTHASH_H
|
25
25
|
#define UTHASH_H
|
26
26
|
|
27
|
+
#define UTHASH_VERSION 2.0.1
|
28
|
+
|
27
29
|
#include <string.h> /* memcmp,strlen */
|
28
30
|
#include <stddef.h> /* ptrdiff_t */
|
29
31
|
#include <stdlib.h> /* exit() */
|
@@ -51,30 +53,31 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
51
53
|
do { \
|
52
54
|
char **_da_dst = (char**)(&(dst)); \
|
53
55
|
*_da_dst = (char*)(src); \
|
54
|
-
} while(0)
|
56
|
+
} while (0)
|
55
57
|
#else
|
56
58
|
#define DECLTYPE_ASSIGN(dst,src) \
|
57
59
|
do { \
|
58
60
|
(dst) = DECLTYPE(dst)(src); \
|
59
|
-
} while(0)
|
61
|
+
} while (0)
|
60
62
|
#endif
|
61
63
|
|
62
64
|
/* a number of the hash function use uint32_t which isn't defined on Pre VS2010 */
|
63
|
-
#if defined
|
65
|
+
#if defined(_WIN32)
|
64
66
|
#if defined(_MSC_VER) && _MSC_VER >= 1600
|
65
67
|
#include <stdint.h>
|
66
|
-
#elif defined(__WATCOMC__)
|
68
|
+
#elif defined(__WATCOMC__) || defined(__MINGW32__) || defined(__CYGWIN__)
|
67
69
|
#include <stdint.h>
|
68
70
|
#else
|
69
71
|
typedef unsigned int uint32_t;
|
70
72
|
typedef unsigned char uint8_t;
|
71
73
|
#endif
|
72
|
-
#
|
74
|
+
#elif defined(__GNUC__) && !defined(__VXWORKS__)
|
73
75
|
#include <stdint.h>
|
76
|
+
#else
|
77
|
+
typedef unsigned int uint32_t;
|
78
|
+
typedef unsigned char uint8_t;
|
74
79
|
#endif
|
75
80
|
|
76
|
-
#define UTHASH_VERSION 1.9.9
|
77
|
-
|
78
81
|
#ifndef uthash_fatal
|
79
82
|
#define uthash_fatal(msg) exit(-1) /* fatal error (out of memory,etc) */
|
80
83
|
#endif
|
@@ -84,6 +87,12 @@ typedef unsigned char uint8_t;
|
|
84
87
|
#ifndef uthash_free
|
85
88
|
#define uthash_free(ptr,sz) free(ptr) /* free fcn */
|
86
89
|
#endif
|
90
|
+
#ifndef uthash_strlen
|
91
|
+
#define uthash_strlen(s) strlen(s)
|
92
|
+
#endif
|
93
|
+
#ifndef uthash_memcmp
|
94
|
+
#define uthash_memcmp(a,b,n) memcmp(a,b,n)
|
95
|
+
#endif
|
87
96
|
|
88
97
|
#ifndef uthash_noexpand_fyi
|
89
98
|
#define uthash_noexpand_fyi(tbl) /* can be defined to log noexpand */
|
@@ -93,29 +102,42 @@ typedef unsigned char uint8_t;
|
|
93
102
|
#endif
|
94
103
|
|
95
104
|
/* initial number of buckets */
|
96
|
-
#define HASH_INITIAL_NUM_BUCKETS
|
97
|
-
#define HASH_INITIAL_NUM_BUCKETS_LOG2
|
98
|
-
#define HASH_BKT_CAPACITY_THRESH
|
105
|
+
#define HASH_INITIAL_NUM_BUCKETS 32U /* initial number of buckets */
|
106
|
+
#define HASH_INITIAL_NUM_BUCKETS_LOG2 5U /* lg2 of initial number of buckets */
|
107
|
+
#define HASH_BKT_CAPACITY_THRESH 10U /* expand when bucket count reaches */
|
99
108
|
|
100
|
-
/* calculate the element whose hash handle address is
|
109
|
+
/* calculate the element whose hash handle address is hhp */
|
101
110
|
#define ELMT_FROM_HH(tbl,hhp) ((void*)(((char*)(hhp)) - ((tbl)->hho)))
|
111
|
+
/* calculate the hash handle from element address elp */
|
112
|
+
#define HH_FROM_ELMT(tbl,elp) ((UT_hash_handle *)(((char*)(elp)) + ((tbl)->hho)))
|
102
113
|
|
103
|
-
#define
|
114
|
+
#define HASH_VALUE(keyptr,keylen,hashv) \
|
104
115
|
do { \
|
105
|
-
|
106
|
-
|
116
|
+
HASH_FCN(keyptr, keylen, hashv); \
|
117
|
+
} while (0)
|
118
|
+
|
119
|
+
#define HASH_FIND_BYHASHVALUE(hh,head,keyptr,keylen,hashval,out) \
|
120
|
+
do { \
|
121
|
+
(out) = NULL; \
|
107
122
|
if (head) { \
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
123
|
+
unsigned _hf_bkt; \
|
124
|
+
HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _hf_bkt); \
|
125
|
+
if (HASH_BLOOM_TEST((head)->hh.tbl, hashval) != 0) { \
|
126
|
+
HASH_FIND_IN_BKT((head)->hh.tbl, hh, (head)->hh.tbl->buckets[ _hf_bkt ], keyptr, keylen, hashval, out); \
|
127
|
+
} \
|
113
128
|
} \
|
114
129
|
} while (0)
|
115
130
|
|
131
|
+
#define HASH_FIND(hh,head,keyptr,keylen,out) \
|
132
|
+
do { \
|
133
|
+
unsigned _hf_hashv; \
|
134
|
+
HASH_VALUE(keyptr, keylen, _hf_hashv); \
|
135
|
+
HASH_FIND_BYHASHVALUE(hh, head, keyptr, keylen, _hf_hashv, out); \
|
136
|
+
} while (0)
|
137
|
+
|
116
138
|
#ifdef HASH_BLOOM
|
117
|
-
#define HASH_BLOOM_BITLEN (
|
118
|
-
#define HASH_BLOOM_BYTELEN (HASH_BLOOM_BITLEN/
|
139
|
+
#define HASH_BLOOM_BITLEN (1UL << HASH_BLOOM)
|
140
|
+
#define HASH_BLOOM_BYTELEN (HASH_BLOOM_BITLEN/8UL) + (((HASH_BLOOM_BITLEN%8UL)!=0UL) ? 1UL : 0UL)
|
119
141
|
#define HASH_BLOOM_MAKE(tbl) \
|
120
142
|
do { \
|
121
143
|
(tbl)->bloom_nbits = HASH_BLOOM; \
|
@@ -130,21 +152,21 @@ do {
|
|
130
152
|
uthash_free((tbl)->bloom_bv, HASH_BLOOM_BYTELEN); \
|
131
153
|
} while (0)
|
132
154
|
|
133
|
-
#define HASH_BLOOM_BITSET(bv,idx) (bv[(idx)/
|
134
|
-
#define HASH_BLOOM_BITTEST(bv,idx) (bv[(idx)/
|
155
|
+
#define HASH_BLOOM_BITSET(bv,idx) (bv[(idx)/8U] |= (1U << ((idx)%8U)))
|
156
|
+
#define HASH_BLOOM_BITTEST(bv,idx) (bv[(idx)/8U] & (1U << ((idx)%8U)))
|
135
157
|
|
136
158
|
#define HASH_BLOOM_ADD(tbl,hashv) \
|
137
|
-
HASH_BLOOM_BITSET((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) -
|
159
|
+
HASH_BLOOM_BITSET((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1U)))
|
138
160
|
|
139
161
|
#define HASH_BLOOM_TEST(tbl,hashv) \
|
140
|
-
HASH_BLOOM_BITTEST((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) -
|
162
|
+
HASH_BLOOM_BITTEST((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1U)))
|
141
163
|
|
142
164
|
#else
|
143
165
|
#define HASH_BLOOM_MAKE(tbl)
|
144
166
|
#define HASH_BLOOM_FREE(tbl)
|
145
167
|
#define HASH_BLOOM_ADD(tbl,hashv)
|
146
168
|
#define HASH_BLOOM_TEST(tbl,hashv) (1)
|
147
|
-
#define HASH_BLOOM_BYTELEN
|
169
|
+
#define HASH_BLOOM_BYTELEN 0U
|
148
170
|
#endif
|
149
171
|
|
150
172
|
#define HASH_MAKE_TABLE(hh,head) \
|
@@ -164,50 +186,141 @@ do {
|
|
164
186
|
HASH_INITIAL_NUM_BUCKETS*sizeof(struct UT_hash_bucket)); \
|
165
187
|
HASH_BLOOM_MAKE((head)->hh.tbl); \
|
166
188
|
(head)->hh.tbl->signature = HASH_SIGNATURE; \
|
167
|
-
} while(0)
|
189
|
+
} while (0)
|
168
190
|
|
169
|
-
#define
|
170
|
-
|
191
|
+
#define HASH_REPLACE_BYHASHVALUE_INORDER(hh,head,fieldname,keylen_in,hashval,add,replaced,cmpfcn) \
|
192
|
+
do { \
|
193
|
+
(replaced) = NULL; \
|
194
|
+
HASH_FIND_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, replaced); \
|
195
|
+
if (replaced) { \
|
196
|
+
HASH_DELETE(hh, head, replaced); \
|
197
|
+
} \
|
198
|
+
HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, &((add)->fieldname), keylen_in, hashval, add, cmpfcn); \
|
199
|
+
} while (0)
|
200
|
+
|
201
|
+
#define HASH_REPLACE_BYHASHVALUE(hh,head,fieldname,keylen_in,hashval,add,replaced) \
|
202
|
+
do { \
|
203
|
+
(replaced) = NULL; \
|
204
|
+
HASH_FIND_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, replaced); \
|
205
|
+
if (replaced) { \
|
206
|
+
HASH_DELETE(hh, head, replaced); \
|
207
|
+
} \
|
208
|
+
HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, add); \
|
209
|
+
} while (0)
|
171
210
|
|
172
211
|
#define HASH_REPLACE(hh,head,fieldname,keylen_in,add,replaced) \
|
173
212
|
do { \
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
213
|
+
unsigned _hr_hashv; \
|
214
|
+
HASH_VALUE(&((add)->fieldname), keylen_in, _hr_hashv); \
|
215
|
+
HASH_REPLACE_BYHASHVALUE(hh, head, fieldname, keylen_in, _hr_hashv, add, replaced); \
|
216
|
+
} while (0)
|
217
|
+
|
218
|
+
#define HASH_REPLACE_INORDER(hh,head,fieldname,keylen_in,add,replaced,cmpfcn) \
|
219
|
+
do { \
|
220
|
+
unsigned _hr_hashv; \
|
221
|
+
HASH_VALUE(&((add)->fieldname), keylen_in, _hr_hashv); \
|
222
|
+
HASH_REPLACE_BYHASHVALUE_INORDER(hh, head, fieldname, keylen_in, _hr_hashv, add, replaced, cmpfcn); \
|
223
|
+
} while (0)
|
224
|
+
|
225
|
+
#define HASH_APPEND_LIST(hh, head, add) \
|
226
|
+
do { \
|
227
|
+
(add)->hh.next = NULL; \
|
228
|
+
(add)->hh.prev = ELMT_FROM_HH((head)->hh.tbl, (head)->hh.tbl->tail); \
|
229
|
+
(head)->hh.tbl->tail->next = (add); \
|
230
|
+
(head)->hh.tbl->tail = &((add)->hh); \
|
231
|
+
} while (0)
|
232
|
+
|
233
|
+
#define HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh,head,keyptr,keylen_in,hashval,add,cmpfcn) \
|
234
|
+
do { \
|
235
|
+
unsigned _ha_bkt; \
|
236
|
+
(add)->hh.hashv = (hashval); \
|
237
|
+
(add)->hh.key = (char*) (keyptr); \
|
238
|
+
(add)->hh.keylen = (unsigned) (keylen_in); \
|
239
|
+
if (!(head)) { \
|
240
|
+
(add)->hh.next = NULL; \
|
241
|
+
(add)->hh.prev = NULL; \
|
242
|
+
(head) = (add); \
|
243
|
+
HASH_MAKE_TABLE(hh, head); \
|
244
|
+
} else { \
|
245
|
+
struct UT_hash_handle *_hs_iter = &(head)->hh; \
|
246
|
+
(add)->hh.tbl = (head)->hh.tbl; \
|
247
|
+
do { \
|
248
|
+
if (cmpfcn(DECLTYPE(head) ELMT_FROM_HH((head)->hh.tbl, _hs_iter), add) > 0) \
|
249
|
+
break; \
|
250
|
+
} while ((_hs_iter = _hs_iter->next)); \
|
251
|
+
if (_hs_iter) { \
|
252
|
+
(add)->hh.next = _hs_iter; \
|
253
|
+
if (((add)->hh.prev = _hs_iter->prev)) { \
|
254
|
+
HH_FROM_ELMT((head)->hh.tbl, _hs_iter->prev)->next = (add); \
|
255
|
+
} else { \
|
256
|
+
(head) = (add); \
|
257
|
+
} \
|
258
|
+
_hs_iter->prev = (add); \
|
259
|
+
} else { \
|
260
|
+
HASH_APPEND_LIST(hh, head, add); \
|
261
|
+
} \
|
262
|
+
} \
|
263
|
+
(head)->hh.tbl->num_items++; \
|
264
|
+
HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _ha_bkt); \
|
265
|
+
HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt], &(add)->hh); \
|
266
|
+
HASH_BLOOM_ADD((head)->hh.tbl, hashval); \
|
267
|
+
HASH_EMIT_KEY(hh, head, keyptr, keylen_in); \
|
268
|
+
HASH_FSCK(hh, head); \
|
269
|
+
} while (0)
|
270
|
+
|
271
|
+
#define HASH_ADD_KEYPTR_INORDER(hh,head,keyptr,keylen_in,add,cmpfcn) \
|
272
|
+
do { \
|
273
|
+
unsigned _hs_hashv; \
|
274
|
+
HASH_VALUE(keyptr, keylen_in, _hs_hashv); \
|
275
|
+
HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, keyptr, keylen_in, _hs_hashv, add, cmpfcn); \
|
276
|
+
} while (0)
|
277
|
+
|
278
|
+
#define HASH_ADD_BYHASHVALUE_INORDER(hh,head,fieldname,keylen_in,hashval,add,cmpfcn) \
|
279
|
+
HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, &((add)->fieldname), keylen_in, hashval, add, cmpfcn)
|
280
|
+
|
281
|
+
#define HASH_ADD_INORDER(hh,head,fieldname,keylen_in,add,cmpfcn) \
|
282
|
+
HASH_ADD_KEYPTR_INORDER(hh, head, &((add)->fieldname), keylen_in, add, cmpfcn)
|
283
|
+
|
284
|
+
#define HASH_ADD_KEYPTR_BYHASHVALUE(hh,head,keyptr,keylen_in,hashval,add) \
|
285
|
+
do { \
|
286
|
+
unsigned _ha_bkt; \
|
287
|
+
(add)->hh.hashv = (hashval); \
|
288
|
+
(add)->hh.key = (char*) (keyptr); \
|
289
|
+
(add)->hh.keylen = (unsigned) (keylen_in); \
|
290
|
+
if (!(head)) { \
|
291
|
+
(add)->hh.next = NULL; \
|
292
|
+
(add)->hh.prev = NULL; \
|
293
|
+
(head) = (add); \
|
294
|
+
HASH_MAKE_TABLE(hh, head); \
|
295
|
+
} else { \
|
296
|
+
(add)->hh.tbl = (head)->hh.tbl; \
|
297
|
+
HASH_APPEND_LIST(hh, head, add); \
|
298
|
+
} \
|
299
|
+
(head)->hh.tbl->num_items++; \
|
300
|
+
HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _ha_bkt); \
|
301
|
+
HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt], &(add)->hh); \
|
302
|
+
HASH_BLOOM_ADD((head)->hh.tbl, hashval); \
|
303
|
+
HASH_EMIT_KEY(hh, head, keyptr, keylen_in); \
|
304
|
+
HASH_FSCK(hh, head); \
|
305
|
+
} while (0)
|
181
306
|
|
182
307
|
#define HASH_ADD_KEYPTR(hh,head,keyptr,keylen_in,add) \
|
183
308
|
do { \
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
(add)->hh.prev = ELMT_FROM_HH((head)->hh.tbl, (head)->hh.tbl->tail); \
|
195
|
-
(head)->hh.tbl->tail = &((add)->hh); \
|
196
|
-
} \
|
197
|
-
(head)->hh.tbl->num_items++; \
|
198
|
-
(add)->hh.tbl = (head)->hh.tbl; \
|
199
|
-
HASH_FCN(keyptr,keylen_in, (head)->hh.tbl->num_buckets, \
|
200
|
-
(add)->hh.hashv, _ha_bkt); \
|
201
|
-
HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt],&(add)->hh); \
|
202
|
-
HASH_BLOOM_ADD((head)->hh.tbl,(add)->hh.hashv); \
|
203
|
-
HASH_EMIT_KEY(hh,head,keyptr,keylen_in); \
|
204
|
-
HASH_FSCK(hh,head); \
|
205
|
-
} while(0)
|
309
|
+
unsigned _ha_hashv; \
|
310
|
+
HASH_VALUE(keyptr, keylen_in, _ha_hashv); \
|
311
|
+
HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, keyptr, keylen_in, _ha_hashv, add); \
|
312
|
+
} while (0)
|
313
|
+
|
314
|
+
#define HASH_ADD_BYHASHVALUE(hh,head,fieldname,keylen_in,hashval,add) \
|
315
|
+
HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, add)
|
316
|
+
|
317
|
+
#define HASH_ADD(hh,head,fieldname,keylen_in,add) \
|
318
|
+
HASH_ADD_KEYPTR(hh, head, &((add)->fieldname), keylen_in, add)
|
206
319
|
|
207
|
-
#define HASH_TO_BKT(
|
320
|
+
#define HASH_TO_BKT(hashv,num_bkts,bkt) \
|
208
321
|
do { \
|
209
|
-
bkt = ((hashv) & ((num_bkts) -
|
210
|
-
} while(0)
|
322
|
+
bkt = ((hashv) & ((num_bkts) - 1U)); \
|
323
|
+
} while (0)
|
211
324
|
|
212
325
|
/* delete "delptr" from the hash table.
|
213
326
|
* "the usual" patch-up process for the app-order doubly-linked-list.
|
@@ -223,7 +336,6 @@ do {
|
|
223
336
|
*/
|
224
337
|
#define HASH_DELETE(hh,head,delptr) \
|
225
338
|
do { \
|
226
|
-
unsigned _hd_bkt; \
|
227
339
|
struct UT_hash_handle *_hd_hh_del; \
|
228
340
|
if ( ((delptr)->hh.prev == NULL) && ((delptr)->hh.next == NULL) ) { \
|
229
341
|
uthash_free((head)->hh.tbl->buckets, \
|
@@ -232,19 +344,20 @@ do {
|
|
232
344
|
uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \
|
233
345
|
head = NULL; \
|
234
346
|
} else { \
|
347
|
+
unsigned _hd_bkt; \
|
235
348
|
_hd_hh_del = &((delptr)->hh); \
|
236
349
|
if ((delptr) == ELMT_FROM_HH((head)->hh.tbl,(head)->hh.tbl->tail)) { \
|
237
350
|
(head)->hh.tbl->tail = \
|
238
351
|
(UT_hash_handle*)((ptrdiff_t)((delptr)->hh.prev) + \
|
239
352
|
(head)->hh.tbl->hho); \
|
240
353
|
} \
|
241
|
-
if ((delptr)->hh.prev) {
|
354
|
+
if ((delptr)->hh.prev != NULL) { \
|
242
355
|
((UT_hash_handle*)((ptrdiff_t)((delptr)->hh.prev) + \
|
243
356
|
(head)->hh.tbl->hho))->next = (delptr)->hh.next; \
|
244
357
|
} else { \
|
245
358
|
DECLTYPE_ASSIGN(head,(delptr)->hh.next); \
|
246
359
|
} \
|
247
|
-
if (_hd_hh_del->next) {
|
360
|
+
if (_hd_hh_del->next != NULL) { \
|
248
361
|
((UT_hash_handle*)((ptrdiff_t)_hd_hh_del->next + \
|
249
362
|
(head)->hh.tbl->hho))->prev = \
|
250
363
|
_hd_hh_del->prev; \
|
@@ -259,11 +372,11 @@ do {
|
|
259
372
|
|
260
373
|
/* convenience forms of HASH_FIND/HASH_ADD/HASH_DEL */
|
261
374
|
#define HASH_FIND_STR(head,findstr,out) \
|
262
|
-
HASH_FIND(hh,head,findstr,
|
375
|
+
HASH_FIND(hh,head,findstr,(unsigned)uthash_strlen(findstr),out)
|
263
376
|
#define HASH_ADD_STR(head,strfield,add) \
|
264
|
-
HASH_ADD(hh,head,strfield[0],
|
377
|
+
HASH_ADD(hh,head,strfield[0],(unsigned)uthash_strlen(add->strfield),add)
|
265
378
|
#define HASH_REPLACE_STR(head,strfield,add,replaced) \
|
266
|
-
HASH_REPLACE(hh,head,strfield[0],
|
379
|
+
HASH_REPLACE(hh,head,strfield[0],(unsigned)uthash_strlen(add->strfield),add,replaced)
|
267
380
|
#define HASH_FIND_INT(head,findint,out) \
|
268
381
|
HASH_FIND(hh,head,findint,sizeof(int),out)
|
269
382
|
#define HASH_ADD_INT(head,intfield,add) \
|
@@ -286,14 +399,14 @@ do {
|
|
286
399
|
#define HASH_OOPS(...) do { fprintf(stderr,__VA_ARGS__); exit(-1); } while (0)
|
287
400
|
#define HASH_FSCK(hh,head) \
|
288
401
|
do { \
|
289
|
-
unsigned _bkt_i; \
|
290
|
-
unsigned _count, _bkt_count; \
|
291
|
-
char *_prev; \
|
292
402
|
struct UT_hash_handle *_thh; \
|
293
403
|
if (head) { \
|
404
|
+
unsigned _bkt_i; \
|
405
|
+
unsigned _count; \
|
406
|
+
char *_prev; \
|
294
407
|
_count = 0; \
|
295
408
|
for( _bkt_i = 0; _bkt_i < (head)->hh.tbl->num_buckets; _bkt_i++) { \
|
296
|
-
_bkt_count = 0;
|
409
|
+
unsigned _bkt_count = 0; \
|
297
410
|
_thh = (head)->hh.tbl->buckets[_bkt_i].hh_head; \
|
298
411
|
_prev = NULL; \
|
299
412
|
while (_thh) { \
|
@@ -307,12 +420,12 @@ do {
|
|
307
420
|
} \
|
308
421
|
_count += _bkt_count; \
|
309
422
|
if ((head)->hh.tbl->buckets[_bkt_i].count != _bkt_count) { \
|
310
|
-
HASH_OOPS("invalid bucket count %
|
423
|
+
HASH_OOPS("invalid bucket count %u, actual %u\n", \
|
311
424
|
(head)->hh.tbl->buckets[_bkt_i].count, _bkt_count); \
|
312
425
|
} \
|
313
426
|
} \
|
314
427
|
if (_count != (head)->hh.tbl->num_items) { \
|
315
|
-
HASH_OOPS("invalid hh item count %
|
428
|
+
HASH_OOPS("invalid hh item count %u, actual %u\n", \
|
316
429
|
(head)->hh.tbl->num_items, _count ); \
|
317
430
|
} \
|
318
431
|
/* traverse hh in app order; check next/prev integrity, count */ \
|
@@ -330,7 +443,7 @@ do {
|
|
330
443
|
(head)->hh.tbl->hho) : NULL ); \
|
331
444
|
} \
|
332
445
|
if (_count != (head)->hh.tbl->num_items) { \
|
333
|
-
HASH_OOPS("invalid app item count %
|
446
|
+
HASH_OOPS("invalid app item count %u, actual %u\n", \
|
334
447
|
(head)->hh.tbl->num_items, _count ); \
|
335
448
|
} \
|
336
449
|
} \
|
@@ -347,7 +460,7 @@ do {
|
|
347
460
|
do { \
|
348
461
|
unsigned _klen = fieldlen; \
|
349
462
|
write(HASH_EMIT_KEYS, &_klen, sizeof(_klen)); \
|
350
|
-
write(HASH_EMIT_KEYS, keyptr, fieldlen);
|
463
|
+
write(HASH_EMIT_KEYS, keyptr, (unsigned long)fieldlen); \
|
351
464
|
} while (0)
|
352
465
|
#else
|
353
466
|
#define HASH_EMIT_KEY(hh,head,keyptr,fieldlen)
|
@@ -361,43 +474,44 @@ do {
|
|
361
474
|
#endif
|
362
475
|
|
363
476
|
/* The Bernstein hash function, used in Perl prior to v5.6. Note (x<<5+x)=x*33. */
|
364
|
-
#define HASH_BER(key,keylen,
|
477
|
+
#define HASH_BER(key,keylen,hashv) \
|
365
478
|
do { \
|
366
|
-
unsigned _hb_keylen=keylen;
|
367
|
-
char *_hb_key=(char*)(key);
|
479
|
+
unsigned _hb_keylen=(unsigned)keylen; \
|
480
|
+
const unsigned char *_hb_key=(const unsigned char*)(key); \
|
368
481
|
(hashv) = 0; \
|
369
|
-
while (_hb_keylen--
|
370
|
-
|
482
|
+
while (_hb_keylen-- != 0U) { \
|
483
|
+
(hashv) = (((hashv) << 5) + (hashv)) + *_hb_key++; \
|
484
|
+
} \
|
371
485
|
} while (0)
|
372
486
|
|
373
487
|
|
374
488
|
/* SAX/FNV/OAT/JEN hash functions are macro variants of those listed at
|
375
489
|
* http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx */
|
376
|
-
#define HASH_SAX(key,keylen,
|
490
|
+
#define HASH_SAX(key,keylen,hashv) \
|
377
491
|
do { \
|
378
492
|
unsigned _sx_i; \
|
379
|
-
char *_hs_key=(char*)(key);
|
493
|
+
const unsigned char *_hs_key=(const unsigned char*)(key); \
|
380
494
|
hashv = 0; \
|
381
|
-
for(_sx_i=0; _sx_i < keylen; _sx_i++)
|
495
|
+
for(_sx_i=0; _sx_i < keylen; _sx_i++) { \
|
382
496
|
hashv ^= (hashv << 5) + (hashv >> 2) + _hs_key[_sx_i]; \
|
383
|
-
|
497
|
+
} \
|
384
498
|
} while (0)
|
385
499
|
/* FNV-1a variation */
|
386
|
-
#define HASH_FNV(key,keylen,
|
500
|
+
#define HASH_FNV(key,keylen,hashv) \
|
387
501
|
do { \
|
388
502
|
unsigned _fn_i; \
|
389
|
-
char *_hf_key=(char*)(key);
|
390
|
-
hashv =
|
391
|
-
for(_fn_i=0; _fn_i < keylen; _fn_i++)
|
503
|
+
const unsigned char *_hf_key=(const unsigned char*)(key); \
|
504
|
+
hashv = 2166136261U; \
|
505
|
+
for(_fn_i=0; _fn_i < keylen; _fn_i++) { \
|
392
506
|
hashv = hashv ^ _hf_key[_fn_i]; \
|
393
|
-
hashv = hashv *
|
394
|
-
|
395
|
-
} while(0)
|
507
|
+
hashv = hashv * 16777619U; \
|
508
|
+
} \
|
509
|
+
} while (0)
|
396
510
|
|
397
|
-
#define HASH_OAT(key,keylen,
|
511
|
+
#define HASH_OAT(key,keylen,hashv) \
|
398
512
|
do { \
|
399
513
|
unsigned _ho_i; \
|
400
|
-
char *_ho_key=(char*)(key);
|
514
|
+
const unsigned char *_ho_key=(const unsigned char*)(key); \
|
401
515
|
hashv = 0; \
|
402
516
|
for(_ho_i=0; _ho_i < keylen; _ho_i++) { \
|
403
517
|
hashv += _ho_key[_ho_i]; \
|
@@ -407,8 +521,7 @@ do {
|
|
407
521
|
hashv += (hashv << 3); \
|
408
522
|
hashv ^= (hashv >> 11); \
|
409
523
|
hashv += (hashv << 15); \
|
410
|
-
|
411
|
-
} while(0)
|
524
|
+
} while (0)
|
412
525
|
|
413
526
|
#define HASH_JEN_MIX(a,b,c) \
|
414
527
|
do { \
|
@@ -423,14 +536,14 @@ do {
|
|
423
536
|
c -= a; c -= b; c ^= ( b >> 15 ); \
|
424
537
|
} while (0)
|
425
538
|
|
426
|
-
#define HASH_JEN(key,keylen,
|
539
|
+
#define HASH_JEN(key,keylen,hashv) \
|
427
540
|
do { \
|
428
541
|
unsigned _hj_i,_hj_j,_hj_k; \
|
429
|
-
unsigned char *_hj_key=(unsigned char*)(key);
|
430
|
-
hashv =
|
431
|
-
_hj_i = _hj_j =
|
432
|
-
_hj_k = (unsigned)(keylen);
|
433
|
-
while (_hj_k >=
|
542
|
+
unsigned const char *_hj_key=(unsigned const char*)(key); \
|
543
|
+
hashv = 0xfeedbeefu; \
|
544
|
+
_hj_i = _hj_j = 0x9e3779b9u; \
|
545
|
+
_hj_k = (unsigned)(keylen); \
|
546
|
+
while (_hj_k >= 12U) { \
|
434
547
|
_hj_i += (_hj_key[0] + ( (unsigned)_hj_key[1] << 8 ) \
|
435
548
|
+ ( (unsigned)_hj_key[2] << 16 ) \
|
436
549
|
+ ( (unsigned)_hj_key[3] << 24 ) ); \
|
@@ -444,25 +557,24 @@ do {
|
|
444
557
|
HASH_JEN_MIX(_hj_i, _hj_j, hashv); \
|
445
558
|
\
|
446
559
|
_hj_key += 12; \
|
447
|
-
_hj_k -=
|
560
|
+
_hj_k -= 12U; \
|
448
561
|
} \
|
449
|
-
hashv += keylen;
|
562
|
+
hashv += (unsigned)(keylen); \
|
450
563
|
switch ( _hj_k ) { \
|
451
|
-
case 11: hashv += ( (unsigned)_hj_key[10] << 24 );
|
452
|
-
case 10: hashv += ( (unsigned)_hj_key[9] << 16 );
|
453
|
-
case 9: hashv += ( (unsigned)_hj_key[8] << 8 );
|
454
|
-
case 8: _hj_j += ( (unsigned)_hj_key[7] << 24 );
|
455
|
-
case 7: _hj_j += ( (unsigned)_hj_key[6] << 16 );
|
456
|
-
case 6: _hj_j += ( (unsigned)_hj_key[5] << 8 );
|
457
|
-
case 5: _hj_j += _hj_key[4];
|
458
|
-
case 4: _hj_i += ( (unsigned)_hj_key[3] << 24 );
|
459
|
-
case 3: _hj_i += ( (unsigned)_hj_key[2] << 16 );
|
460
|
-
case 2: _hj_i += ( (unsigned)_hj_key[1] << 8 );
|
564
|
+
case 11: hashv += ( (unsigned)_hj_key[10] << 24 ); /* FALLTHROUGH */ \
|
565
|
+
case 10: hashv += ( (unsigned)_hj_key[9] << 16 ); /* FALLTHROUGH */ \
|
566
|
+
case 9: hashv += ( (unsigned)_hj_key[8] << 8 ); /* FALLTHROUGH */ \
|
567
|
+
case 8: _hj_j += ( (unsigned)_hj_key[7] << 24 ); /* FALLTHROUGH */ \
|
568
|
+
case 7: _hj_j += ( (unsigned)_hj_key[6] << 16 ); /* FALLTHROUGH */ \
|
569
|
+
case 6: _hj_j += ( (unsigned)_hj_key[5] << 8 ); /* FALLTHROUGH */ \
|
570
|
+
case 5: _hj_j += _hj_key[4]; /* FALLTHROUGH */ \
|
571
|
+
case 4: _hj_i += ( (unsigned)_hj_key[3] << 24 ); /* FALLTHROUGH */ \
|
572
|
+
case 3: _hj_i += ( (unsigned)_hj_key[2] << 16 ); /* FALLTHROUGH */ \
|
573
|
+
case 2: _hj_i += ( (unsigned)_hj_key[1] << 8 ); /* FALLTHROUGH */ \
|
461
574
|
case 1: _hj_i += _hj_key[0]; \
|
462
575
|
} \
|
463
576
|
HASH_JEN_MIX(_hj_i, _hj_j, hashv); \
|
464
|
-
|
465
|
-
} while(0)
|
577
|
+
} while (0)
|
466
578
|
|
467
579
|
/* The Paul Hsieh hash function */
|
468
580
|
#undef get16bits
|
@@ -475,21 +587,21 @@ do {
|
|
475
587
|
#define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8) \
|
476
588
|
+(uint32_t)(((const uint8_t *)(d))[0]) )
|
477
589
|
#endif
|
478
|
-
#define HASH_SFH(key,keylen,
|
590
|
+
#define HASH_SFH(key,keylen,hashv) \
|
479
591
|
do { \
|
480
|
-
unsigned char *_sfh_key=(unsigned char*)(key);
|
481
|
-
uint32_t _sfh_tmp, _sfh_len = keylen;
|
592
|
+
unsigned const char *_sfh_key=(unsigned const char*)(key); \
|
593
|
+
uint32_t _sfh_tmp, _sfh_len = (uint32_t)keylen; \
|
482
594
|
\
|
483
|
-
|
595
|
+
unsigned _sfh_rem = _sfh_len & 3U; \
|
484
596
|
_sfh_len >>= 2; \
|
485
|
-
hashv =
|
597
|
+
hashv = 0xcafebabeu; \
|
486
598
|
\
|
487
599
|
/* Main loop */ \
|
488
|
-
for (;_sfh_len >
|
600
|
+
for (;_sfh_len > 0U; _sfh_len--) { \
|
489
601
|
hashv += get16bits (_sfh_key); \
|
490
|
-
_sfh_tmp
|
602
|
+
_sfh_tmp = ((uint32_t)(get16bits (_sfh_key+2)) << 11) ^ hashv; \
|
491
603
|
hashv = (hashv << 16) ^ _sfh_tmp; \
|
492
|
-
_sfh_key +=
|
604
|
+
_sfh_key += 2U*sizeof (uint16_t); \
|
493
605
|
hashv += hashv >> 11; \
|
494
606
|
} \
|
495
607
|
\
|
@@ -497,7 +609,7 @@ do {
|
|
497
609
|
switch (_sfh_rem) { \
|
498
610
|
case 3: hashv += get16bits (_sfh_key); \
|
499
611
|
hashv ^= hashv << 16; \
|
500
|
-
hashv ^= (uint32_t)(_sfh_key[sizeof (uint16_t)] << 18
|
612
|
+
hashv ^= (uint32_t)(_sfh_key[sizeof (uint16_t)]) << 18; \
|
501
613
|
hashv += hashv >> 11; \
|
502
614
|
break; \
|
503
615
|
case 2: hashv += get16bits (_sfh_key); \
|
@@ -516,8 +628,7 @@ do {
|
|
516
628
|
hashv += hashv >> 17; \
|
517
629
|
hashv ^= hashv << 25; \
|
518
630
|
hashv += hashv >> 6; \
|
519
|
-
|
520
|
-
} while(0)
|
631
|
+
} while (0)
|
521
632
|
|
522
633
|
#ifdef HASH_USING_NO_STRICT_ALIASING
|
523
634
|
/* The MurmurHash exploits some CPU's (x86,x86_64) tolerance for unaligned reads.
|
@@ -532,10 +643,10 @@ do {
|
|
532
643
|
#if (defined(__i386__) || defined(__x86_64__) || defined(_M_IX86))
|
533
644
|
#define MUR_GETBLOCK(p,i) p[i]
|
534
645
|
#else /* non intel */
|
535
|
-
#define MUR_PLUS0_ALIGNED(p) (((unsigned long)p &
|
536
|
-
#define MUR_PLUS1_ALIGNED(p) (((unsigned long)p &
|
537
|
-
#define MUR_PLUS2_ALIGNED(p) (((unsigned long)p &
|
538
|
-
#define MUR_PLUS3_ALIGNED(p) (((unsigned long)p &
|
646
|
+
#define MUR_PLUS0_ALIGNED(p) (((unsigned long)p & 3UL) == 0UL)
|
647
|
+
#define MUR_PLUS1_ALIGNED(p) (((unsigned long)p & 3UL) == 1UL)
|
648
|
+
#define MUR_PLUS2_ALIGNED(p) (((unsigned long)p & 3UL) == 2UL)
|
649
|
+
#define MUR_PLUS3_ALIGNED(p) (((unsigned long)p & 3UL) == 3UL)
|
539
650
|
#define WP(p) ((uint32_t*)((unsigned long)(p) & ~3UL))
|
540
651
|
#if (defined(__BIG_ENDIAN__) || defined(SPARC) || defined(__ppc__) || defined(__ppc64__))
|
541
652
|
#define MUR_THREE_ONE(p) ((((*WP(p))&0x00ffffff) << 8) | (((*(WP(p)+1))&0xff000000) >> 24))
|
@@ -555,24 +666,24 @@ do {
|
|
555
666
|
#define MUR_FMIX(_h) \
|
556
667
|
do { \
|
557
668
|
_h ^= _h >> 16; \
|
558
|
-
_h *=
|
669
|
+
_h *= 0x85ebca6bu; \
|
559
670
|
_h ^= _h >> 13; \
|
560
|
-
_h *=
|
671
|
+
_h *= 0xc2b2ae35u; \
|
561
672
|
_h ^= _h >> 16; \
|
562
|
-
} while(0)
|
673
|
+
} while (0)
|
563
674
|
|
564
|
-
#define HASH_MUR(key,keylen,
|
675
|
+
#define HASH_MUR(key,keylen,hashv) \
|
565
676
|
do { \
|
566
677
|
const uint8_t *_mur_data = (const uint8_t*)(key); \
|
567
|
-
const int _mur_nblocks = (keylen) / 4;
|
568
|
-
uint32_t _mur_h1 =
|
569
|
-
uint32_t _mur_c1 =
|
570
|
-
uint32_t _mur_c2 =
|
678
|
+
const int _mur_nblocks = (int)(keylen) / 4; \
|
679
|
+
uint32_t _mur_h1 = 0xf88D5353u; \
|
680
|
+
uint32_t _mur_c1 = 0xcc9e2d51u; \
|
681
|
+
uint32_t _mur_c2 = 0x1b873593u; \
|
571
682
|
uint32_t _mur_k1 = 0; \
|
572
683
|
const uint8_t *_mur_tail; \
|
573
|
-
const uint32_t *_mur_blocks = (const uint32_t*)(_mur_data+_mur_nblocks*4); \
|
684
|
+
const uint32_t *_mur_blocks = (const uint32_t*)(_mur_data+(_mur_nblocks*4)); \
|
574
685
|
int _mur_i; \
|
575
|
-
for(_mur_i = -_mur_nblocks; _mur_i; _mur_i++) {
|
686
|
+
for(_mur_i = -_mur_nblocks; _mur_i!=0; _mur_i++) { \
|
576
687
|
_mur_k1 = MUR_GETBLOCK(_mur_blocks,_mur_i); \
|
577
688
|
_mur_k1 *= _mur_c1; \
|
578
689
|
_mur_k1 = MUR_ROTL32(_mur_k1,15); \
|
@@ -580,42 +691,46 @@ do { \
|
|
580
691
|
\
|
581
692
|
_mur_h1 ^= _mur_k1; \
|
582
693
|
_mur_h1 = MUR_ROTL32(_mur_h1,13); \
|
583
|
-
_mur_h1 = _mur_h1*
|
694
|
+
_mur_h1 = (_mur_h1*5U) + 0xe6546b64u; \
|
584
695
|
} \
|
585
|
-
_mur_tail = (const uint8_t*)(_mur_data + _mur_nblocks*4);
|
696
|
+
_mur_tail = (const uint8_t*)(_mur_data + (_mur_nblocks*4)); \
|
586
697
|
_mur_k1=0; \
|
587
|
-
switch((keylen) &
|
588
|
-
case 3: _mur_k1 ^= _mur_tail[2] << 16;
|
589
|
-
case 2: _mur_k1 ^= _mur_tail[1] << 8;
|
590
|
-
case 1: _mur_k1 ^= _mur_tail[0];
|
698
|
+
switch((keylen) & 3U) { \
|
699
|
+
case 3: _mur_k1 ^= (uint32_t)_mur_tail[2] << 16; /* FALLTHROUGH */ \
|
700
|
+
case 2: _mur_k1 ^= (uint32_t)_mur_tail[1] << 8; /* FALLTHROUGH */ \
|
701
|
+
case 1: _mur_k1 ^= (uint32_t)_mur_tail[0]; \
|
591
702
|
_mur_k1 *= _mur_c1; \
|
592
703
|
_mur_k1 = MUR_ROTL32(_mur_k1,15); \
|
593
704
|
_mur_k1 *= _mur_c2; \
|
594
705
|
_mur_h1 ^= _mur_k1; \
|
595
706
|
} \
|
596
|
-
_mur_h1 ^= (keylen);
|
707
|
+
_mur_h1 ^= (uint32_t)(keylen); \
|
597
708
|
MUR_FMIX(_mur_h1); \
|
598
709
|
hashv = _mur_h1; \
|
599
|
-
|
600
|
-
} while(0)
|
710
|
+
} while (0)
|
601
711
|
#endif /* HASH_USING_NO_STRICT_ALIASING */
|
602
712
|
|
603
|
-
/* key comparison function; return 0 if keys equal */
|
604
|
-
#define HASH_KEYCMP(a,b,len) memcmp(a,b,len)
|
605
|
-
|
606
713
|
/* iterate over items in a known bucket to find desired item */
|
607
|
-
#define HASH_FIND_IN_BKT(tbl,hh,head,keyptr,keylen_in,out)
|
714
|
+
#define HASH_FIND_IN_BKT(tbl,hh,head,keyptr,keylen_in,hashval,out) \
|
608
715
|
do { \
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
716
|
+
if ((head).hh_head != NULL) { \
|
717
|
+
DECLTYPE_ASSIGN(out, ELMT_FROM_HH(tbl, (head).hh_head)); \
|
718
|
+
} else { \
|
719
|
+
(out) = NULL; \
|
720
|
+
} \
|
721
|
+
while ((out) != NULL) { \
|
722
|
+
if ((out)->hh.hashv == (hashval) && (out)->hh.keylen == (keylen_in)) { \
|
723
|
+
if (uthash_memcmp((out)->hh.key, keyptr, keylen_in) == 0) { \
|
724
|
+
break; \
|
725
|
+
} \
|
614
726
|
} \
|
615
|
-
if ((out)->hh.hh_next
|
616
|
-
|
617
|
-
|
618
|
-
|
727
|
+
if ((out)->hh.hh_next != NULL) { \
|
728
|
+
DECLTYPE_ASSIGN(out, ELMT_FROM_HH(tbl, (out)->hh.hh_next)); \
|
729
|
+
} else { \
|
730
|
+
(out) = NULL; \
|
731
|
+
} \
|
732
|
+
} \
|
733
|
+
} while (0)
|
619
734
|
|
620
735
|
/* add an item to a bucket */
|
621
736
|
#define HASH_ADD_TO_BKT(head,addhh) \
|
@@ -623,13 +738,13 @@ do {
|
|
623
738
|
head.count++; \
|
624
739
|
(addhh)->hh_next = head.hh_head; \
|
625
740
|
(addhh)->hh_prev = NULL; \
|
626
|
-
if (head.hh_head) { (head).hh_head->hh_prev = (addhh); }
|
741
|
+
if (head.hh_head != NULL) { (head).hh_head->hh_prev = (addhh); } \
|
627
742
|
(head).hh_head=addhh; \
|
628
|
-
if (head.count >= ((head.expand_mult+
|
629
|
-
&& (addhh)->tbl->noexpand !=
|
743
|
+
if ((head.count >= ((head.expand_mult+1U) * HASH_BKT_CAPACITY_THRESH)) \
|
744
|
+
&& ((addhh)->tbl->noexpand != 1U)) { \
|
630
745
|
HASH_EXPAND_BUCKETS((addhh)->tbl); \
|
631
746
|
} \
|
632
|
-
} while(0)
|
747
|
+
} while (0)
|
633
748
|
|
634
749
|
/* remove an item from a given bucket */
|
635
750
|
#define HASH_DEL_IN_BKT(hh,head,hh_del) \
|
@@ -680,20 +795,20 @@ do {
|
|
680
795
|
struct UT_hash_handle *_he_thh, *_he_hh_nxt; \
|
681
796
|
UT_hash_bucket *_he_new_buckets, *_he_newbkt; \
|
682
797
|
_he_new_buckets = (UT_hash_bucket*)uthash_malloc( \
|
683
|
-
|
798
|
+
2UL * tbl->num_buckets * sizeof(struct UT_hash_bucket)); \
|
684
799
|
if (!_he_new_buckets) { uthash_fatal( "out of memory"); } \
|
685
800
|
memset(_he_new_buckets, 0, \
|
686
|
-
|
801
|
+
2UL * tbl->num_buckets * sizeof(struct UT_hash_bucket)); \
|
687
802
|
tbl->ideal_chain_maxlen = \
|
688
|
-
(tbl->num_items >> (tbl->log2_num_buckets+
|
689
|
-
((tbl->num_items & ((tbl->num_buckets*
|
803
|
+
(tbl->num_items >> (tbl->log2_num_buckets+1U)) + \
|
804
|
+
(((tbl->num_items & ((tbl->num_buckets*2U)-1U)) != 0U) ? 1U : 0U); \
|
690
805
|
tbl->nonideal_items = 0; \
|
691
806
|
for(_he_bkt_i = 0; _he_bkt_i < tbl->num_buckets; _he_bkt_i++) \
|
692
807
|
{ \
|
693
808
|
_he_thh = tbl->buckets[ _he_bkt_i ].hh_head; \
|
694
|
-
while (_he_thh) {
|
809
|
+
while (_he_thh != NULL) { \
|
695
810
|
_he_hh_nxt = _he_thh->hh_next; \
|
696
|
-
HASH_TO_BKT( _he_thh->hashv, tbl->num_buckets*
|
811
|
+
HASH_TO_BKT( _he_thh->hashv, tbl->num_buckets*2U, _he_bkt); \
|
697
812
|
_he_newbkt = &(_he_new_buckets[ _he_bkt ]); \
|
698
813
|
if (++(_he_newbkt->count) > tbl->ideal_chain_maxlen) { \
|
699
814
|
tbl->nonideal_items++; \
|
@@ -702,24 +817,24 @@ do {
|
|
702
817
|
} \
|
703
818
|
_he_thh->hh_prev = NULL; \
|
704
819
|
_he_thh->hh_next = _he_newbkt->hh_head; \
|
705
|
-
if (_he_newbkt->hh_head) _he_newbkt->hh_head->hh_prev =
|
706
|
-
_he_thh;
|
820
|
+
if (_he_newbkt->hh_head != NULL) { _he_newbkt->hh_head->hh_prev = \
|
821
|
+
_he_thh; } \
|
707
822
|
_he_newbkt->hh_head = _he_thh; \
|
708
823
|
_he_thh = _he_hh_nxt; \
|
709
824
|
} \
|
710
825
|
} \
|
711
826
|
uthash_free( tbl->buckets, tbl->num_buckets*sizeof(struct UT_hash_bucket) ); \
|
712
|
-
tbl->num_buckets *=
|
827
|
+
tbl->num_buckets *= 2U; \
|
713
828
|
tbl->log2_num_buckets++; \
|
714
829
|
tbl->buckets = _he_new_buckets; \
|
715
830
|
tbl->ineff_expands = (tbl->nonideal_items > (tbl->num_items >> 1)) ? \
|
716
|
-
(tbl->ineff_expands+
|
717
|
-
if (tbl->ineff_expands >
|
831
|
+
(tbl->ineff_expands+1U) : 0U; \
|
832
|
+
if (tbl->ineff_expands > 1U) { \
|
718
833
|
tbl->noexpand=1; \
|
719
834
|
uthash_noexpand_fyi(tbl); \
|
720
835
|
} \
|
721
836
|
uthash_expand_fyi(tbl); \
|
722
|
-
} while(0)
|
837
|
+
} while (0)
|
723
838
|
|
724
839
|
|
725
840
|
/* This is an adaptation of Simon Tatham's O(n log(n)) mergesort */
|
@@ -731,38 +846,38 @@ do {
|
|
731
846
|
unsigned _hs_i; \
|
732
847
|
unsigned _hs_looping,_hs_nmerges,_hs_insize,_hs_psize,_hs_qsize; \
|
733
848
|
struct UT_hash_handle *_hs_p, *_hs_q, *_hs_e, *_hs_list, *_hs_tail; \
|
734
|
-
if (head) {
|
849
|
+
if (head != NULL) { \
|
735
850
|
_hs_insize = 1; \
|
736
851
|
_hs_looping = 1; \
|
737
852
|
_hs_list = &((head)->hh); \
|
738
|
-
while (_hs_looping) {
|
853
|
+
while (_hs_looping != 0U) { \
|
739
854
|
_hs_p = _hs_list; \
|
740
855
|
_hs_list = NULL; \
|
741
856
|
_hs_tail = NULL; \
|
742
857
|
_hs_nmerges = 0; \
|
743
|
-
while (_hs_p) {
|
858
|
+
while (_hs_p != NULL) { \
|
744
859
|
_hs_nmerges++; \
|
745
860
|
_hs_q = _hs_p; \
|
746
861
|
_hs_psize = 0; \
|
747
862
|
for ( _hs_i = 0; _hs_i < _hs_insize; _hs_i++ ) { \
|
748
863
|
_hs_psize++; \
|
749
|
-
_hs_q = (UT_hash_handle*)((_hs_q->next) ?
|
864
|
+
_hs_q = (UT_hash_handle*)((_hs_q->next != NULL) ? \
|
750
865
|
((void*)((char*)(_hs_q->next) + \
|
751
866
|
(head)->hh.tbl->hho)) : NULL); \
|
752
|
-
if (! (_hs_q) ) break;
|
867
|
+
if (! (_hs_q) ) { break; } \
|
753
868
|
} \
|
754
869
|
_hs_qsize = _hs_insize; \
|
755
|
-
while ((_hs_psize >
|
756
|
-
if (_hs_psize ==
|
870
|
+
while ((_hs_psize > 0U) || ((_hs_qsize > 0U) && (_hs_q != NULL))) {\
|
871
|
+
if (_hs_psize == 0U) { \
|
757
872
|
_hs_e = _hs_q; \
|
758
|
-
_hs_q = (UT_hash_handle*)((_hs_q->next) ?
|
873
|
+
_hs_q = (UT_hash_handle*)((_hs_q->next != NULL) ? \
|
759
874
|
((void*)((char*)(_hs_q->next) + \
|
760
875
|
(head)->hh.tbl->hho)) : NULL); \
|
761
876
|
_hs_qsize--; \
|
762
|
-
} else if ( (_hs_qsize ==
|
877
|
+
} else if ( (_hs_qsize == 0U) || (_hs_q == NULL) ) { \
|
763
878
|
_hs_e = _hs_p; \
|
764
|
-
if (_hs_p){
|
765
|
-
_hs_p = (UT_hash_handle*)((_hs_p->next) ?
|
879
|
+
if (_hs_p != NULL){ \
|
880
|
+
_hs_p = (UT_hash_handle*)((_hs_p->next != NULL) ? \
|
766
881
|
((void*)((char*)(_hs_p->next) + \
|
767
882
|
(head)->hh.tbl->hho)) : NULL); \
|
768
883
|
} \
|
@@ -772,42 +887,42 @@ do {
|
|
772
887
|
DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl,_hs_q))) \
|
773
888
|
) <= 0) { \
|
774
889
|
_hs_e = _hs_p; \
|
775
|
-
if (_hs_p){
|
776
|
-
_hs_p = (UT_hash_handle*)((_hs_p->next) ?
|
890
|
+
if (_hs_p != NULL){ \
|
891
|
+
_hs_p = (UT_hash_handle*)((_hs_p->next != NULL) ? \
|
777
892
|
((void*)((char*)(_hs_p->next) + \
|
778
893
|
(head)->hh.tbl->hho)) : NULL); \
|
779
894
|
} \
|
780
895
|
_hs_psize--; \
|
781
896
|
} else { \
|
782
897
|
_hs_e = _hs_q; \
|
783
|
-
_hs_q = (UT_hash_handle*)((_hs_q->next) ?
|
898
|
+
_hs_q = (UT_hash_handle*)((_hs_q->next != NULL) ? \
|
784
899
|
((void*)((char*)(_hs_q->next) + \
|
785
900
|
(head)->hh.tbl->hho)) : NULL); \
|
786
901
|
_hs_qsize--; \
|
787
902
|
} \
|
788
|
-
if ( _hs_tail ) {
|
789
|
-
_hs_tail->next = ((_hs_e) ?
|
903
|
+
if ( _hs_tail != NULL ) { \
|
904
|
+
_hs_tail->next = ((_hs_e != NULL) ? \
|
790
905
|
ELMT_FROM_HH((head)->hh.tbl,_hs_e) : NULL); \
|
791
906
|
} else { \
|
792
907
|
_hs_list = _hs_e; \
|
793
908
|
} \
|
794
|
-
if (_hs_e) {
|
795
|
-
_hs_e->prev = ((_hs_tail) ?
|
909
|
+
if (_hs_e != NULL) { \
|
910
|
+
_hs_e->prev = ((_hs_tail != NULL) ? \
|
796
911
|
ELMT_FROM_HH((head)->hh.tbl,_hs_tail) : NULL); \
|
797
912
|
} \
|
798
913
|
_hs_tail = _hs_e; \
|
799
914
|
} \
|
800
915
|
_hs_p = _hs_q; \
|
801
916
|
} \
|
802
|
-
if (_hs_tail){
|
917
|
+
if (_hs_tail != NULL){ \
|
803
918
|
_hs_tail->next = NULL; \
|
804
919
|
} \
|
805
|
-
if ( _hs_nmerges <=
|
920
|
+
if ( _hs_nmerges <= 1U ) { \
|
806
921
|
_hs_looping=0; \
|
807
922
|
(head)->hh.tbl->tail = _hs_tail; \
|
808
923
|
DECLTYPE_ASSIGN(head,ELMT_FROM_HH((head)->hh.tbl, _hs_list)); \
|
809
924
|
} \
|
810
|
-
_hs_insize *=
|
925
|
+
_hs_insize *= 2U; \
|
811
926
|
} \
|
812
927
|
HASH_FSCK(hh,head); \
|
813
928
|
} \
|
@@ -824,10 +939,10 @@ do {
|
|
824
939
|
void *_last_elt=NULL, *_elt; \
|
825
940
|
UT_hash_handle *_src_hh, *_dst_hh, *_last_elt_hh=NULL; \
|
826
941
|
ptrdiff_t _dst_hho = ((char*)(&(dst)->hh_dst) - (char*)(dst)); \
|
827
|
-
if (src) {
|
942
|
+
if (src != NULL) { \
|
828
943
|
for(_src_bkt=0; _src_bkt < (src)->hh_src.tbl->num_buckets; _src_bkt++) { \
|
829
944
|
for(_src_hh = (src)->hh_src.tbl->buckets[_src_bkt].hh_head; \
|
830
|
-
_src_hh;
|
945
|
+
_src_hh != NULL; \
|
831
946
|
_src_hh = _src_hh->hh_next) { \
|
832
947
|
_elt = ELMT_FROM_HH((src)->hh_src.tbl, _src_hh); \
|
833
948
|
if (cond(_elt)) { \
|
@@ -837,8 +952,8 @@ do {
|
|
837
952
|
_dst_hh->hashv = _src_hh->hashv; \
|
838
953
|
_dst_hh->prev = _last_elt; \
|
839
954
|
_dst_hh->next = NULL; \
|
840
|
-
if (_last_elt_hh) { _last_elt_hh->next = _elt; }
|
841
|
-
if (
|
955
|
+
if (_last_elt_hh != NULL) { _last_elt_hh->next = _elt; } \
|
956
|
+
if (dst == NULL) { \
|
842
957
|
DECLTYPE_ASSIGN(dst,_elt); \
|
843
958
|
HASH_MAKE_TABLE(hh_dst,dst); \
|
844
959
|
} else { \
|
@@ -858,34 +973,35 @@ do {
|
|
858
973
|
|
859
974
|
#define HASH_CLEAR(hh,head) \
|
860
975
|
do { \
|
861
|
-
if (head) {
|
976
|
+
if (head != NULL) { \
|
862
977
|
uthash_free((head)->hh.tbl->buckets, \
|
863
978
|
(head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket)); \
|
864
979
|
HASH_BLOOM_FREE((head)->hh.tbl); \
|
865
980
|
uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \
|
866
981
|
(head)=NULL; \
|
867
982
|
} \
|
868
|
-
} while(0)
|
983
|
+
} while (0)
|
869
984
|
|
870
985
|
#define HASH_OVERHEAD(hh,head) \
|
871
|
-
(
|
872
|
-
|
873
|
-
|
874
|
-
|
986
|
+
((head != NULL) ? ( \
|
987
|
+
(size_t)(((head)->hh.tbl->num_items * sizeof(UT_hash_handle)) + \
|
988
|
+
((head)->hh.tbl->num_buckets * sizeof(UT_hash_bucket)) + \
|
989
|
+
sizeof(UT_hash_table) + \
|
990
|
+
(HASH_BLOOM_BYTELEN))) : 0U)
|
875
991
|
|
876
992
|
#ifdef NO_DECLTYPE
|
877
993
|
#define HASH_ITER(hh,head,el,tmp) \
|
878
|
-
for((el)=(head), (*(char**)(&(tmp)))=(char*)((head)?(head)->hh.next:NULL);
|
879
|
-
el; (el)=(tmp),(*(char**)(&(tmp)))=(char*)((tmp)?(tmp)->hh.next:NULL))
|
994
|
+
for(((el)=(head)), ((*(char**)(&(tmp)))=(char*)((head!=NULL)?(head)->hh.next:NULL)); \
|
995
|
+
(el) != NULL; ((el)=(tmp)), ((*(char**)(&(tmp)))=(char*)((tmp!=NULL)?(tmp)->hh.next:NULL)))
|
880
996
|
#else
|
881
997
|
#define HASH_ITER(hh,head,el,tmp) \
|
882
|
-
for((el)=(head),(tmp)=DECLTYPE(el)((head)?(head)->hh.next:NULL);
|
883
|
-
el; (el)=(tmp),(tmp)=DECLTYPE(el)((tmp)?(tmp)->hh.next:NULL))
|
998
|
+
for(((el)=(head)), ((tmp)=DECLTYPE(el)((head!=NULL)?(head)->hh.next:NULL)); \
|
999
|
+
(el) != NULL; ((el)=(tmp)), ((tmp)=DECLTYPE(el)((tmp!=NULL)?(tmp)->hh.next:NULL)))
|
884
1000
|
#endif
|
885
1001
|
|
886
1002
|
/* obtain a count of items in the hash */
|
887
1003
|
#define HASH_COUNT(head) HASH_CNT(hh,head)
|
888
|
-
#define HASH_CNT(hh,head) ((head)?((head)->hh.tbl->num_items):
|
1004
|
+
#define HASH_CNT(hh,head) ((head != NULL)?((head)->hh.tbl->num_items):0U)
|
889
1005
|
|
890
1006
|
typedef struct UT_hash_bucket {
|
891
1007
|
struct UT_hash_handle *hh_head;
|
@@ -908,8 +1024,8 @@ typedef struct UT_hash_bucket {
|
|
908
1024
|
} UT_hash_bucket;
|
909
1025
|
|
910
1026
|
/* random signature used only to find hash tables in external analysis */
|
911
|
-
#define HASH_SIGNATURE
|
912
|
-
#define HASH_BLOOM_SIGNATURE
|
1027
|
+
#define HASH_SIGNATURE 0xa0111fe1u
|
1028
|
+
#define HASH_BLOOM_SIGNATURE 0xb12220f2u
|
913
1029
|
|
914
1030
|
typedef struct UT_hash_table {
|
915
1031
|
UT_hash_bucket *buckets;
|
@@ -939,7 +1055,7 @@ typedef struct UT_hash_table {
|
|
939
1055
|
#ifdef HASH_BLOOM
|
940
1056
|
uint32_t bloom_sig; /* used only to test bloom exists in external analysis */
|
941
1057
|
uint8_t *bloom_bv;
|
942
|
-
|
1058
|
+
uint8_t bloom_nbits;
|
943
1059
|
#endif
|
944
1060
|
|
945
1061
|
} UT_hash_table;
|