]> git.neil.brown.name Git - edlib.git/commitdiff
Remove pane->data when PANE_DATA_TYPE not set.
authorNeilBrown <neil@brown.name>
Thu, 14 Sep 2023 09:24:16 +0000 (19:24 +1000)
committerNeilBrown <neil@brown.name>
Fri, 15 Sep 2023 03:38:14 +0000 (13:38 +1000)
This forces use of _dats which easily highlights places that still need
to be converted.

Signed-off-by: NeilBrown <neil@brown.name>
core-pane.c
core-pane.h
doc-docs.c
lang-python.c
lib-charset.c
lib-tile.c
lib-wiggle.c
mode-emacs.c

index 4e2932cddf45403fac5b8c3f3b90e26eeb6e7216..3b531ecbbd2f0a5c515c45a14af05a5512a4e88b 100644 (file)
@@ -156,7 +156,7 @@ static struct pane *_do_pane_register(struct pane *parent, short z,
 
        if (data)
                alloc_size = sizeof(data);
-       alloc_size += offsetof(struct pane, data);
+       alloc_size += offsetof(struct pane, _data);
 
        p = alloc_zbuf(alloc_size, pane);
        pane_init(p, parent);
@@ -166,7 +166,7 @@ static struct pane *_do_pane_register(struct pane *parent, short z,
                p->abs_z = parent->abs_z + 1;
        p->handle = command_get(handle);
        if (data)
-               p->data = data;
+               p->_data = data;
 
        p->name = handle->name;
        if (z >= 0) {
@@ -772,9 +772,9 @@ void pane_subsume(struct pane *p safe, struct pane *parent safe)
        parent->handle = p->handle;
        p->handle = handle;
 
-       data = parent->data;
-       parent->data = p->data;
-       p->data = data;
+       data = parent->_data;
+       parent->_data = p->_data;
+       p->_data = data;
 
        parent->damaged |= p->damaged;
        pane_damaged(p, DAMAGED_SIZE);
index 04afae4b2ed7c83a0685b1b67f6858f52f8b61e2..706acea72e4b8a9e9f020155cce852eca6f3340b 100644 (file)
@@ -30,8 +30,6 @@ struct pane {
                struct doc      doc;
 #ifdef PANE_DATA_TYPE
                PANE_DATA_TYPE  data[1];
-#else
-               void            *data safe;
 #endif
 #ifdef DOC_DATA_TYPE
                DOC_DATA_TYPE   doc_data[1];
index 483988ffcdf89c2dc048fab73afddd2864754d2c..6824c544657de1d71d373b53e34dd28ef58401ee 100644 (file)
@@ -422,7 +422,7 @@ DEF_CMD(docs_callback_appeared)
 
 DEF_CMD(doc_damage)
 {
-       struct pane *dp = ci->home->data;
+       struct pane *dp = ci->home->_data;
        struct mark *m = mark_new(dp);
        struct pane *child = ci->focus;
 
@@ -441,7 +441,7 @@ DEF_CMD(doc_damage)
 DEF_CMD(doc_revisit)
 {
        struct pane *p = ci->focus;
-       struct pane *dp = ci->home->data;
+       struct pane *dp = ci->home->_data;
        struct docs *docs = dp->doc_data;
 
        if (!p)
@@ -707,7 +707,7 @@ DEF_CMD(docs_destroy)
 
 DEF_CMD(docs_child_closed)
 {
-       struct pane *pd = ci->home->data;
+       struct pane *pd = ci->home->_data;
 
        if (ci->num < 0)
            docs_demark(pd, ci->focus);
@@ -867,7 +867,7 @@ static void docs_init_map(void)
 DEF_CB(docs_callback_lookup)
 {
        struct docs *docs = container_of(ci->comm, struct docs, callback);
-       struct pane *home = docs->collection->data;
+       struct pane *home = docs->collection->_data;
 
        return do_call_val(TYPE_comm, home, &docs_callback_handle.c,
                           ci->key, ci->focus,
index 06e93c944581b9d364e2dd67b136b06b2de5afcd..3f5c3f5bdcbaf107226f5a54461c5cc266c1cadf 100644 (file)
@@ -206,7 +206,7 @@ static inline PyObject *safe Pane_Frompane(struct pane *p)
 {
        Pane *pane;
        if (p && p->handle && p->handle->func == python_pane_call.func) {
-               pane = p->data;
+               pane = p->_data;
                Py_INCREF(pane);
        } else if (p && p->handle && p->handle->func == python_doc_call.func) {
                struct python_doc *pd = p->doc_data;
index 28d1076feb7091a0165d5ac73c89e829ba740d4c..ecda2aa23d48e4a5107d2c1d57ace0c6f6d1e0c5 100644 (file)
@@ -1319,7 +1319,7 @@ DEF_LOOKUP_CMD(charset_handle, charset_map);
 DEF_CMD(charset_char)
 {
        wint_t ret;
-       wchar_t *tbl = ci->home->data;
+       wchar_t *tbl = ci->home->_data;
 
        ret = home_call(ci->home->parent, "doc:byte", ci->focus,
                        ci->num, ci->mark, NULL,
@@ -1387,7 +1387,7 @@ DEF_CB(charset_content_cb)
 DEF_CMD(charset_content)
 {
        struct charsetcb c;
-       wchar_t *tbl = ci->home->data;
+       wchar_t *tbl = ci->home->_data;
 
        if (!ci->comm2 || !ci->mark)
                return Enoarg;
index 868c068f5aafa05030b847ba24e7b0a696129b66..efe0a84e13a1c99b06137a20c1fd3ae927f1804a 100644 (file)
@@ -63,7 +63,7 @@ static inline bool mine(struct pane *t safe)
 
 DEF_CMD_CLOSED(tile_close)
 {
-       struct tileinfo *ti = ci->home->data;
+       struct tileinfo *ti = ci->home->_data;
 
        tile_destroy(ci->home);
        free(ti->name);
@@ -74,7 +74,7 @@ DEF_CMD_CLOSED(tile_close)
 DEF_CMD(tile_refresh_size)
 {
        struct pane *p = ci->home;
-       struct tileinfo *ti = p->data;
+       struct tileinfo *ti = p->_data;
 
        if (ti->direction == Neither) {
                tile_avail(p, NULL);
@@ -93,7 +93,7 @@ DEF_CMD(tile_clone)
         * create a single tile, cloned from the focus pane
         */
        child = ci->home;
-       cti = child->data;
+       cti = child->_data;
        alloc(ti, pane);
        ti->leaf = 1;
        ti->direction = Neither;
@@ -109,10 +109,10 @@ DEF_CMD(tile_clone)
        attr_set_str(&p2->attrs, "borders", "BL");
        while (!cti->leaf && child->focus) {
                child = child->focus;
-               cti = child->data;
+               cti = child->_data;
        }
        cti = list_next_entry(cti, tiles);
-       while (cti != child->data &&
+       while (cti != child->_data &&
               (cti->name == NULL || strcmp(cti->name, "main") != 0))
                cti = list_next_entry(cti, tiles);
        child = cti->p;
@@ -160,7 +160,7 @@ static struct pane *tile_split(struct pane **pp safe, int horiz, int after,
        int space, new_space;
        struct pane *p = safe_cast *pp;
        struct pane *ret;
-       struct tileinfo *ti = p->data;
+       struct tileinfo *ti = p->_data;
        struct tileinfo *ti2;
        if (horiz)
                space = p->w;
@@ -185,7 +185,7 @@ static struct pane *tile_split(struct pane **pp safe, int horiz, int after,
                ti2->direction = ti->direction;
                ti2->group = ti->group;
                INIT_LIST_HEAD(&ti2->tiles);
-               p->data = ti2;
+               p->_data = ti2;
                ti2->p = p;
                p2 = pane_register(p, 0, &tile_handle.c, ti);
                if (!p2)
@@ -247,7 +247,7 @@ static struct pane *tile_split(struct pane **pp safe, int horiz, int after,
 
 static int tile_destroy(struct pane *p safe)
 {
-       struct tileinfo *ti = p->data;
+       struct tileinfo *ti = p->_data;
        struct pane *prev = NULL, *next = NULL;
        struct pane *t, *remain = NULL;
        int pos, prevpos, nextpos;
@@ -345,8 +345,8 @@ static int tile_destroy(struct pane *p safe)
                 * Cannot destroy the parent, so bring child into parent */
                p = remain->parent;
 
-               ti = remain->data;
-               ti2 = p->data;
+               ti = remain->_data;
+               ti2 = p->_data;
 
                tmp = ti2->direction;
                ti2->direction = ti->direction;
@@ -368,7 +368,7 @@ static void tile_avail(struct pane *p safe, struct pane *ignore)
         * if stacking direction doesn't match 'horiz', find minimum.
         * If only one child, assume min of 4.
         */
-       struct tileinfo *ti = p->data;
+       struct tileinfo *ti = p->_data;
        struct pane *t;
 
        if (ti->leaf) {
@@ -387,7 +387,7 @@ static void tile_avail(struct pane *p safe, struct pane *ignore)
                        if (t == ignore || !mine(t))
                                continue;
                        tile_avail(t, NULL);
-                       ti2 = t->data;
+                       ti2 = t->_data;
                        if (min < 0 || min > ti2->avail_perp)
                                min = ti2->avail_perp;
                        sum += ti2->avail_inline;
@@ -414,7 +414,7 @@ static void tile_adjust(struct pane *p safe)
        int avail_cnt = 0;
        int pos;
        int size = 0;
-       struct tileinfo *ti = p->data;
+       struct tileinfo *ti = p->_data;
 
        if (ti->leaf)
                /* Children are responsible for themselves. */
@@ -424,7 +424,7 @@ static void tile_adjust(struct pane *p safe)
 
                if (!mine(t))
                        continue;
-               ti = t->data;
+               ti = t->_data;
                if (ti->direction == Horiz) {
                        pane_resize(t, t->x, 0, t->w, p->h);
                        used += t->w;
@@ -446,7 +446,7 @@ static void tile_adjust(struct pane *p safe)
                        cnt = avail_cnt;
                avail_cnt = 0;
                list_for_each_entry(t, &p->children, siblings) {
-                       struct tileinfo *ti2 = t->data;
+                       struct tileinfo *ti2 = t->_data;
                        int diff;
                        int mysize;
                        if (!mine(t))
@@ -492,7 +492,7 @@ static void tile_adjust(struct pane *p safe)
        }
        pos = 0;
        list_for_each_entry(t, &p->children, siblings) {
-               struct tileinfo *ti2 = t->data;
+               struct tileinfo *ti2 = t->_data;
                if (!mine(t))
                        continue;
                if (ti2->direction == Horiz) {
@@ -517,7 +517,7 @@ static bool tile_grow(struct pane *p safe, int horiz, int size)
         * Then that propagates back down.  Size of this pane is adjusted
         * first to catch the propagations, then corrected after.
         */
-       struct tileinfo *ti = p->data;
+       struct tileinfo *ti = p->_data;
        struct tileinfo *tip;
        int avail;
 
@@ -573,7 +573,7 @@ static bool tile_grow(struct pane *p safe, int horiz, int size)
 
        /* Hoping to grow if there is room for others to shrink */
        tile_avail(p->parent, p);
-       tip = p->parent->data;
+       tip = p->parent->_data;
        if (ti->direction == (horiz ? Horiz : Vert))
                avail = tip->avail_inline;
        else
@@ -613,7 +613,7 @@ static struct tileinfo *tile_first(struct tileinfo *ti safe)
                struct pane *p = next_child(ti->p, NULL, 0);
                if (!p)
                        return NULL;
-               ti = p->data;
+               ti = p->_data;
        }
        return ti;
 }
@@ -623,7 +623,7 @@ static bool tile_is_first(struct tileinfo *ti safe)
        while (ti->direction != Neither) {
                if (ti->p != next_child(ti->p->parent, NULL, 0))
                        return False;
-               ti = ti->p->parent->data;
+               ti = ti->p->parent->_data;
        }
        return True;
 }
@@ -631,7 +631,7 @@ static bool tile_is_first(struct tileinfo *ti safe)
 static struct pane *tile_root_popup(struct tileinfo *ti safe)
 {
        while (ti->direction != Neither)
-               ti = ti->p->parent->data;
+               ti = ti->p->parent->_data;
        return next_child(ti->p, NULL, 1);
 }
 
@@ -651,7 +651,7 @@ static struct tileinfo *safe tile_next_named(struct tileinfo *ti safe,
 
 static bool wrong_pane(struct cmd_info const *ci safe)
 {
-       struct tileinfo *ti = ci->home->data;
+       struct tileinfo *ti = ci->home->_data;
 
        if (ci->str || ti->group) {
                if (!ci->str || !ti->group)
@@ -672,7 +672,7 @@ DEF_CMD(tile_window_next)
         */
        struct pane *p = ci->home;
        struct pane *p2;
-       struct tileinfo *ti = p->data;
+       struct tileinfo *ti = p->_data;
        struct tileinfo *t2;
 
        if (wrong_pane(ci))
@@ -710,7 +710,7 @@ DEF_CMD(tile_window_next)
 DEF_CMD(tile_window_prev)
 {
        struct pane *p = ci->home;
-       struct tileinfo *ti = p->data;
+       struct tileinfo *ti = p->_data;
        struct tileinfo *t2;
 
        if (wrong_pane(ci))
@@ -785,7 +785,7 @@ DEF_CMD(tile_window_splity)
 DEF_CMD(tile_window_close)
 {
        struct pane *p = ci->home;
-       struct tileinfo *ti = p->data;
+       struct tileinfo *ti = p->_data;
 
        if (wrong_pane(ci))
                return Efallthrough;
@@ -818,7 +818,7 @@ DEF_CMD(tile_window_close_others)
 {
        struct pane *p = ci->home;
        struct pane *parent = p->parent;
-       struct tileinfo *ti = p->data;
+       struct tileinfo *ti = p->_data;
        bool found =  True;
 
        if (wrong_pane(ci))
@@ -851,7 +851,7 @@ DEF_CMD(tile_other)
         */
        struct pane *p = ci->home;
        struct pane *p2;
-       struct tileinfo *ti = p->data;
+       struct tileinfo *ti = p->_data;
        struct tileinfo *ti2;
        int horiz, after;
 
@@ -902,7 +902,7 @@ DEF_CMD(tile_other)
 
 DEF_CMD(tile_this)
 {
-       struct tileinfo *ti = ci->home->data;
+       struct tileinfo *ti = ci->home->_data;
 
        if (ci->str || ti->group) {
                if (!ci->str || !ti->group)
@@ -929,7 +929,7 @@ DEF_CMD(tile_doc)
        /* Find the pane displaying given document, preferrably not
         * this pane
         */
-       struct tileinfo *ti = ci->home->data;
+       struct tileinfo *ti = ci->home->_data;
        struct tileinfo *t;
        char *name;
 
@@ -968,7 +968,7 @@ DEF_CMD(tile_doc)
 DEF_CMD(tile_root)
 {
        struct pane *p = ci->home;
-       struct tileinfo *ti = p->data;
+       struct tileinfo *ti = p->_data;
 
        if (ti->direction != Neither)
                return Efallthrough;
@@ -986,7 +986,7 @@ DEF_CMD(tile_root)
 DEF_CMD(tile_child_notify)
 {
        struct pane *p = ci->home;
-       struct tileinfo *ti = p->data;
+       struct tileinfo *ti = p->_data;
        struct pane *c = ci->focus;
 
        if (c->z)
index fbc2032304a6c6c0cf58029c270fc3c855b2b830..1fd05191f563c7e76f738fd01f24ac62b813dbd9 100644 (file)
@@ -203,7 +203,7 @@ struct wiggle_data {
 DEF_CMD(notify_close)
 {
        /* Private pane received a "close" notification. */
-       struct wiggle_data *wd = ci->home->data;
+       struct wiggle_data *wd = ci->home->_data;
        int i;
 
        for (i = 0; i < 3; i++)
@@ -220,7 +220,7 @@ DEF_CMD(notify_close)
 
 DEF_CMD_CLOSED(wiggle_close)
 {
-       struct wiggle_data *wd = ci->home->data;
+       struct wiggle_data *wd = ci->home->_data;
        int i;
 
        for (i = 0; i < 3 ; i++) {
@@ -264,7 +264,7 @@ static void forward_lines(struct pane *p safe, struct mark *m safe,
 DEF_CMD(wiggle_text)
 {
        /* remember pane, mark1, mark2, num,  num2 */
-       struct wiggle_data *wd = ci->home->data;
+       struct wiggle_data *wd = ci->home->_data;
        struct mark *m2;
        char k0 = ci->key[0];
        int which = k0 == 'b' ? 1 : k0 == 'a' ? 2 : 0;
@@ -302,7 +302,7 @@ DEF_CMD(wiggle_text)
 
 DEF_CMD(wiggle_extract)
 {
-       struct wiggle_data *wd = ci->home->data;
+       struct wiggle_data *wd = ci->home->_data;
        struct wtxt *wt;
        struct stream str;
 
@@ -330,7 +330,7 @@ DEF_CMD(wiggle_set_common)
        /* Set the attribute 'str' on all common ranges in
         * 'before' and 'after'
         */
-       struct wiggle_data *wd = ci->home->data;
+       struct wiggle_data *wd = ci->home->_data;
        const char *attr = ci->str ?: "render:common";
        struct stream before, after;
        struct file bfile, afile;
@@ -573,7 +573,7 @@ static char *collect_merge(struct merge *merge safe,
 
 DEF_CMD(wiggle_set_wiggle)
 {
-       struct wiggle_data *wd = ci->home->data;
+       struct wiggle_data *wd = ci->home->_data;
        struct stream ostr, astr, bstr;
        struct file of, af, bf;
        struct csl *csl1, *csl2;
@@ -648,7 +648,7 @@ DEF_CMD(wiggle_find)
         * num2 is max number of lines, defaults to searching whole file.
         * Returns number of fuzz lines, plus 1
         */
-       struct wiggle_data *wd = ci->home->data;
+       struct wiggle_data *wd = ci->home->_data;
        int lines = ci->num2;
        struct pane *p = ci->focus;
        struct stream str;
@@ -744,7 +744,7 @@ DEF_CMD(wiggle_find)
 
 DEF_CMD(wiggle_get)
 {
-       struct wiggle_data *wd = ci->home->data;
+       struct wiggle_data *wd = ci->home->_data;
 
        if (wd->conflicts < 0)
                return Einval;
index 001469f2729d10760b2f8d213c1e18a3d038a6a9..ebe1786234f9f6ec1923921c2deba937a33f8449 100644 (file)
@@ -817,7 +817,7 @@ REDEF_CMD(emacs_cmd_complete);
 
 DEF_CMD(find_complete)
 {
-       char *type = ci->home->data;
+       char *type = ci->home->_data;
 
        if (strstarts(type, "file"))
                return emacs_file_complete_func(ci);
@@ -833,7 +833,7 @@ DEF_CMD(find_complete)
 DEF_CMD(find_done)
 {
        int ret;
-       char *type = ci->home->data;
+       char *type = ci->home->_data;
        char *str = call_ret(strsave, "doc:get-str", ci->focus);
        const char *norm = NULL;
        struct stat stb;
@@ -977,7 +977,7 @@ DEF_CMD(find_prevnext)
         * walk the list in mru order.
         * When we find it, insert the name into ci->focus document
         */
-       char *type = ci->home->data;
+       char *type = ci->home->_data;
        struct find_helper h;
 
        if (strcmp(type, "doc") != 0)
@@ -1006,7 +1006,7 @@ DEF_CMD(find_prevnext)
 
 DEF_CMD(find_attr)
 {
-       char *type = ci->home->data;
+       char *type = ci->home->_data;
 
        if (!ci->str)
                return Enoarg;
@@ -1043,7 +1043,7 @@ DEF_CMD(find_attr)
 DEF_CMD(find_check_replace)
 {
        char *str, *cp, *sl;
-       char *type = ci->home->data;
+       char *type = ci->home->_data;
        char *initial_path;
        char *prev_dir;
        struct stat stb;
@@ -1457,7 +1457,7 @@ REDEF_CMD(emacs_file_complete)
        int fd;
        struct pane *par, *pop, *docp, *p;
        struct call_return cr;
-       char *type = ci->home->data;
+       char *type = ci->home->_data;
        char *initial = attr_find(ci->home->attrs, "initial_path");
        int wholebuf = strcmp(type, "file") == 0;
        struct mark *st;