builtin should be returned const
callers should never try to do any non-const operation with the builtin public suffix list.
This commit is contained in:
parent
8f7c266b26
commit
6e7e58aa38
|
@ -64,7 +64,7 @@ psl_ctx_t *
|
||||||
psl_load_file(const char *fname);
|
psl_load_file(const char *fname);
|
||||||
psl_ctx_t *
|
psl_ctx_t *
|
||||||
psl_load_fp(FILE *fp);
|
psl_load_fp(FILE *fp);
|
||||||
psl_ctx_t *
|
const psl_ctx_t *
|
||||||
psl_builtin(void);
|
psl_builtin(void);
|
||||||
int
|
int
|
||||||
psl_is_public(const psl_ctx_t *psl, const char *domain);
|
psl_is_public(const psl_ctx_t *psl, const char *domain);
|
||||||
|
|
|
@ -81,8 +81,8 @@ struct _psl_ctx_st {
|
||||||
#include "suffixes.c"
|
#include "suffixes.c"
|
||||||
|
|
||||||
// references to this PSL will result in lookups to built-in data
|
// references to this PSL will result in lookups to built-in data
|
||||||
static psl_ctx_t
|
static const psl_ctx_t
|
||||||
_builtin_psl;
|
_builtin_psl = { .suffixes = NULL, .suffix_exceptions = NULL, };
|
||||||
|
|
||||||
static _psl_vector_t *_vector_alloc(int max, int (*cmp)(const _psl_entry_t *, const _psl_entry_t *))
|
static _psl_vector_t *_vector_alloc(int max, int (*cmp)(const _psl_entry_t *, const _psl_entry_t *))
|
||||||
{
|
{
|
||||||
|
@ -380,7 +380,7 @@ psl_ctx_t *psl_load_fp(FILE *fp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// return built-in PSL structure
|
// return built-in PSL structure
|
||||||
psl_ctx_t *psl_builtin(void)
|
const psl_ctx_t *psl_builtin(void)
|
||||||
{
|
{
|
||||||
return &_builtin_psl;
|
return &_builtin_psl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ static void test_psl(void)
|
||||||
{ "www.xn--czr694b", 1 },
|
{ "www.xn--czr694b", 1 },
|
||||||
};
|
};
|
||||||
unsigned it;
|
unsigned it;
|
||||||
psl_ctx_t *psl;
|
const psl_ctx_t *psl;
|
||||||
|
|
||||||
if (psl_global_init() == 0) {
|
if (psl_global_init() == 0) {
|
||||||
psl = psl_builtin();
|
psl = psl_builtin();
|
||||||
|
|
Loading…
Reference in New Issue