]> git.neil.brown.name Git - edlib.git/commitdiff
Remove ->owner field from point.
authorNeilBrown <neil@brown.name>
Thu, 26 Nov 2015 22:18:49 +0000 (09:18 +1100)
committerNeilBrown <neil@brown.name>
Thu, 26 Nov 2015 22:18:49 +0000 (09:18 +1100)
No longer needed.

Signed-off-by: NeilBrown <neil@brown.name>
core-doc.c
core-mark.c
core-pane.c
core.h
emacs-search.c

index 41a7bff256ac64625dea094111e5b743198eb1ea..5ca50f85f43efa37b6c9db12fee9b678f42726e1 100644 (file)
@@ -361,7 +361,7 @@ DEF_CMD(doc_handle)
                struct pane *p = doc_attach(ci->focus, d);
                struct pane *c = pane_child(ci->home);
 
-               point_dup(ci->home->point, &p->point);
+               p->point = point_dup(ci->home->point);
                if (c)
                        pane_clone(c, p);
                return 1;
@@ -370,6 +370,7 @@ DEF_CMD(doc_handle)
        if (strcmp(ci->key, "Close") == 0) {
                if (ci->home->point)
                        point_free(ci->home->point);
+               ci->home->point = NULL;
                return 1;
        }
 
@@ -378,7 +379,7 @@ DEF_CMD(doc_handle)
                ci->mark = NULL;
                if (ci->home->point) {
                        if (ci->extra == MARK_POINT) {
-                               point_dup(ci->home->point, &pt);
+                               pt = point_dup(ci->home->point);
                                ci->mark = &pt->m;
                        }
                        if (ci->extra == MARK_UNGROUPED)
@@ -497,7 +498,7 @@ struct pane *doc_attach_view(struct pane *parent, struct pane *doc, char *render
        struct pane *p;
        p = doc_attach(parent, doc->data);
        if (p) {
-               point_new(doc->data, &p->point);
+               p->point = point_new(doc->data);
                p = pane_attach(p, "view", doc, NULL);
        }
        if (p)
index aa3e676cbd250791a737c357c29aed8665c412d7..e10db2241e68a307b8a97789800724eb3a8ca442 100644 (file)
@@ -116,7 +116,6 @@ void mark_free(struct mark *m)
 void point_free(struct point *p)
 {
        int i;
-       *p->owner = NULL;
        for (i = 0; i < p->size; i++)
                tlist_del_init(&p->links->lists[i]);
        mark_delete(&p->m);
@@ -152,7 +151,7 @@ struct mark *mark_at_point(struct point *p, int view)
        return ret;
 }
 
-struct point *point_dup(struct point *p, struct point **owner)
+struct point *point_dup(struct point *p)
 {
        int i;
        struct point *ret = malloc(sizeof(*ret));
@@ -170,8 +169,6 @@ struct point *point_dup(struct point *p, struct point **owner)
                        INIT_TLIST_HEAD(&lnk->lists[i], GRP_LIST);
                else
                        tlist_add(&lnk->lists[i], GRP_LIST, &p->links->lists[i]);
-       *owner = ret;
-       ret->owner = owner;
        ret->doc = p->doc;
        return ret;
 }
@@ -302,7 +299,7 @@ void __mark_reset(struct doc *d, struct mark *m, int new, int end)
                        INIT_TLIST_HEAD(&lnk->lists[i], GRP_LIST);
 }
 
-struct point *point_new(struct doc *d, struct point **owner)
+struct point *point_new(struct doc *d)
 {
        struct point *ret = malloc(sizeof(*ret));
        struct point_links *lnk = malloc(sizeof(*lnk) +
@@ -311,13 +308,10 @@ struct point *point_new(struct doc *d, struct point **owner)
        ret->m.attrs = NULL;
        ret->m.viewnum = MARK_POINT;
        ret->size = d->nviews;
-       ret->owner = owner;
        ret->doc = d;
        ret->links = lnk;
        lnk->pt = ret;
        __mark_reset(d, &ret->m, 1, 0);
-       if (owner)
-               *owner = ret;
        return ret;
 }
 
index 0664292d7aef8b6ce31410a3bc9107764ffc314e..4ec81d35a6fda1d1848d5b4ea1fe9b541c406b44 100644 (file)
@@ -267,10 +267,6 @@ void pane_subsume(struct pane *p, struct pane *parent)
        point = parent->point;
        parent->point = p->point;
        p->point = point;
-       if (parent->point)
-               parent->point->owner = &parent->point;
-       if (p->point)
-               p->point->owner = &p->point;
 }
 
 int pane_masked(struct pane *p, int x, int y, int z, int *w, int *h)
diff --git a/core.h b/core.h
index 4b1b5125cbccfe625007872d4dbb7b983e12dcfd..2027187f2430004b2cbc159820e88b8f7fb525c9 100644 (file)
--- a/core.h
+++ b/core.h
@@ -137,7 +137,6 @@ struct mark {
 struct point {
        struct mark             m;
        struct doc              *doc;
-       struct point            **owner;
        int                     size;
        struct point_links {
                struct point            *pt;
@@ -169,8 +168,8 @@ int mark_same(struct doc *d, struct mark *m1, struct mark *m2);
 int mark_same2(struct doc *d, struct mark *m1, struct mark *m2, struct cmd_info *ci);
 int mark_same_pane(struct pane *p, struct mark *m1, struct mark *m2,
                   struct cmd_info *ci);
-struct point *point_new(struct doc *d, struct point **owner);
-struct point *point_dup(struct point *p, struct point **owner);
+struct point *point_new(struct doc *d);
+struct point *point_dup(struct point *p);
 wint_t mark_step(struct doc *d, struct mark *m, int forward, int move, struct cmd_info *ci);
 wint_t mark_step2(struct doc *d, struct mark *m, int forward, int move);
 wint_t mark_next(struct doc *d, struct mark *m);
index a61f64cb12e0bd2c64d903babd9fd4cb5dbc5e9f..d38530b85a85ca8aff65fd81f40c6ec73e79deec 100644 (file)
@@ -141,6 +141,7 @@ DEF_CMD(search_close)
        /* TEMP HACK - please fix */
        doc_set_attr(esi->end, "highlight", NULL);
        point_free(esi->end);
+       esi->end = NULL;
        mark_free(esi->start);
        while (esi->s) {
                struct stk *n = esi->s;
@@ -246,7 +247,6 @@ DEF_CMD(emacs_search)
                return -1;
        }
        esi->end = container_of(ci2.mark, struct point, m);
-       esi->end->owner = &esi->end;
 
        esi->start = mark_dup(ci2.mark, 1);
        esi->s = NULL;