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/block-luks.c | |
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/block-luks.c')
-rw-r--r-- | crypto/block-luks.c | 8 |
1 files changed, 4 insertions, 4 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) |