1
Fork 0

clean up build a bit

This commit is contained in:
Motiejus Jakštys 2022-03-20 08:46:17 +01:00 committed by Motiejus Jakštys
parent b220dd92e3
commit 886382d900
2 changed files with 3 additions and 14 deletions

View File

@ -19,39 +19,28 @@ pub fn build(b: *zbs.Builder) void {
cmph.force_pic = true;
cmph.addCSourceFiles(&.{
"deps/cmph/src/bdz.c",
//"deps/cmph/src/bdz_gen_lookup_table.c",
"deps/cmph/src/bdz_ph.c",
//"deps/cmph/src/bm_numbers.c",
"deps/cmph/src/bmz8.c",
"deps/cmph/src/bmz.c",
"deps/cmph/src/brz.c",
"deps/cmph/src/buffer_entry.c",
//"deps/cmph/src/buffer_manage.c",
"deps/cmph/src/buffer_manager.c",
"deps/cmph/src/chd.c",
"deps/cmph/src/chd_ph.c",
"deps/cmph/src/chm.c",
//"deps/cmph/src/cmph_benchmark.c",
"deps/cmph/src/cmph.c",
"deps/cmph/src/cmph_structs.c",
"deps/cmph/src/compressed_rank.c",
"deps/cmph/src/compressed_seq.c",
//"deps/cmph/src/djb2_hash.c",
"deps/cmph/src/fch_buckets.c",
"deps/cmph/src/fch.c",
//"deps/cmph/src/fnv_hash.c",
"deps/cmph/src/graph.c",
"deps/cmph/src/hash.c",
//"deps/cmph/src/hashtree.c"
"deps/cmph/src/jenkins_hash.c",
"deps/cmph/src/linear_string_map.c",
//"deps/cmph/src/main.c",
"deps/cmph/src/miller_rabin.c",
//"deps/cmph/src/sdbm_hash.c",
"deps/cmph/src/select.c",
"deps/cmph/src/vqueue.c",
//"deps/cmph/src/vstack.c",
//"deps/cmph/src/wingetopt.c",
}, &.{
"-W",
"-Wno-unused-function",

View File

@ -24,7 +24,7 @@ extern fn cmph_io_vector_adapter_destroy(key_source: [*]u8) void;
extern fn cmph_config_new(key_source: [*]const u8) ?[*]u8;
extern fn cmph_config_set_algo(mph: [*]u8, algo: c_int) void;
extern fn cmph_config_set_b(mph: [*]u8, b: c_int) void;
extern fn cmph_new(config: [*]const u8) ?[*]const u8;
extern fn cmph_new(config: [*]const u8) ?[*]u8;
extern fn cmph_config_destroy(mph: [*]u8) void;
extern fn cmph_packed_size(mphf: [*]const u8) u32;
extern fn cmph_pack(mphf: [*]const u8, packed_mphf: [*]u8) void;
@ -33,7 +33,7 @@ extern fn cmph_destroy(mphf: [*]const u8) void;
// pack packs cmph hashes for the given input and returns a slice ("cmph pack
// minus first 4 bytes") for further storage. The slice must be freed by the
// caller.
pub const Error = Allocator.Error || error{Overflow};
pub const Error = error{ OutOfMemory, Overflow };
pub fn pack(allocator: Allocator, input: [][*:0]const u8) Error![]const u8 {
const input_len = try math.cast(c_uint, input.len);
var source = cmph_io_vector_adapter(input.ptr, input_len);
@ -161,7 +161,7 @@ test "pack str" {
try testing.expectEqual(i, hash);
}
test "CMPH_ALGO is in sync" {
test "CMPH_ALGO.CMPH_BDZ is in sync with our definition" {
const c = @cImport({
@cInclude("cmph_types.h");
});