static ssize_t my_plugin_bwrite(BFILE *bfd, void *buf, size_t count);
static boffset_t my_plugin_blseek(BFILE *bfd, boffset_t offset, int whence);
+#define for_this_plug(plugin, str, len) (((len) == (plugin)->len) && strncmp((plugin)->file, str, len) == 0)
/* Bacula info */
static bInfo binfo = {
/* Pass event to every plugin (except if name is set) */
foreach_alist(plugin, plugin_list) {
- if (name && strncmp(plugin->file, name, len) != 0) {
+ if (name && !for_this_plug(plugin, name, len)) {
i++;
continue;
}
/* Get the first part of the the plugin command
* systemstate:/@SYSTEMSTATE/
* => ret = 11
- * => can use strncmp(plugin_name, cmd, ret);
+ * => can use for_this_plug(plug, cmd, ret);
*
* The plugin command can contain only the plugin name
* Plugin = alldrives
/* Note, we stop the loop on the first plugin that matches the name */
foreach_alist(plugin, plugin_list) {
Dmsg4(0, "plugin=%s plen=%d cmd=%s len=%d\n", plugin->file, plugin->len, cmd, len);
- if ((plugin->len != len) || (strncmp(plugin->file, cmd, len) != 0)) {
+ if (!for_this_plug(plugin, cmd, len)) {
i++;
continue;
}
foreach_alist(plugin, plugin_list) {
bEvent event;
Dmsg3(dbglvl, "plugin=%s cmd=%s len=%d\n", plugin->file, cmd, len);
- if ((plugin->len != len) || (strncmp(plugin->file, cmd, len) != 0)) {
+ if (!for_this_plug(plugin, cmd, len)) {
i++;
continue;
}