File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ if [ $? -ne 0 ]; then
3636fi
3737
3838python scripts/sync_version.py
39- python -m pip3 install -e . -vvv
39+ python -m pip install -e . -vvv
4040
4141# Test that the import works
4242echo " Testing import..."
Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ namespace libcachesim {
2828
2929namespace py = pybind11;
3030
31+ const cache_obj_t * LHD_HIT_MARKER = reinterpret_cast <cache_obj_t *>(0x1 );
32+
3133// Custom deleters for smart pointers
3234struct CacheDeleter {
3335 void operator ()(cache_t * ptr) const {
@@ -286,11 +288,11 @@ void export_cache(py::module& m) {
286288 return py::none ();
287289 }
288290 // NOTE(haocheng): For LHD only, return a dummy object for hit
289- if (obj == reinterpret_cast < cache_obj_t *>( 0x1 ) ) {
290- cache_obj_t * obj = new cache_obj_t ( );
291- obj ->obj_id = req.obj_id ;
292- obj ->obj_size = req.obj_size ;
293- return py::cast (std::unique_ptr<cache_obj_t , CacheObjectDeleter>(obj ));
291+ if (obj == LHD_HIT_MARKER ) {
292+ cache_obj_t * dummy_obj = static_cast < cache_obj_t *>( calloc ( 1 , sizeof ( cache_obj_t )) );
293+ dummy_obj ->obj_id = req.obj_id ;
294+ dummy_obj ->obj_size = req.obj_size ;
295+ return py::cast (std::unique_ptr<cache_obj_t , CacheObjectDeleter>(dummy_obj ));
294296 }
295297 return py::cast (obj, py::return_value_policy::reference);
296298 },
You can’t perform that action at this time.
0 commit comments