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:
Daniel Kahn Gillmor 2014-03-24 18:18:45 -04:00
parent 8f7c266b26
commit 6e7e58aa38
3 changed files with 5 additions and 5 deletions

View File

@ -64,7 +64,7 @@ psl_ctx_t *
psl_load_file(const char *fname);
psl_ctx_t *
psl_load_fp(FILE *fp);
psl_ctx_t *
const psl_ctx_t *
psl_builtin(void);
int
psl_is_public(const psl_ctx_t *psl, const char *domain);

View File

@ -81,8 +81,8 @@ struct _psl_ctx_st {
#include "suffixes.c"
// references to this PSL will result in lookups to built-in data
static psl_ctx_t
_builtin_psl;
static const psl_ctx_t
_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 *))
{
@ -380,7 +380,7 @@ psl_ctx_t *psl_load_fp(FILE *fp)
}
// return built-in PSL structure
psl_ctx_t *psl_builtin(void)
const psl_ctx_t *psl_builtin(void)
{
return &_builtin_psl;
}

View File

@ -70,7 +70,7 @@ static void test_psl(void)
{ "www.xn--czr694b", 1 },
};
unsigned it;
psl_ctx_t *psl;
const psl_ctx_t *psl;
if (psl_global_init() == 0) {
psl = psl_builtin();