]> git.ipfire.org Git - thirdparty/pdns.git/commit
misc: Implement pdns::UniqueFilePtr
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 18 Mar 2024 09:19:06 +0000 (10:19 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 18 Mar 2024 09:19:06 +0000 (10:19 +0100)
commit20b2f2041a04a2e16f6bf4781c177a6aa3adec2b
treeb4924bdff0193c1e458b8270d5fbead5e06be8e0
parent777359f8e518ddf086d893628591902c828c0169
misc: Implement pdns::UniqueFilePtr

Using a deleter instead of `decltype(&fclose)` has two big advantages:
- the deleter is included in the type and does not have to be passed
  when creating a new object (easier to use, less memory usage, in theory
  better inlining)
- we avoid the annoying `ignoring attributes on template argument ‘int (*)(FILE*)’`
  warning from the compiler, which is there because `fclose` is tagged as `__nonnull((1))`
pdns/misc.cc
pdns/misc.hh