diff options
author | Volker Lendecke <vl@samba.org> | 2012-03-15 12:22:50 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2012-03-16 11:20:11 +0100 |
commit | 640a7d0db71e038223a2f5afed70c5df5db509ac (patch) | |
tree | f0a2a925668a1adae21113352290c67ca977e0ad /source3 | |
parent | 1909af434eef5473c236aa46e531818e392b80b3 (diff) | |
download | samba-640a7d0db71e038223a2f5afed70c5df5db509ac.tar.gz samba-640a7d0db71e038223a2f5afed70c5df5db509ac.tar.bz2 samba-640a7d0db71e038223a2f5afed70c5df5db509ac.zip |
s3-notify: Simplify if-expressions
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/notify_internal.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c index d442367b2b..599c994169 100644 --- a/source3/smbd/notify_internal.c +++ b/source3/smbd/notify_internal.c @@ -958,6 +958,7 @@ void notify_trigger(struct notify_context *notify, int p_len = p - path; int min_i, max_i, i; struct notify_depth *d = ¬ify->array->depth[depth]; + uint32_t d_max_mask; next_p = strchr(p+1, '/'); /* see if there are any entries at this depth */ @@ -966,14 +967,11 @@ void notify_trigger(struct notify_context *notify, /* try to skip based on the maximum mask. If next_p is NULL then we know it will be a 'this directory' match, otherwise it must be a subdir match */ - if (next_p != NULL) { - if (0 == (filter & d->max_mask_subdir)) { - continue; - } - } else { - if (0 == (filter & d->max_mask)) { - continue; - } + + d_max_mask = next_p ? d->max_mask_subdir : d->max_mask; + + if ((filter & d_max_mask) == 0) { + continue; } /* we know there is an entry here worth looking @@ -1009,17 +1007,16 @@ void notify_trigger(struct notify_context *notify, /* we now know that the entries start at min_i */ for (i=min_i;i<d->num_entries;i++) { struct notify_entry *e = &d->entries[i]; + uint32_t e_filter; if (p_len != e->path_len || strncmp(path, e->path, p_len) != 0) break; - if (next_p != NULL) { - if (0 == (filter & e->subdir_filter)) { - continue; - } - } else { - if (0 == (filter & e->filter)) { - continue; - } + + e_filter = next_p ? e->subdir_filter : e->filter; + + if ((filter & e_filter) == 0) { + continue; } + status = notify_send(notify, e, path + e->path_len + 1, action); |