Rename f to ksf in the global function namespace to avoid -Wshadow warning
Based on a report from Matthias Dieter Wallnöfer.
This commit is contained in:
@@ -367,7 +367,7 @@ file_init_common(hx509_context context,
|
|||||||
const char *residue, hx509_lock lock, outformat format)
|
const char *residue, hx509_lock lock, outformat format)
|
||||||
{
|
{
|
||||||
char *p, *pnext;
|
char *p, *pnext;
|
||||||
struct ks_file *f = NULL;
|
struct ks_file *ksf = NULL;
|
||||||
hx509_private_key *keys = NULL;
|
hx509_private_key *keys = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
struct pem_ctx pem_ctx;
|
struct pem_ctx pem_ctx;
|
||||||
@@ -380,15 +380,15 @@ file_init_common(hx509_context context,
|
|||||||
if (lock == NULL)
|
if (lock == NULL)
|
||||||
lock = _hx509_empty_lock;
|
lock = _hx509_empty_lock;
|
||||||
|
|
||||||
f = calloc(1, sizeof(*f));
|
ksf = calloc(1, sizeof(*ksf));
|
||||||
if (f == NULL) {
|
if (ksf == NULL) {
|
||||||
hx509_clear_error_string(context);
|
hx509_clear_error_string(context);
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
f->format = format;
|
ksf->format = format;
|
||||||
|
|
||||||
f->fn = strdup(residue);
|
ksf->fn = strdup(residue);
|
||||||
if (f->fn == NULL) {
|
if (ksf->fn == NULL) {
|
||||||
hx509_clear_error_string(context);
|
hx509_clear_error_string(context);
|
||||||
ret = ENOMEM;
|
ret = ENOMEM;
|
||||||
goto out;
|
goto out;
|
||||||
@@ -401,10 +401,10 @@ file_init_common(hx509_context context,
|
|||||||
|
|
||||||
if (flags & HX509_CERTS_CREATE) {
|
if (flags & HX509_CERTS_CREATE) {
|
||||||
ret = hx509_certs_init(context, "MEMORY:ks-file-create",
|
ret = hx509_certs_init(context, "MEMORY:ks-file-create",
|
||||||
0, lock, &f->certs);
|
0, lock, &ksf->certs);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
*data = f;
|
*data = ksf;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,7 +412,7 @@ file_init_common(hx509_context context,
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
for (p = f->fn; p != NULL; p = pnext) {
|
for (p = ksf->fn; p != NULL; p = pnext) {
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
pnext = strchr(p, ',');
|
pnext = strchr(p, ',');
|
||||||
@@ -461,7 +461,7 @@ file_init_common(hx509_context context,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = _hx509_collector_collect_certs(context, pem_ctx.c, &f->certs);
|
ret = _hx509_collector_collect_certs(context, pem_ctx.c, &ksf->certs);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@@ -470,17 +470,17 @@ file_init_common(hx509_context context,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; keys[i]; i++)
|
for (i = 0; keys[i]; i++)
|
||||||
_hx509_certs_keys_add(context, f->certs, keys[i]);
|
_hx509_certs_keys_add(context, ksf->certs, keys[i]);
|
||||||
_hx509_certs_keys_free(context, keys);
|
_hx509_certs_keys_free(context, keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
*data = f;
|
*data = ksf;
|
||||||
else {
|
else {
|
||||||
if (f->fn)
|
if (ksf->fn)
|
||||||
free(f->fn);
|
free(ksf->fn);
|
||||||
free(f);
|
free(ksf);
|
||||||
}
|
}
|
||||||
if (pem_ctx.c)
|
if (pem_ctx.c)
|
||||||
_hx509_collector_free(pem_ctx.c);
|
_hx509_collector_free(pem_ctx.c);
|
||||||
@@ -507,10 +507,10 @@ file_init_der(hx509_context context,
|
|||||||
static int
|
static int
|
||||||
file_free(hx509_certs certs, void *data)
|
file_free(hx509_certs certs, void *data)
|
||||||
{
|
{
|
||||||
struct ks_file *f = data;
|
struct ks_file *ksf = data;
|
||||||
hx509_certs_free(&f->certs);
|
hx509_certs_free(&ksf->certs);
|
||||||
free(f->fn);
|
free(ksf->fn);
|
||||||
free(f);
|
free(ksf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -558,20 +558,20 @@ static int
|
|||||||
file_store(hx509_context context,
|
file_store(hx509_context context,
|
||||||
hx509_certs certs, void *data, int flags, hx509_lock lock)
|
hx509_certs certs, void *data, int flags, hx509_lock lock)
|
||||||
{
|
{
|
||||||
struct ks_file *f = data;
|
struct ks_file *ksf = data;
|
||||||
struct store_ctx sc;
|
struct store_ctx sc;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
sc.f = fopen(f->fn, "w");
|
sc.f = fopen(ksf->fn, "w");
|
||||||
if (sc.f == NULL) {
|
if (sc.f == NULL) {
|
||||||
hx509_set_error_string(context, 0, ENOENT,
|
hx509_set_error_string(context, 0, ENOENT,
|
||||||
"Failed to open file %s for writing");
|
"Failed to open file %s for writing");
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
}
|
}
|
||||||
rk_cloexec_file(sc.f);
|
rk_cloexec_file(sc.f);
|
||||||
sc.format = f->format;
|
sc.format = ksf->format;
|
||||||
|
|
||||||
ret = hx509_certs_iter(context, f->certs, store_func, &sc);
|
ret = hx509_certs_iter(context, ksf->certs, store_func, &sc);
|
||||||
fclose(sc.f);
|
fclose(sc.f);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -579,24 +579,24 @@ file_store(hx509_context context,
|
|||||||
static int
|
static int
|
||||||
file_add(hx509_context context, hx509_certs certs, void *data, hx509_cert c)
|
file_add(hx509_context context, hx509_certs certs, void *data, hx509_cert c)
|
||||||
{
|
{
|
||||||
struct ks_file *f = data;
|
struct ks_file *ksf = data;
|
||||||
return hx509_certs_add(context, f->certs, c);
|
return hx509_certs_add(context, ksf->certs, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
file_iter_start(hx509_context context,
|
file_iter_start(hx509_context context,
|
||||||
hx509_certs certs, void *data, void **cursor)
|
hx509_certs certs, void *data, void **cursor)
|
||||||
{
|
{
|
||||||
struct ks_file *f = data;
|
struct ks_file *ksf = data;
|
||||||
return hx509_certs_start_seq(context, f->certs, cursor);
|
return hx509_certs_start_seq(context, ksf->certs, cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
file_iter(hx509_context context,
|
file_iter(hx509_context context,
|
||||||
hx509_certs certs, void *data, void *iter, hx509_cert *cert)
|
hx509_certs certs, void *data, void *iter, hx509_cert *cert)
|
||||||
{
|
{
|
||||||
struct ks_file *f = data;
|
struct ks_file *ksf = data;
|
||||||
return hx509_certs_next_cert(context, f->certs, iter, cert);
|
return hx509_certs_next_cert(context, ksf->certs, iter, cert);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -605,8 +605,8 @@ file_iter_end(hx509_context context,
|
|||||||
void *data,
|
void *data,
|
||||||
void *cursor)
|
void *cursor)
|
||||||
{
|
{
|
||||||
struct ks_file *f = data;
|
struct ks_file *ksf = data;
|
||||||
return hx509_certs_end_seq(context, f->certs, cursor);
|
return hx509_certs_end_seq(context, ksf->certs, cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -615,8 +615,8 @@ file_getkeys(hx509_context context,
|
|||||||
void *data,
|
void *data,
|
||||||
hx509_private_key **keys)
|
hx509_private_key **keys)
|
||||||
{
|
{
|
||||||
struct ks_file *f = data;
|
struct ks_file *ksf = data;
|
||||||
return _hx509_certs_keys_get(context, f->certs, keys);
|
return _hx509_certs_keys_get(context, ksf->certs, keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -625,8 +625,8 @@ file_addkey(hx509_context context,
|
|||||||
void *data,
|
void *data,
|
||||||
hx509_private_key key)
|
hx509_private_key key)
|
||||||
{
|
{
|
||||||
struct ks_file *f = data;
|
struct ks_file *ksf = data;
|
||||||
return _hx509_certs_keys_add(context, f->certs, key);
|
return _hx509_certs_keys_add(context, ksf->certs, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct hx509_keyset_ops keyset_file = {
|
static struct hx509_keyset_ops keyset_file = {
|
||||||
|
Reference in New Issue
Block a user