Skip to content
Snippets Groups Projects
Commit 151870d1 authored by Alaric Senat's avatar Alaric Senat
Browse files

XxHasher: Fix unused attribute warning

Work around a GCC `-Wignored-attributes` warning that was triggered due
to `fclose` being tagged as `__nonnull((1))`.
parent 6df94f62
No related branches found
No related tags found
No related merge requests found
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
# include <xxh_x86dispatch.h> # include <xxh_x86dispatch.h>
#endif #endif
#include <functional>
#include <memory> #include <memory>
#include <cstdio> #include <cstdio>
#include <cinttypes> #include <cinttypes>
...@@ -71,8 +71,8 @@ uint64_t xxFromBuff( const uint8_t* buff, size_t size ) ...@@ -71,8 +71,8 @@ uint64_t xxFromBuff( const uint8_t* buff, size_t size )
uint64_t xxFromFile( const std::string& path ) uint64_t xxFromFile( const std::string& path )
{ {
std::unique_ptr<FILE, decltype(&fclose)> file{ std::unique_ptr<FILE, std::function<void(FILE*)>> file{
fopen( path.c_str(), "rb" ), &fclose fopen( path.c_str(), "rb" ), [](FILE *f) { fclose(f); }
}; };
std::unique_ptr<XXH3_state_t, decltype(&XXH3_freeState)> state{ std::unique_ptr<XXH3_state_t, decltype(&XXH3_freeState)> state{
XXH3_createState(), &XXH3_freeState XXH3_createState(), &XXH3_freeState
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment