diff options
author | Don Anderson <dda@ddanderson.com> | 2011-12-13 21:30:42 -0500 |
---|---|---|
committer | Don Anderson <dda@ddanderson.com> | 2011-12-13 21:30:42 -0500 |
commit | 0bf1a7819f86badec0829adde5908380fdba4655 (patch) | |
tree | 73ac7461ccd0ec465f61bf3ca24a9b10a96515aa /examples/c/ex_all.c | |
parent | 5e082d25c1bf27c1e1c5f777bc8f3aa3fb2b21d7 (diff) | |
download | mongo-0bf1a7819f86badec0829adde5908380fdba4655.tar.gz |
Added a pre_size entry to WT_COMPRESSOR. refs #58
Implemented pre_size for the snappy compressor to eliminate
the extra buffer allocation and copy.
Diffstat (limited to 'examples/c/ex_all.c')
-rw-r--r-- | examples/c/ex_all.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/examples/c/ex_all.c b/examples/c/ex_all.c index 0b5c0719633..8ec88bfb56a 100644 --- a/examples/c/ex_all.c +++ b/examples/c/ex_all.c @@ -387,6 +387,14 @@ my_decompress(WT_COMPRESSOR *compressor, dest->size = source->size; return (0); } + +static int +my_pre_size(WT_COMPRESSOR *compressor, + WT_SESSION *session, const WT_ITEM *source, WT_ITEM *dest) +{ + dest->size = source->size; + return (0); +} /*! [Implement WT_COMPRESSOR] */ int @@ -395,7 +403,8 @@ add_compressor(WT_CONNECTION *conn) int ret; /*! [Register a new compressor] */ - static WT_COMPRESSOR my_compressor = { my_compress, my_decompress }; + static WT_COMPRESSOR my_compressor = { + my_compress, my_decompress, my_pre_size }; ret = conn->add_compressor(conn, "my_compress", &my_compressor, NULL); /*! [Register a new compressor] */ |