[gcr/wip/nielsdg/g-param-static-strings: 7/9] gck: Use G_PARAM_STATIC_STRINGS
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcr/wip/nielsdg/g-param-static-strings: 7/9] gck: Use G_PARAM_STATIC_STRINGS
- Date: Sat, 4 Jan 2020 01:18:29 +0000 (UTC)
commit 61e5318d8610e67d42fab83764316fefc09705e5
Author: Niels De Graef <nielsdegraef gmail com>
Date: Fri May 24 22:15:39 2019 +0200
gck: Use G_PARAM_STATIC_STRINGS
This prevents some unnecessary string copies, resulting in less memory
used and some unnecessary performance overhead being removed. Well, a
little bit at least.
gck/gck-enumerator.c | 11 +++++++----
gck/gck-interaction.c | 2 +-
gck/gck-module.c | 5 +++--
gck/gck-object.c | 9 ++++++---
gck/gck-password.c | 6 +++---
gck/gck-session.c | 25 +++++++++++++++----------
gck/gck-slot.c | 6 ++++--
7 files changed, 39 insertions(+), 25 deletions(-)
---
diff --git a/gck/gck-enumerator.c b/gck/gck-enumerator.c
index f35a191..20ef4d9 100644
--- a/gck/gck-enumerator.c
+++ b/gck/gck-enumerator.c
@@ -666,7 +666,8 @@ gck_enumerator_class_init (GckEnumeratorClass *klass)
*/
g_object_class_install_property (gobject_class, PROP_INTERACTION,
g_param_spec_object ("interaction", "Interaction", "Interaction asking for pins",
- G_TYPE_TLS_INTERACTION, G_PARAM_READWRITE));
+ G_TYPE_TLS_INTERACTION,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GckEnumerator:object-type: (skip)
@@ -676,7 +677,8 @@ gck_enumerator_class_init (GckEnumeratorClass *klass)
*/
g_object_class_install_property (gobject_class, PROP_OBJECT_TYPE,
g_param_spec_gtype ("object-type", "Object Type", "Type of objects created",
- GCK_TYPE_OBJECT, G_PARAM_READWRITE));
+ GCK_TYPE_OBJECT,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GckEnumerator:chained:
@@ -685,8 +687,9 @@ gck_enumerator_class_init (GckEnumeratorClass *klass)
* has enumerated all its objects.
*/
g_object_class_install_property (gobject_class, PROP_CHAINED,
- g_param_spec_object ("chained", "Chained", "Chained enumerator",
- GCK_TYPE_ENUMERATOR, G_PARAM_READWRITE));
+ g_param_spec_object ("chained", "Chained", "Chained enumerator",
+ GCK_TYPE_ENUMERATOR,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
static void
diff --git a/gck/gck-interaction.c b/gck/gck-interaction.c
index ebbdc77..3567a52 100644
--- a/gck/gck-interaction.c
+++ b/gck/gck-interaction.c
@@ -156,7 +156,7 @@ _gck_interaction_class_init (GckInteractionClass *klass)
g_object_class_install_property (object_class, PROP_MODULE,
g_param_spec_object ("module", "Module", "PKCS11 Module",
- GCK_TYPE_MODULE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ GCK_TYPE_MODULE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
}
GTlsInteraction *
diff --git a/gck/gck-module.c b/gck/gck-module.c
index b8b1aa0..8ac8815 100644
--- a/gck/gck-module.c
+++ b/gck/gck-module.c
@@ -225,7 +225,8 @@ gck_module_class_init (GckModuleClass *klass)
*/
g_object_class_install_property (gobject_class, PROP_PATH,
g_param_spec_string ("path", "Module Path", "Path to the PKCS11 Module",
- NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* GckModule:functions:
@@ -236,7 +237,7 @@ gck_module_class_init (GckModuleClass *klass)
*/
g_object_class_install_property (gobject_class, PROP_FUNCTIONS,
g_param_spec_pointer ("functions", "Function List", "PKCS11 Function List",
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* GckModule::authenticate-slot:
diff --git a/gck/gck-object.c b/gck/gck-object.c
index 07f26c9..2ce73d4 100644
--- a/gck/gck-object.c
+++ b/gck/gck-object.c
@@ -169,7 +169,8 @@ gck_object_class_init (GckObjectClass *klass)
*/
g_object_class_install_property (gobject_class, PROP_MODULE,
g_param_spec_object ("module", "Module", "PKCS11 Module",
- GCK_TYPE_MODULE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ GCK_TYPE_MODULE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* GckObject:handle:
@@ -178,7 +179,8 @@ gck_object_class_init (GckObjectClass *klass)
*/
g_object_class_install_property (gobject_class, PROP_HANDLE,
g_param_spec_ulong ("handle", "Object Handle", "PKCS11 Object Handle",
- 0, G_MAXULONG, 0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ 0, G_MAXULONG, 0,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* GckObject:session:
@@ -191,7 +193,8 @@ gck_object_class_init (GckObjectClass *klass)
*/
g_object_class_install_property (gobject_class, PROP_SESSION,
g_param_spec_object ("session", "session", "PKCS11 Session to make calls on",
- GCK_TYPE_SESSION, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ GCK_TYPE_SESSION,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
}
/* ----------------------------------------------------------------------------
diff --git a/gck/gck-password.c b/gck/gck-password.c
index d97376f..717c5ca 100644
--- a/gck/gck-password.c
+++ b/gck/gck-password.c
@@ -168,7 +168,7 @@ gck_password_class_init (GckPasswordClass *klass)
*/
g_object_class_install_property (gobject_class, PROP_MODULE,
g_param_spec_object ("module", "Module", "PKCS11 Module",
- GCK_TYPE_MODULE, G_PARAM_READABLE));
+ GCK_TYPE_MODULE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
/**
* GckPassword:token:
@@ -178,7 +178,7 @@ gck_password_class_init (GckPasswordClass *klass)
*/
g_object_class_install_property (gobject_class, PROP_TOKEN,
g_param_spec_object ("token", "Token", "PKCS11 Token",
- GCK_TYPE_SLOT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ GCK_TYPE_SLOT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
/**
* GckPassword:key:
@@ -188,7 +188,7 @@ gck_password_class_init (GckPasswordClass *klass)
*/
g_object_class_install_property (gobject_class, PROP_KEY,
g_param_spec_object ("key", "Object", "PKCS11 Key Object",
- GCK_TYPE_OBJECT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ GCK_TYPE_OBJECT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
}
/**
diff --git a/gck/gck-session.c b/gck/gck-session.c
index 8641166..38df51a 100644
--- a/gck/gck-session.c
+++ b/gck/gck-session.c
@@ -286,8 +286,9 @@ gck_session_class_init (GckSessionClass *klass)
* The GckModule that this session is opened on.
*/
g_object_class_install_property (gobject_class, PROP_MODULE,
- g_param_spec_object ("module", "Module", "PKCS11 Module",
- GCK_TYPE_MODULE, G_PARAM_READABLE));
+ g_param_spec_object ("module", "Module", "PKCS11 Module",
+ GCK_TYPE_MODULE,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
/**
* GckSession:handle:
@@ -296,7 +297,8 @@ gck_session_class_init (GckSessionClass *klass)
*/
g_object_class_install_property (gobject_class, PROP_HANDLE,
g_param_spec_ulong ("handle", "Session Handle", "PKCS11 Session Handle",
- 0, G_MAXULONG, 0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ 0, G_MAXULONG, 0,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* GckSession:slot:
@@ -305,7 +307,8 @@ gck_session_class_init (GckSessionClass *klass)
*/
g_object_class_install_property (gobject_class, PROP_SLOT,
g_param_spec_object ("slot", "Slot that this session uses", "PKCS11 Slot",
- GCK_TYPE_SLOT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ GCK_TYPE_SLOT,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* GckSession:options:
@@ -315,7 +318,7 @@ gck_session_class_init (GckSessionClass *klass)
g_object_class_install_property (gobject_class, PROP_OPTIONS,
g_param_spec_flags ("options", "Session Options", "Session Options",
GCK_TYPE_SESSION_OPTIONS, GCK_SESSION_READ_ONLY,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* GckSession:interaction:
@@ -326,7 +329,8 @@ gck_session_class_init (GckSessionClass *klass)
*/
g_object_class_install_property (gobject_class, PROP_INTERACTION,
g_param_spec_object ("interaction", "Interaction", "Interaction asking for pins",
- G_TYPE_TLS_INTERACTION, G_PARAM_READWRITE));
+ G_TYPE_TLS_INTERACTION,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GckSession:opening-flags:
@@ -334,8 +338,9 @@ gck_session_class_init (GckSessionClass *klass)
* Raw PKCS\#11 flags used to open the PKCS\#11 session.
*/
g_object_class_install_property (gobject_class, PROP_OPENING_FLAGS,
- g_param_spec_ulong ("opening-flags", "Opening flags", "PKCS#11 open session flags",
- 0, G_MAXULONG, 0, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+ g_param_spec_ulong ("opening-flags", "Opening flags", "PKCS#11 open session flags",
+ 0, G_MAXULONG, 0,
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* GckSession:app-data:
@@ -343,8 +348,8 @@ gck_session_class_init (GckSessionClass *klass)
* Raw PKCS\#11 application data used to open the PKCS\#11 session.
*/
g_object_class_install_property (gobject_class, PROP_APP_DATA,
- g_param_spec_pointer ("app-data", "App data", "PKCS#11 application data",
- G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+ g_param_spec_pointer ("app-data", "App data", "PKCS#11 application data",
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* GckSession::discard-handle:
diff --git a/gck/gck-slot.c b/gck/gck-slot.c
index cb80f79..21f9f9b 100644
--- a/gck/gck-slot.c
+++ b/gck/gck-slot.c
@@ -138,7 +138,8 @@ gck_slot_class_init (GckSlotClass *klass)
*/
g_object_class_install_property (gobject_class, PROP_MODULE,
g_param_spec_object ("module", "Module", "PKCS11 Module",
- GCK_TYPE_MODULE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ GCK_TYPE_MODULE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* GckSlot:handle:
@@ -147,7 +148,8 @@ gck_slot_class_init (GckSlotClass *klass)
*/
g_object_class_install_property (gobject_class, PROP_HANDLE,
g_param_spec_ulong ("handle", "Handle", "PKCS11 Slot ID",
- 0, G_MAXULONG, 0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ 0, G_MAXULONG, 0,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
}
/* ----------------------------------------------------------------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]