Clang compilation targets may support `__declspec` attributes. Because of that it has a `__has_declspec_attribute` [check](https://clang.llvm.org/docs/LanguageExtensions.html#has-declspec-attribute).
Currently libpsl just assumes that `__declspec` is Windows only. This adds a compatibility macro and checks whether `dllimport` and `dllexport` are available.
Introduce a macro, PSL_PUBLIC, which is defined as nothing by default,
which can be used by the compiler to instruct the linker to export the
public symbols, such as __declspec (dllexport) on Visual Studio.
When writing a wrapper around LibPSL in a different language it is
important that libpsl provide functions to free any memory that it
allocates. Without this, it is impossible to correctly free the memory
allocated by psl_str_to_utf8lower() function since in other languages
one may not have access to the same free() call from libc.
Also add a new ./configure function to set a distribution wide
PSL file used by psl_latest(): --with-psl-distfile
If possible that filename should point to a DAFSA PSL file that
becomes updated regularly.
This uses the more common convention where the variable freed is the
thing returned from the constructor directly, rather than having the
deallocator also zero out the pointer itself.
In general, we don't want libraries to send data to the standard file
descriptors. There are more that need fixing.
Note: this introduces a new API (psl_suffix_count() and
psl_suffix_exception_count) to enable the same sort of output from the
test. But this new API seems to imply the internal structure of the
public suffix list.
Do we want to expose this API? There could be some other PSL
mechanism (e.g. DBOUND) that doesn't have these counts, and a drop-in
replacement would not know what to return here.