diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-08-24 10:46:10 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-09-04 13:09:13 +0200 |
commit | f7abe0ecd4973dfe36944b916c5b9cf8ec199b8a (patch) | |
tree | 99ca676afbfcf2da0182b3bf99811d000cb69c58 /crypto | |
parent | 788b305c91398f18e5952667b929d7f45e2c211c (diff) |
qapi: Change data type of the FOO_lookup generated for enum FOO
Currently, a FOO_lookup is an array of strings terminated by a NULL
sentinel.
A future patch will generate enums with "holes". NULL-termination
will cease to work then.
To prepare for that, store the length in the FOO_lookup by wrapping it
in a struct and adding a member for the length.
The sentinel will be dropped next.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170822132255.23945-13-marcandre.lureau@redhat.com>
[Basically redone]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503564371-26090-16-git-send-email-armbru@redhat.com>
[Rebased]
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/block-luks.c | 8 | ||||
-rw-r--r-- | crypto/secret.c | 2 | ||||
-rw-r--r-- | crypto/tlscreds.c | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/crypto/block-luks.c b/crypto/block-luks.c index 4e828951d4..36bc856084 100644 --- a/crypto/block-luks.c +++ b/crypto/block-luks.c @@ -264,7 +264,7 @@ qcrypto_block_luks_cipher_alg_lookup(QCryptoCipherAlgorithm alg, /* XXX replace with qapi_enum_parse() in future, when we can * make that function emit a more friendly error message */ static int qcrypto_block_luks_name_lookup(const char *name, - const char *const *map, + const QEnumLookup *map, const char *type, Error **errp) { @@ -279,19 +279,19 @@ static int qcrypto_block_luks_name_lookup(const char *name, #define qcrypto_block_luks_cipher_mode_lookup(name, errp) \ qcrypto_block_luks_name_lookup(name, \ - QCryptoCipherMode_lookup, \ + &QCryptoCipherMode_lookup, \ "Cipher mode", \ errp) #define qcrypto_block_luks_hash_name_lookup(name, errp) \ qcrypto_block_luks_name_lookup(name, \ - QCryptoHashAlgorithm_lookup, \ + &QCryptoHashAlgorithm_lookup, \ "Hash algorithm", \ errp) #define qcrypto_block_luks_ivgen_name_lookup(name, errp) \ qcrypto_block_luks_name_lookup(name, \ - QCryptoIVGenAlgorithm_lookup, \ + &QCryptoIVGenAlgorithm_lookup, \ "IV generator", \ errp) diff --git a/crypto/secret.c b/crypto/secret.c index 285ab7a63c..388abd7df5 100644 --- a/crypto/secret.c +++ b/crypto/secret.c @@ -378,7 +378,7 @@ qcrypto_secret_class_init(ObjectClass *oc, void *data) NULL); object_class_property_add_enum(oc, "format", "QCryptoSecretFormat", - QCryptoSecretFormat_lookup, + &QCryptoSecretFormat_lookup, qcrypto_secret_prop_get_format, qcrypto_secret_prop_set_format, NULL); diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c index a8965531b6..3cd41035bb 100644 --- a/crypto/tlscreds.c +++ b/crypto/tlscreds.c @@ -233,7 +233,7 @@ qcrypto_tls_creds_class_init(ObjectClass *oc, void *data) NULL); object_class_property_add_enum(oc, "endpoint", "QCryptoTLSCredsEndpoint", - QCryptoTLSCredsEndpoint_lookup, + &QCryptoTLSCredsEndpoint_lookup, qcrypto_tls_creds_prop_get_endpoint, qcrypto_tls_creds_prop_set_endpoint, NULL); |