From 8e91838fd5cde057b3ffc695ae620327912d9fb1 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 18 Apr 2018 13:52:38 +0800 Subject: [PATCH] libpsl.h.in: Decorate public symbols for export 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. --- include/libpsl.h.in | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/libpsl.h.in b/include/libpsl.h.in index a98e70f..d837a27 100644 --- a/include/libpsl.h.in +++ b/include/libpsl.h.in @@ -40,6 +40,10 @@ #define PSL_VERSION_PATCH @LIBPSL_VERSION_PATCH@ #define PSL_VERSION_NUMBER @LIBPSL_VERSION_NUMBER@ +#ifndef PSL_PUBLIC +# define PSL_PUBLIC +#endif + #ifdef __cplusplus extern "C" { #endif @@ -77,90 +81,112 @@ typedef enum { typedef struct _psl_ctx_st psl_ctx_t; /* frees PSL context */ +PSL_PUBLIC void psl_free(psl_ctx_t *psl); /* frees memory allocated by libpsl routines */ +PSL_PUBLIC void psl_free_string(char *str); /* loads PSL data from file */ +PSL_PUBLIC psl_ctx_t * psl_load_file(const char *fname); /* loads PSL data from FILE pointer */ +PSL_PUBLIC psl_ctx_t * psl_load_fp(FILE *fp); /* retrieves builtin PSL data */ +PSL_PUBLIC const psl_ctx_t * psl_builtin(void); /* retrieves most recent PSL data */ +PSL_PUBLIC psl_ctx_t * psl_latest(const char *fname); /* checks whether domain is a public suffix or not */ +PSL_PUBLIC int psl_is_public_suffix(const psl_ctx_t *psl, const char *domain); /* checks whether domain is a public suffix regarding the type or not */ +PSL_PUBLIC int psl_is_public_suffix2(const psl_ctx_t *psl, const char *domain, int type); /* checks whether cookie_domain is acceptable for domain or not */ +PSL_PUBLIC int psl_is_cookie_domain_acceptable(const psl_ctx_t *psl, const char *hostname, const char *cookie_domain); /* returns the longest not registrable domain within 'domain' or NULL if none found */ +PSL_PUBLIC const char * psl_unregistrable_domain(const psl_ctx_t *psl, const char *domain); /* returns the shortest possible registrable domain part or NULL if domain is not registrable at all */ +PSL_PUBLIC const char * psl_registrable_domain(const psl_ctx_t *psl, const char *domain); /* convert a string into lowercase UTF-8 */ +PSL_PUBLIC psl_error_t psl_str_to_utf8lower(const char *str, const char *encoding, const char *locale, char **lower); /* does not include exceptions */ +PSL_PUBLIC int psl_suffix_count(const psl_ctx_t *psl); /* just counts exceptions */ +PSL_PUBLIC int psl_suffix_exception_count(const psl_ctx_t *psl); /* just counts wildcards */ +PSL_PUBLIC int psl_suffix_wildcard_count(const psl_ctx_t *psl); /* returns mtime of PSL source file */ +PSL_PUBLIC time_t psl_builtin_file_time(void); /* returns SHA1 checksum (hex-encoded, lowercase) of PSL source file */ +PSL_PUBLIC const char * psl_builtin_sha1sum(void); /* returns file name of PSL source file */ +PSL_PUBLIC const char * psl_builtin_filename(void); /* returns name of distribution PSL data file */ +PSL_PUBLIC const char * psl_dist_filename(void); /* returns library version string */ +PSL_PUBLIC const char * psl_get_version(void); /* checks library version number */ +PSL_PUBLIC int psl_check_version_number(int version); /* returns whether the built-in data is outdated or not */ +PSL_PUBLIC int psl_builtin_outdated(void);