bpContext *plugin_ctx;
bDirEvent event;
Plugin *plugin;
- int i = 0;
+ int i;
bRC rc = bRC_OK;
if (!bplugin_list || !jcr || !jcr->plugin_ctx_list) {
Dmsg2(dbglvl, "dir-plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
- foreach_alist(plugin, bplugin_list) {
- plugin_ctx = &plugin_ctx_list[i++];
+ foreach_alist_index(i, plugin, bplugin_list) {
+ plugin_ctx = &plugin_ctx_list[i];
if (is_plugin_disabled(plugin_ctx)) {
continue;
}
void load_dir_plugins(const char *plugin_dir)
{
Plugin *plugin;
+ int i;
Dmsg0(dbglvl, "Load dir plugins\n");
if (!plugin_dir) {
* Verify that the plugin is acceptable, and print information
* about it.
*/
- foreach_alist(plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, bplugin_list) {
Jmsg(NULL, M_INFO, 0, _("Loaded plugin: %s\n"), plugin->file);
Dmsg1(dbglvl, "Loaded plugin: %s\n", plugin->file);
}
void new_plugins(JCR *jcr)
{
Plugin *plugin;
- int i = 0;
+ int i;
Dmsg0(dbglvl, "=== enter new_plugins ===\n");
if (!bplugin_list) {
bpContext *plugin_ctx_list = jcr->plugin_ctx_list;
Dmsg2(dbglvl, "Instantiate dir-plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
- foreach_alist(plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, bplugin_list) {
/* Start a new instance of each plugin */
bacula_ctx *b_ctx = (bacula_ctx *)malloc(sizeof(bacula_ctx));
memset(b_ctx, 0, sizeof(bacula_ctx));
b_ctx->jcr = jcr;
plugin_ctx_list[i].bContext = (void *)b_ctx;
plugin_ctx_list[i].pContext = NULL;
- if (dirplug_func(plugin)->newPlugin(&plugin_ctx_list[i++]) != bRC_OK) {
+ if (dirplug_func(plugin)->newPlugin(&plugin_ctx_list[i]) != bRC_OK) {
b_ctx->disabled = true;
}
}
void free_plugins(JCR *jcr)
{
Plugin *plugin;
- int i = 0;
+ int i;
if (!bplugin_list || !jcr->plugin_ctx_list) {
return;
bpContext *plugin_ctx_list = (bpContext *)jcr->plugin_ctx_list;
Dmsg2(dbglvl, "Free instance dir-plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
- foreach_alist(plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, bplugin_list) {
/* Free the plugin instance */
dirplug_func(plugin)->freePlugin(&plugin_ctx_list[i]);
- free(plugin_ctx_list[i++].bContext); /* free Bacula private context */
+ free(plugin_ctx_list[i].bContext); /* free Bacula private context */
}
free(plugin_ctx_list);
jcr->plugin_ctx_list = NULL;