From 886a40d75ebeed8581d9337c7a5089cd41875a82 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Fri, 7 Jun 2013 19:19:22 +0200 Subject: [PATCH] plugin-feature: Added helper function to extend arrays of plugin features --- src/libstrongswan/plugins/plugin_feature.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/libstrongswan/plugins/plugin_feature.h b/src/libstrongswan/plugins/plugin_feature.h index 00deb38b0..ea23f766c 100644 --- a/src/libstrongswan/plugins/plugin_feature.h +++ b/src/libstrongswan/plugins/plugin_feature.h @@ -329,6 +329,27 @@ struct plugin_feature_t { */ extern enum_name_t *plugin_feature_names; +/** + * Add a set of plugin features to the given array, which must have enough space + * to store the added features. + * + * @param features the array of plugin features to extend + * @param to_add the features to add + * @param count number of features to add + * @param pos current position in the features array, gets advanced + */ +static inline void plugin_features_add(plugin_feature_t *features, + plugin_feature_t *to_add, + int count, int *pos) +{ + int i; + + for (i = 0; i < count; i++) + { + features[(*pos)++] = to_add[i]; + } +} + /** * Calculates a hash value for the given feature. *