From: Tobias Brunner Date: Fri, 7 Jun 2013 17:19:22 +0000 (+0200) Subject: plugin-feature: Added helper function to extend arrays of plugin features X-Git-Tag: 5.1.0dr1~128^2~22 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=886a40d75ebeed8581d9337c7a5089cd41875a82;p=thirdparty%2Fstrongswan.git plugin-feature: Added helper function to extend arrays of plugin features --- diff --git a/src/libstrongswan/plugins/plugin_feature.h b/src/libstrongswan/plugins/plugin_feature.h index 00deb38b0d..ea23f766ca 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. *