From 7e7fe7c37fb32c729238a61b177efcc9b3c69620 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Wed, 1 Feb 2023 16:32:44 +0100 Subject: [PATCH] Follow-up to 299b01d813352fdcb8e54d1618c2c919e8180f99 Refactor of config enums. Fixing Perl bindings. --- xs/xsp/Config.xsp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xs/xsp/Config.xsp b/xs/xsp/Config.xsp index ac964645d..3c3ed5bb4 100644 --- a/xs/xsp/Config.xsp +++ b/xs/xsp/Config.xsp @@ -190,20 +190,20 @@ print_config_def() } // enum_values - if (!optdef->enum_values.empty()) { + if (optdef->enum_def && !optdef->enum_def->values().empty()) { AV* av = newAV(); - av_fill(av, optdef->enum_values.size()-1); - for (std::vector::iterator it = optdef->enum_values.begin(); it != optdef->enum_values.end(); ++it) - av_store(av, it - optdef->enum_values.begin(), newSVpvn(it->c_str(), it->length())); + av_fill(av, optdef->enum_def->values().size()-1); + for (std::vector::const_iterator it = optdef->enum_def->values().begin(); it != optdef->enum_def->values().end(); ++it) + av_store(av, it - optdef->enum_def->values().begin(), newSVpvn(it->c_str(), it->length())); (void)hv_stores( hv, "values", newRV_noinc((SV*)av) ); } // enum_labels - if (!optdef->enum_labels.empty()) { + if (optdef->enum_def && !optdef->enum_def->labels().empty()) { AV* av = newAV(); - av_fill(av, optdef->enum_labels.size()-1); - for (std::vector::iterator it = optdef->enum_labels.begin(); it != optdef->enum_labels.end(); ++it) - av_store(av, it - optdef->enum_labels.begin(), newSVpvn_utf8(it->c_str(), it->length(), true)); + av_fill(av, optdef->enum_def->labels().size()-1); + for (std::vector::const_iterator it = optdef->enum_def->labels().begin(); it != optdef->enum_def->labels().end(); ++it) + av_store(av, it - optdef->enum_def->labels().begin(), newSVpvn_utf8(it->c_str(), it->length(), true)); (void)hv_stores( hv, "labels", newRV_noinc((SV*)av) ); }