Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

prop/nf: Propagate PROP_REQ_MOVE_CHILD thru nodefilter

  • Loading branch information...
commit e394deac0385b4d17c35594b9d5cb0f097cdf031 1 parent 8b9bb17
@andoma authored
View
5 src/prop/prop_core.c
@@ -1181,7 +1181,7 @@ prop_build_notify_child2(prop_sub_t *s, prop_t *p, prop_t *extra,
/**
*
*/
-static void
+void
prop_notify_child2(prop_t *child, prop_t *parent, prop_t *sibling,
prop_event_t event, prop_sub_t *skipme, int flags)
{
@@ -1892,6 +1892,9 @@ prop_move0(prop_t *p, prop_t *before, prop_sub_t *skipme)
assert(p != before);
+ if(before && p->hp_parent != before->hp_parent)
+ return;
+
if(TAILQ_NEXT(p, hp_parent_link) != before) {
parent = p->hp_parent;
View
3  src/prop/prop_i.h
@@ -336,6 +336,9 @@ int prop_destroy0(prop_t *p);
void prop_unsubscribe0(prop_sub_t *s);
+void prop_notify_child2(prop_t *child, prop_t *parent, prop_t *sibling,
+ prop_event_t event, prop_sub_t *skipme, int flags);
+
void prop_notify_childv(prop_vec_t *childv, prop_t *parent, prop_event_t event,
prop_sub_t *skipme, prop_t *p2);
View
34 src/prop/prop_nodefilter.c
@@ -1058,10 +1058,10 @@ prop_nf_src_cb(void *opaque, prop_event_t event, ...)
prop_have_more_childs0(nf->dst);
else
nf->pending_have_more = 1;
-
break;
case PROP_WANT_MORE_CHILDS:
+ case PROP_REQ_MOVE_CHILD:
break;
default:
@@ -1093,6 +1093,30 @@ nf_translate_del_multi(prop_nf_t *nf, prop_vec_t *in)
}
+
+/**
+ *
+ */
+static void
+nf_translate_req_move_child(prop_nf_t *nf, prop_t *p, prop_t *before)
+{
+ if(nf->sortkey[0] || nf->sortkey[1] || nf->sortkey[2] || nf->sortkey[3])
+ return;
+
+ if(nf->filter != NULL)
+ return;
+
+ prop_nf_pred_t *pnp;
+ LIST_FOREACH(pnp, &nf->preds, pnp_link)
+ if(pnp->pnp_enabled)
+ return;
+
+ p = p->hp_originator;
+ before = before ? before->hp_originator : NULL;
+ prop_notify_child2(p, nf->src, before, PROP_REQ_MOVE_CHILD, nf->srcsub, 0);
+}
+
+
/**
*
*/
@@ -1100,7 +1124,7 @@ static void
prop_nf_dst_cb(void *opaque, prop_event_t event, ...)
{
prop_nf_t *nf = opaque;
-
+ prop_t *p1, *p2;
va_list ap;
va_start(ap, event);
@@ -1113,6 +1137,12 @@ prop_nf_dst_cb(void *opaque, prop_event_t event, ...)
abort();
break;
+ case PROP_REQ_MOVE_CHILD:
+ p1 = va_arg(ap, prop_t *);
+ p2 = va_arg(ap, prop_t *);
+ nf_translate_req_move_child(nf, p1, p2);
+ break;
+
case PROP_WANT_MORE_CHILDS:
if(nf->srcsub != NULL)
prop_want_more_childs0(nf->srcsub);
Please sign in to comment.
Something went wrong with that request. Please try again.