summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@thewalter.net>2013-07-17 12:55:57 +0200
committerStef Walter <stef@thewalter.net>2013-07-18 13:04:37 +0200
commite403f7b33ac35e961c72ed1b6335bbe3084e4642 (patch)
treebb9e89ab69bae17d3ab28c3a61729ad65435407c
parent52a84b84a924a9f1cd8090b0a47b9f7d00ca69f3 (diff)
Declare static variables const where it makes sense
https://bugzilla.redhat.com/show_bug.cgi?id=985337
-rw-r--r--common/path.c8
-rw-r--r--p11-kit/conf.c4
-rw-r--r--p11-kit/uri.c4
-rw-r--r--trust/builder.c38
-rw-r--r--trust/extract-info.c2
-rw-r--r--trust/extract-openssl.c2
-rw-r--r--trust/module.c4
7 files changed, 31 insertions, 31 deletions
diff --git a/common/path.c b/common/path.c
index a22c2a6..2f976a8 100644
--- a/common/path.c
+++ b/common/path.c
@@ -62,9 +62,9 @@ char *
p11_path_base (const char *path)
{
#ifdef OS_WIN32
- static const char *delims = "/\\";
+ const char *delims = "/\\";
#else
- static const char *delims = "/";
+ const char *delims = "/";
#endif
const char *end;
@@ -191,9 +191,9 @@ p11_path_build (const char *path,
...)
{
#ifdef OS_WIN32
- static const char delim = '\\';
+ const char delim = '\\';
#else
- static const char delim = '/';
+ const char delim = '/';
#endif
const char *first = path;
char *built;
diff --git a/p11-kit/conf.c b/p11-kit/conf.c
index d29d9ec..83ee7ca 100644
--- a/p11-kit/conf.c
+++ b/p11-kit/conf.c
@@ -288,8 +288,8 @@ static char *
calc_name_from_filename (const char *fname)
{
/* We eventually want to settle on .module */
- static const char *suffix = ".module";
- static size_t suffix_len = 7;
+ static const char const *suffix = ".module";
+ static const size_t suffix_len = 7;
const char *c = fname;
size_t fname_len;
size_t name_len;
diff --git a/p11-kit/uri.c b/p11-kit/uri.c
index df069f4..a60974c 100644
--- a/p11-kit/uri.c
+++ b/p11-kit/uri.c
@@ -415,14 +415,14 @@ p11_kit_uri_clear_attribute (P11KitUri *uri, CK_ATTRIBUTE_TYPE attr_type)
CK_ATTRIBUTE_PTR
p11_kit_uri_get_attributes (P11KitUri *uri, CK_ULONG_PTR n_attrs)
{
- static CK_ATTRIBUTE empty = { CKA_INVALID, NULL, 0UL };
+ static const CK_ATTRIBUTE terminator = { CKA_INVALID, NULL, 0UL };
return_val_if_fail (uri != NULL, NULL);
if (!uri->attrs) {
if (n_attrs)
*n_attrs = 0;
- return &empty;
+ return (CK_ATTRIBUTE_PTR)&terminator;
}
if (n_attrs)
diff --git a/trust/builder.c b/trust/builder.c
index fdaae34..038fc88 100644
--- a/trust/builder.c
+++ b/trust/builder.c
@@ -822,9 +822,9 @@ data_populate (p11_builder *builder,
p11_index *index,
CK_ATTRIBUTE *data)
{
- static CK_ATTRIBUTE value = { CKA_VALUE, "", 0 };
- static CK_ATTRIBUTE application = { CKA_APPLICATION, "", 0 };
- static CK_ATTRIBUTE object_id = { CKA_OBJECT_ID, "", 0 };
+ static const CK_ATTRIBUTE value = { CKA_VALUE, "", 0 };
+ static const CK_ATTRIBUTE application = { CKA_APPLICATION, "", 0 };
+ static const CK_ATTRIBUTE object_id = { CKA_OBJECT_ID, "", 0 };
CK_ATTRIBUTE *attrs;
attrs = common_populate (builder, index, data);
@@ -1661,14 +1661,14 @@ replace_compat_for_cert (p11_builder *builder,
CK_OBJECT_HANDLE handle,
CK_ATTRIBUTE *attrs)
{
- static CK_OBJECT_CLASS certificate = CKO_CERTIFICATE;
- static CK_CERTIFICATE_TYPE x509 = CKC_X_509;
+ static const CK_OBJECT_CLASS certificate = CKO_CERTIFICATE;
+ static const CK_CERTIFICATE_TYPE x509 = CKC_X_509;
CK_ATTRIBUTE *value;
CK_ATTRIBUTE match[] = {
{ CKA_VALUE, },
- { CKA_CLASS, &certificate, sizeof (certificate) },
- { CKA_CERTIFICATE_TYPE, &x509, sizeof (x509) },
+ { CKA_CLASS, (void *)&certificate, sizeof (certificate) },
+ { CKA_CERTIFICATE_TYPE, (void *)&x509, sizeof (x509) },
{ CKA_INVALID }
};
@@ -1762,32 +1762,32 @@ p11_builder_changed (void *bilder,
CK_OBJECT_HANDLE handle,
CK_ATTRIBUTE *attrs)
{
- static CK_OBJECT_CLASS certificate = CKO_CERTIFICATE;
- static CK_OBJECT_CLASS extension = CKO_X_CERTIFICATE_EXTENSION;
- static CK_CERTIFICATE_TYPE x509 = CKC_X_509;
+ static const CK_OBJECT_CLASS certificate = CKO_CERTIFICATE;
+ static const CK_OBJECT_CLASS extension = CKO_X_CERTIFICATE_EXTENSION;
+ static const CK_CERTIFICATE_TYPE x509 = CKC_X_509;
- static CK_ATTRIBUTE match_cert[] = {
- { CKA_CLASS, &certificate, sizeof (certificate) },
- { CKA_CERTIFICATE_TYPE, &x509, sizeof (x509) },
+ static const CK_ATTRIBUTE match_cert[] = {
+ { CKA_CLASS, (void *)&certificate, sizeof (certificate) },
+ { CKA_CERTIFICATE_TYPE, (void *)&x509, sizeof (x509) },
{ CKA_INVALID }
};
- static CK_ATTRIBUTE match_eku[] = {
- { CKA_CLASS, &extension, sizeof (extension) },
+ static const CK_ATTRIBUTE match_eku[] = {
+ { CKA_CLASS, (void *)&extension, sizeof (extension) },
{ CKA_OBJECT_ID, (void *)P11_OID_EXTENDED_KEY_USAGE,
sizeof (P11_OID_EXTENDED_KEY_USAGE) },
{ CKA_INVALID }
};
- static CK_ATTRIBUTE match_ku[] = {
- { CKA_CLASS, &extension, sizeof (extension) },
+ static const CK_ATTRIBUTE match_ku[] = {
+ { CKA_CLASS, (void *)&extension, sizeof (extension) },
{ CKA_OBJECT_ID, (void *)P11_OID_KEY_USAGE,
sizeof (P11_OID_KEY_USAGE) },
{ CKA_INVALID }
};
- static CK_ATTRIBUTE match_bc[] = {
- { CKA_CLASS, &extension, sizeof (extension) },
+ static const CK_ATTRIBUTE match_bc[] = {
+ { CKA_CLASS, (void *)&extension, sizeof (extension) },
{ CKA_OBJECT_ID, (void *)P11_OID_BASIC_CONSTRAINTS,
sizeof (P11_OID_BASIC_CONSTRAINTS) },
{ CKA_INVALID }
diff --git a/trust/extract-info.c b/trust/extract-info.c
index 63fd03e..8468abb 100644
--- a/trust/extract-info.c
+++ b/trust/extract-info.c
@@ -315,7 +315,7 @@ extract_info (P11KitIter *iter,
CK_ATTRIBUTE *attr;
CK_RV rv;
- static CK_ATTRIBUTE attr_types[] = {
+ static const CK_ATTRIBUTE attr_types[] = {
{ CKA_ID, },
{ CKA_CLASS, },
{ CKA_CERTIFICATE_TYPE, },
diff --git a/trust/extract-openssl.c b/trust/extract-openssl.c
index b503b67..c2d37f3 100644
--- a/trust/extract-openssl.c
+++ b/trust/extract-openssl.c
@@ -79,7 +79,7 @@ known_usages (p11_array *oids)
char *string;
int i;
- const char *strings[] = {
+ static const char *strings[] = {
P11_OID_SERVER_AUTH_STR,
P11_OID_CLIENT_AUTH_STR,
P11_OID_CODE_SIGNING_STR,
diff --git a/trust/module.c b/trust/module.c
index 25a72b7..5ebe1ff 100644
--- a/trust/module.c
+++ b/trust/module.c
@@ -333,9 +333,9 @@ sys_C_Finalize (CK_VOID_PTR reserved)
static CK_RV
sys_C_Initialize (CK_VOID_PTR init_args)
{
- static CK_C_INITIALIZE_ARGS def_args =
+ static const CK_C_INITIALIZE_ARGS def_args =
{ NULL, NULL, NULL, NULL, CKF_OS_LOCKING_OK, NULL, };
- CK_C_INITIALIZE_ARGS *args = NULL;
+ const CK_C_INITIALIZE_ARGS *args = NULL;
int supplied_ok;
CK_RV rv;