From: NeilBrown Date: Fri, 1 Sep 2023 02:42:05 +0000 (+1000) Subject: core-pane: change doc and doc_data to singular arrays X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=a0a47516ede2e3e45d0e88dfb4f5ab8da1a393b5;p=edlib.git core-pane: change doc and doc_data to singular arrays When PANE_DATA_TYPE is set, make doc (and for DOC_DATA_TYPE doc_data) into singluar arrays: [1]. This allows the address to be obtained without an '&' with is just noise. Signed-off-by: NeilBrown --- diff --git a/core-editor.c b/core-editor.c index 988208ce..02005caf 100644 --- a/core-editor.c +++ b/core-editor.c @@ -43,7 +43,7 @@ struct ed_info { bool edlib_testing(struct pane *p safe) { - struct ed_info *ei = &pane_root(p)->data; + struct ed_info *ei = pane_root(p)->data; return ei->testing; } @@ -73,7 +73,7 @@ DEF_CMD(global_set_attr) DEF_CMD(global_set_command) { - struct ed_info *ei = &ci->home->data; + struct ed_info *ei = ci->home->data; struct map *map = ei->map; bool prefix = strcmp(ci->key, "global-set-command-prefix") == 0; @@ -92,7 +92,7 @@ DEF_CMD(global_set_command) DEF_CMD(global_get_command) { - struct ed_info *ei = &ci->home->data; + struct ed_info *ei = ci->home->data; struct map *map = ei->map; struct command *cm; @@ -152,7 +152,7 @@ static struct builtin { #endif DEF_CMD(editor_load_module) { - struct ed_info *ei = &ci->home->data; + struct ed_info *ei = ci->home->data; struct map *map = ei->map; const char *name = ci->str; char buf[PATH_MAX]; @@ -214,7 +214,7 @@ DEF_CMD(editor_auto_event) * have to use key_lookup_prefix to find them. * If nothing is found, autoload lib-libevent (hack?) */ - struct ed_info *ei = &ci->home->data; + struct ed_info *ei = ci->home->data; struct map *map = ei->map; int ret = key_lookup_prefix(map, ci); @@ -272,7 +272,7 @@ DEF_CMD(editor_activate_display) DEF_CMD(editor_multicall) { - struct ed_info *ei = &ci->home->data; + struct ed_info *ei = ci->home->data; struct map *map = ei->map; int ret; const char *key = ci->key; @@ -300,7 +300,7 @@ DEF_CMD(editor_send_notify) DEF_CMD(editor_free_panes) { - struct ed_info *ei = &ci->home->data; + struct ed_info *ei = ci->home->data; while (ei->freelist) { struct pane *p = ei->freelist; @@ -319,7 +319,7 @@ DEF_CMD(editor_free_panes) DEF_CMD(editor_free_marks) { - struct ed_info *ei = &ci->home->data; + struct ed_info *ei = ci->home->data; while (ei->mark_free_list) { struct mark *m = ei->mark_free_list; @@ -332,7 +332,7 @@ DEF_CMD(editor_free_marks) DEF_CMD(editor_free_store) { - struct ed_info *ei = &ci->home->data; + struct ed_info *ei = ci->home->data; while (ei->store) { struct store *s = ei->store; @@ -359,7 +359,7 @@ DEF_EXTERN_CMD(edlib_noop) DEF_CMD(editor_close) { - struct ed_info *ei = &ci->home->data; + struct ed_info *ei = ci->home->data; stat_free(); free(ei->here); ei->here = NULL; free(ei->data_path); ei->data_path = NULL; @@ -372,7 +372,7 @@ void * safe memsave(struct pane *p safe, const char *buf, int len) struct ed_info *ei; p = pane_root(p); - ei = &p->data; + ei = p->data; ASSERT(ei->magic==ED_MAGIC); if (!ei->store) call_comm("event:on-idle", p, &editor_free_store, 2); @@ -438,7 +438,7 @@ char * safe do_strconcat(struct pane *p, const char *s1 safe, ...) void editor_delayed_free(struct pane *ed safe, struct pane *p safe) { - struct ed_info *ei = &ed->data; + struct ed_info *ei = ed->data; if (!ei) { p->damaged &= ~DAMAGED_DEAD; pane_call(p, "Free", p); @@ -458,7 +458,7 @@ void editor_delayed_free(struct pane *ed safe, struct pane *p safe) void editor_delayed_mark_free(struct mark *m safe) { struct pane *ed = pane_root(m->owner); - struct ed_info *ei = &ed->data; + struct ed_info *ei = ed->data; ASSERT(ei->magic==ED_MAGIC); if (!ei->mark_free_list) @@ -469,7 +469,7 @@ void editor_delayed_mark_free(struct mark *m safe) static char *set_here(struct pane *p safe) { - struct ed_info *ei = &p->data; + struct ed_info *ei = p->data; Dl_info info; if (ei->here) @@ -488,7 +488,7 @@ static char *set_here(struct pane *p safe) static char *set_data_path(struct pane *p safe) { - struct ed_info *ei = &p->data; + struct ed_info *ei = p->data; char *dh, *dd, *here; struct buf b; @@ -538,7 +538,7 @@ static char *set_data_path(struct pane *p safe) static char *set_config_path(struct pane *p safe) { - struct ed_info *ei = &p->data; + struct ed_info *ei = p->data; char *ch, *cd, *here; struct buf b; @@ -588,7 +588,7 @@ static char *set_config_path(struct pane *p safe) static char *set_bin_path(struct pane *p safe) { - struct ed_info *ei = &p->data; + struct ed_info *ei = p->data; char *bd, *here; struct buf b; @@ -724,7 +724,7 @@ struct pane *editor_new(const char *comm_name) ed = pane_register_root(&ed_handle.c, NULL, sizeof(*ei)); if (!ed) return NULL; - ei = &ed->data; + ei = ed->data; ei->magic = ED_MAGIC; attr_set_str(&ed->attrs, "command-name", comm_name ?: "edlib"); ei->testing = (getenv("EDLIB_TESTING") != NULL); diff --git a/core-log.c b/core-log.c index 681b12c3..2c3ba63e 100644 --- a/core-log.c +++ b/core-log.c @@ -130,7 +130,7 @@ void LOG(char *fmt, ...) DEF_CMD(log_append) { - struct log *l = &ci->home->doc_data; + struct log *l = ci->home->doc_data; struct logbuf *b; unsigned int len; @@ -158,7 +158,7 @@ DEF_CMD(log_append) DEF_CMD(log_content) { - struct log *log = &ci->home->doc_data; + struct log *log = ci->home->doc_data; struct mark *from = ci->mark, *to = ci->mark2; struct mark *m; struct logbuf *b, *first, *last; @@ -247,7 +247,7 @@ DEF_CMD(log_content) DEF_CMD(log_set_ref) { - struct log *log = &ci->home->doc_data; + struct log *log = ci->home->doc_data; struct mark *m = ci->mark; if (!m) @@ -263,7 +263,7 @@ DEF_CMD(log_set_ref) static inline wint_t log_next(struct pane *p safe, struct doc_ref *r safe, bool bytes) { - struct log *log = &p->doc_data; + struct log *log = p->doc_data; wint_t ret; if (!r->b) @@ -290,7 +290,7 @@ static inline wint_t log_next(struct pane *p safe, struct doc_ref *r safe, bool static inline wint_t log_prev(struct pane *p safe, struct doc_ref *r safe, bool bytes) { - struct log *log = &p->doc_data; + struct log *log = p->doc_data; const char *s; if (list_empty(&log->log)) @@ -325,7 +325,7 @@ DEF_CMD(log_char) DEF_CMD(log_val_marks) { /* mark1 and mark2 must be correctly ordered */ - struct log *log = &ci->home->doc_data; + struct log *log = ci->home->doc_data; struct logbuf *b; int found = 0; @@ -391,7 +391,7 @@ DEF_CMD(log_view) DEF_CMD(log_close) { - struct log *l = &ci->home->doc_data; + struct log *l = ci->home->doc_data; while (!list_empty(&l->log)) { struct logbuf *b = list_first_entry(&l->log, struct logbuf, h); @@ -415,7 +415,7 @@ DEF_CMD(log_new) p = doc_register(ci->focus, &log_handle.c); if (!p) return Efail; - l = &p->doc_data; + l = p->doc_data; INIT_LIST_HEAD(&l->log); attr_set_str(&p->attrs, "render-default", "text"); attr_set_str(&p->attrs, "doc-type", "text"); @@ -433,7 +433,7 @@ static void log_init(struct pane *ed safe) log_pane = doc_register(ed, &log_handle.c); if (!log_pane) return; - log_doc = &log_pane->doc_data; + log_doc = log_pane->doc_data; INIT_LIST_HEAD(&log_doc->log); fname = getenv("EDLIB_LOG"); diff --git a/core-pane.h b/core-pane.h index 60a3e58e..38473141 100644 --- a/core-pane.h +++ b/core-pane.h @@ -29,12 +29,12 @@ struct pane { union { struct doc doc; #ifdef PANE_DATA_TYPE - PANE_DATA_TYPE data; + PANE_DATA_TYPE data[1]; #else void *data safe; #endif #ifdef DOC_DATA_TYPE - DOC_DATA_TYPE doc_data; + DOC_DATA_TYPE doc_data[1]; #endif void *_data; }; diff --git a/core-window.c b/core-window.c index 8e80950e..517d190f 100644 --- a/core-window.c +++ b/core-window.c @@ -92,7 +92,7 @@ DEF_CMD(window_set) DEF_CMD(selection_claim) { - struct window_data *wd = &ci->home->data; + struct window_data *wd = ci->home->data; if (wd->sel_owner && wd->sel_owner != ci->focus) { call("Notify:selection:claimed", wd->sel_owner); @@ -108,7 +108,7 @@ DEF_CMD(selection_claim) DEF_CMD(selection_commit) { - struct window_data *wd = &ci->home->data; + struct window_data *wd = ci->home->data; if (wd->sel_owner && !wd->sel_committed) { if (call("Notify:selection:commit", wd->sel_owner) != 2) @@ -119,7 +119,7 @@ DEF_CMD(selection_commit) DEF_CMD(selection_discard) { - struct window_data *wd = &ci->home->data; + struct window_data *wd = ci->home->data; struct pane *op, *fp; if (!wd->sel_owner) @@ -141,7 +141,7 @@ DEF_CMD(selection_discard) DEF_CMD(close_notify) { - struct window_data *wd = &ci->home->data; + struct window_data *wd = ci->home->data; if (wd->sel_owner_fallback == ci->focus) wd->sel_owner_fallback = NULL; diff --git a/display-ncurses.c b/display-ncurses.c index 3178b355..e6aae170 100644 --- a/display-ncurses.c +++ b/display-ncurses.c @@ -127,7 +127,7 @@ static void set_screen(struct pane *p) current_screen = NULL; return; } - dd = &p->data; + dd = p->data; current_dd = dd; if (!dd) return; @@ -158,7 +158,7 @@ DEF_CMD(next_evt); static bool parse_event(struct pane *p safe); static bool prepare_recrep(struct pane *p safe) { - struct display_data *dd = &p->data; + struct display_data *dd = p->data; char *name; name = getenv("EDLIB_RECORD"); @@ -178,7 +178,7 @@ static bool prepare_recrep(struct pane *p safe) static void close_recrep(struct pane *p safe) { - struct display_data *dd = &p->data; + struct display_data *dd = p->data; if (dd->log) { fprintf(dd->log, "Close %d\n", dd->clears); @@ -188,7 +188,7 @@ static void close_recrep(struct pane *p safe) static void record_key(struct pane *p safe, char *key safe) { - struct display_data *dd = &p->data; + struct display_data *dd = p->data; char q; if (!dd->log) @@ -208,7 +208,7 @@ static void record_key(struct pane *p safe, char *key safe) static void record_mouse(struct pane *p safe, char *key safe, int x, int y) { - struct display_data *dd = &p->data; + struct display_data *dd = p->data; char q; if (!dd->log) return; @@ -227,7 +227,7 @@ static void record_mouse(struct pane *p safe, char *key safe, int x, int y) static void record_screen(struct pane *p safe) { - struct display_data *dd = &p->data; + struct display_data *dd = p->data; struct md5_state ctx; uint16_t buf[CCHARW_MAX+5]; char out[MD5_DIGEST_SIZE*2+1]; @@ -330,7 +330,7 @@ static char *get_hash(char *line safe, hash_t hash safe) static bool parse_event(struct pane *p safe) { - struct display_data *dd = &p->data; + struct display_data *dd = p->data; char line[80]; line[79] = 0; @@ -376,7 +376,7 @@ static bool parse_event(struct pane *p safe) REDEF_CMD(next_evt) { struct pane *p = ci->home; - struct display_data *dd = &p->data; + struct display_data *dd = p->data; int button = 0, type = 0; dd->input_sleeping = 0; @@ -509,7 +509,7 @@ static void wait_for(struct display_data *dd safe) DEF_CB(ns_resume) { - struct display_data *dd = &ci->home->data; + struct display_data *dd = ci->home->data; if (dd->suspended) { dd->suspended = False; @@ -522,7 +522,7 @@ DEF_CB(ns_resume) DEF_CMD(nc_external_viewer) { struct pane *p = ci->home; - struct display_data *dd = &p->data; + struct display_data *dd = p->data; char *disp = pane_attr_get(p, "DISPLAY"); char *disp_auth = pane_attr_get(p, "XAUTHORITY"); char *remote = pane_attr_get(p, "REMOTE_SESSION"); @@ -624,7 +624,7 @@ DEF_CMD(nc_external_viewer) static void ncurses_stop(struct pane *p safe) { - struct display_data *dd = &p->data; + struct display_data *dd = p->data; if (dd->is_xterm) { /* disable bracketed-paste */ @@ -649,7 +649,7 @@ static void ncurses_stop(struct pane *p safe) static void ncurses_end(struct pane *p safe) { - struct display_data *dd = &p->data; + struct display_data *dd = p->data; if (dd->did_close) return; @@ -800,7 +800,7 @@ static int to_pair(struct display_data *dd safe, int fg, int bg) static int cvt_attrs(struct pane *p safe, struct pane *home safe, const char *attrs, int *pairp safe, bool use_parent) { - struct display_data *dd = &home->data; + struct display_data *dd = home->data; int attr = 0; const char *a, *v; char *col = NULL; @@ -864,7 +864,7 @@ static int make_cursor(int attr) DEF_CMD(nc_notify_display) { - struct display_data *dd = &ci->home->data; + struct display_data *dd = ci->home->data; comm_call(ci->comm2, "callback:display", ci->home, dd->last_event); return 1; } @@ -872,7 +872,7 @@ DEF_CMD(nc_notify_display) DEF_CMD(nc_close) { struct pane *p = ci->home; - struct display_data *dd = &p->data; + struct display_data *dd = p->data; ncurses_end(p); hash_free(dd); fclose(dd->scr_file); @@ -917,7 +917,7 @@ static PANEL * safe pane_panel(struct pane *p safe, struct pane *home) DEF_CMD(nc_clear) { struct pane *p = ci->home; - struct display_data *dd = &p->data; + struct display_data *dd = p->data; cchar_t cc = {}; int pair = 0; int attr = cvt_attrs(ci->focus, p, ci->str, &pair, ci->str == NULL); @@ -1021,7 +1021,7 @@ DEF_CMD(nc_draw_image) * 'y' will fit down. */ struct pane *p = ci->home; - struct display_data *dd = &p->data; + struct display_data *dd = p->data; int x = 0, y = 0; bool stretch = ci->num & 16; int pos = ci->num; @@ -1216,7 +1216,7 @@ DEF_CMD(nc_refresh_size) DEF_CMD(nc_refresh_post) { struct pane *p = ci->home; - struct display_data *dd = &p->data; + struct display_data *dd = p->data; struct pane *p1; PANEL *pan, *pan2; @@ -1299,7 +1299,7 @@ DEF_CMD(nc_refresh_post) static void ncurses_start(struct pane *p safe) { - struct display_data *dd = &p->data; + struct display_data *dd = p->data; int rows, cols; start_color(); @@ -1352,7 +1352,7 @@ static struct pane *ncurses_init(struct pane *ed safe, p = pane_register(ed, 1, &ncurses_handle.c); if (!p) return NULL; - dd = &p->data; + dd = p->data; dd->scr = scr; dd->scr_file = f; dd->is_xterm = (term && strstarts(term, "xterm")); @@ -1385,7 +1385,7 @@ static struct pane *ncurses_init(struct pane *ed safe, REDEF_CMD(handle_winch) { struct pane *p = ci->home; - struct display_data *dd = &p->data; + struct display_data *dd = p->data; struct winsize size; ioctl(fileno(dd->scr_file), TIOCGWINSZ, &size); set_screen(p); @@ -1545,7 +1545,7 @@ static char *find_name (struct namelist *l safe, wint_t c) static void send_key(int keytype, wint_t c, int alt, struct pane *p safe) { - struct display_data *dd = &p->data; + struct display_data *dd = p->data; char *n; char buf[100];/* FIXME */ char t[5]; @@ -1583,7 +1583,7 @@ static void do_send_mouse(struct pane *p safe, int x, int y, char *cmd safe, int button, char *mod, int type) { int ret; - struct display_data *dd = &p->data; + struct display_data *dd = p->data; record_mouse(p, cmd, x, y); ret = call("Mouse-event", p, button, NULL, cmd, type, NULL, mod, x, y); @@ -1604,7 +1604,7 @@ static void do_send_mouse(struct pane *p safe, int x, int y, char *cmd safe, static void send_mouse(MEVENT *mev safe, struct pane *p safe) { - struct display_data *dd = &p->data; + struct display_data *dd = p->data; int x = mev->x; int y = mev->y; int b; @@ -1650,7 +1650,7 @@ static void send_mouse(MEVENT *mev safe, struct pane *p safe) static void paste_start(struct pane *home safe) { - struct display_data *dd = &home->data; + struct display_data *dd = home->data; dd->paste_start = time(NULL); buf_init(&dd->paste_buf); @@ -1658,7 +1658,7 @@ static void paste_start(struct pane *home safe) static void paste_flush(struct pane *home safe) { - struct display_data *dd = &home->data; + struct display_data *dd = home->data; if (!dd->paste_start) return; @@ -1671,7 +1671,7 @@ static void paste_flush(struct pane *home safe) static bool paste_recv(struct pane *home safe, int is_keycode, wint_t ch) { - struct display_data *dd = &home->data; + struct display_data *dd = home->data; time_t now; if (dd->paste_start == 0) return False; @@ -1697,7 +1697,7 @@ static bool paste_recv(struct pane *home safe, int is_keycode, wint_t ch) DEF_CMD(nc_get_paste) { - struct display_data *dd = &ci->home->data; + struct display_data *dd = ci->home->data; comm_call(ci->comm2, "cb", ci->focus, dd->paste_start, NULL, dd->paste_latest); @@ -1707,7 +1707,7 @@ DEF_CMD(nc_get_paste) REDEF_CMD(input_handle) { struct pane *p = ci->home; - struct display_data *dd = &p->data; + struct display_data *dd = p->data; static const char paste_seq[] = "\e[200~"; wint_t c; int is_keycode; diff --git a/display-x11-xcb.c b/display-x11-xcb.c index fe3fd377..1a084928 100644 --- a/display-x11-xcb.c +++ b/display-x11-xcb.c @@ -237,7 +237,7 @@ DEF_LOOKUP_CMD(xcb_handle, xcb_map); static struct panes *get_pixmap(struct pane *home safe, struct pane *p safe) { - struct xcb_data *xd = &home->data; + struct xcb_data *xd = home->data; struct panes **pp, *ps; for (pp = &xd->panes; (ps = *pp) != NULL; pp = &(*pp)->next) { @@ -489,7 +489,7 @@ static void wait_for(struct xcb_data *xd safe) DEF_CMD(xcb_external_viewer) { - struct xcb_data *xd = &ci->home->data; + struct xcb_data *xd = ci->home->data; const char *path = ci->str; struct pids *p; int pid; @@ -527,7 +527,7 @@ DEF_CMD(xcb_external_viewer) DEF_CMD(xcb_fullscreen) { - struct xcb_data *xd = &ci->home->data; + struct xcb_data *xd = ci->home->data; xcb_client_message_event_t msg = {}; msg.response_type = XCB_CLIENT_MESSAGE; @@ -569,7 +569,7 @@ static void kbd_free(struct xcb_data *xd safe); DEF_CMD(xcb_close) { - struct xcb_data *xd = &ci->home->data; + struct xcb_data *xd = ci->home->data; xcb_destroy_window(xd->conn, xd->win); kbd_free(xd); @@ -579,7 +579,7 @@ DEF_CMD(xcb_close) DEF_CMD(xcb_free) { - struct xcb_data *xd = &ci->home->data; + struct xcb_data *xd = ci->home->data; pango_font_description_free(xd->fd); cairo_destroy(xd->cairo); @@ -595,7 +595,7 @@ DEF_CMD(xcb_free) DEF_CMD(xcb_clear) { - struct xcb_data *xd = &ci->home->data; + struct xcb_data *xd = ci->home->data; const char *attr = ci->str; struct panes *src = NULL, *dest; struct rgb bg; @@ -652,7 +652,7 @@ DEF_CMD(xcb_clear) DEF_CMD(xcb_text_size) { - struct xcb_data *xd = &ci->home->data; + struct xcb_data *xd = ci->home->data; const char *attr = ci->str2 ?: ""; const char *str = ci->str ?: ""; int scale = ci->num2; @@ -694,7 +694,7 @@ DEF_CMD(xcb_text_size) DEF_CMD(xcb_draw_text) { - struct xcb_data *xd = &ci->home->data; + struct xcb_data *xd = ci->home->data; const char *str = ci->str; const char *attr = ci->str2; int scale = 1000; @@ -829,7 +829,7 @@ DEF_CMD(xcb_draw_image) * p->cx, p->cy of a size so that 'x' will fit across and * 'y' will fit down. */ - struct xcb_data *xd = &ci->home->data; + struct xcb_data *xd = ci->home->data; bool stretch = ci->num & 16; int pos = ci->num; int w = ci->focus->w, h = ci->focus->h; @@ -1045,7 +1045,7 @@ static struct panes *sort_merge(struct panes *p1, struct panes *p2) DEF_CMD(xcb_refresh_post) { - struct xcb_data *xd = &ci->home->data; + struct xcb_data *xd = ci->home->data; struct panes *ps; time_start(TIME_WINDOW); @@ -1128,7 +1128,7 @@ DEF_CMD(xcb_refresh_size) /* FIXME: should I consider resizing the window? * For now, just ensure we redraw everything. */ - struct xcb_data *xd = &ci->home->data; + struct xcb_data *xd = ci->home->data; cairo_rectangle_int_t r = { .x = 0, .y = 0, @@ -1145,7 +1145,7 @@ DEF_CMD(xcb_refresh_size) DEF_CMD(xcb_pane_close) { - struct xcb_data *xd = &ci->home->data; + struct xcb_data *xd = ci->home->data; struct panes **pp, *ps; for (pp = &xd->panes; (ps = *pp) != NULL; pp = &(*pp)->next) { @@ -1173,7 +1173,7 @@ DEF_CMD(xcb_pane_close) DEF_CMD(xcb_notify_display) { - struct xcb_data *xd = &ci->home->data; + struct xcb_data *xd = ci->home->data; comm_call(ci->comm2, "callback:display", ci->home, xd->last_event); return 1; } @@ -1181,7 +1181,7 @@ DEF_CMD(xcb_notify_display) static void handle_button(struct pane *home safe, xcb_button_press_event_t *be safe) { - struct xcb_data *xd = &home->data; + struct xcb_data *xd = home->data; bool press = (be->response_type & 0x7f) == XCB_BUTTON_PRESS; char mod[2+2+2+1]; char key[2+2+2+9+1+1]; @@ -1215,7 +1215,7 @@ static void handle_button(struct pane *home safe, static void handle_motion(struct pane *home safe, xcb_motion_notify_event_t *mne safe) { - struct xcb_data *xd = &home->data; + struct xcb_data *xd = home->data; xcb_query_pointer_cookie_t c; xcb_query_pointer_reply_t *qpr; int ret; @@ -1238,7 +1238,7 @@ static void handle_motion(struct pane *home safe, static void handle_focus(struct pane *home safe, xcb_focus_in_event_t *fie safe) { - struct xcb_data *xd = &home->data; + struct xcb_data *xd = home->data; bool in = (fie->response_type & 0x7f) == XCB_FOCUS_IN; struct pane *p; struct mark *pt; @@ -1420,7 +1420,7 @@ static struct { static void handle_key_press(struct pane *home safe, xcb_key_press_event_t *kpe safe) { - struct xcb_data *xd = &home->data; + struct xcb_data *xd = home->data; xkb_keycode_t keycode = kpe->detail; xcb_keysym_t keysym; xkb_keysym_t sym; @@ -1533,7 +1533,7 @@ static void handle_key_press(struct pane *home safe, static void handle_xkb_event(struct pane *home safe, xcb_generic_event_t *ev safe) { - struct xcb_data *xd = &home->data; + struct xcb_data *xd = home->data; switch (ev->pad0) { xcb_xkb_new_keyboard_notify_event_t *nkne; @@ -1567,7 +1567,7 @@ static void handle_xkb_event(struct pane *home safe, static void handle_configure(struct pane *home safe, xcb_configure_notify_event_t *cne safe) { - struct xcb_data *xd = &home->data; + struct xcb_data *xd = home->data; pane_resize(home, 0, 0, cne->width, cne->height); cairo_xcb_surface_set_size(xd->surface, cne->width, cne->height); @@ -1576,7 +1576,7 @@ static void handle_configure(struct pane *home safe, static void handle_expose(struct pane *home safe, xcb_expose_event_t *ee safe) { - struct xcb_data *xd = &home->data; + struct xcb_data *xd = home->data; cairo_rectangle_int_t r = { .x = ee->x, .y = ee->y, @@ -1594,7 +1594,7 @@ static void handle_expose(struct pane *home safe, static void handle_client_message(struct pane *home safe, xcb_client_message_event_t *cme safe) { - struct xcb_data *xd = &home->data; + struct xcb_data *xd = home->data; if (cme->type == xd->atoms[a_WM_PROTOCOLS] && cme->format == 32 && @@ -1623,7 +1623,7 @@ static void handle_client_message(struct pane *home safe, DEF_CMD(xcb_input) { - struct xcb_data *xd = &ci->home->data; + struct xcb_data *xd = ci->home->data; xcb_generic_event_t *ev; int ret = 1; @@ -1829,7 +1829,7 @@ static struct pane *xcb_display_init(const char *d safe, p = pane_register(pane_root(focus), 1, &xcb_handle.c); if (!p) return NULL; - xd = &p->data; + xd = p->data; xd->motion_blocked = True; xd->in_focus = True; diff --git a/doc-dir.c b/doc-dir.c index a601404d..778ceee4 100644 --- a/doc-dir.c +++ b/doc-dir.c @@ -135,7 +135,7 @@ DEF_CMD(dir_new) p = doc_register(ci->home, &dir_handle.c); if (!p) return Efail; - dr = &p->doc_data; + dr = p->doc_data; INIT_LIST_HEAD(&dr->ents); dr->fname = NULL; @@ -153,7 +153,7 @@ DEF_CMD(dir_load_file) { int fd = ci->num2; const char *name = ci->str; - struct directory *dr = &ci->home->doc_data; + struct directory *dr = ci->home->doc_data; struct list_head new; struct dir_ent *de1, *de2; struct mark *prev, *m; @@ -277,7 +277,7 @@ DEF_CMD(dir_load_file) DEF_CMD(dir_revisited) { - struct directory *dr = &ci->home->doc_data; + struct directory *dr = ci->home->doc_data; struct stat st; if (ci->num <= 0) @@ -302,7 +302,7 @@ DEF_CMD(dir_same_file) { int fd = ci->num2; struct stat stb; - struct directory *dr = &ci->home->doc_data; + struct directory *dr = ci->home->doc_data; if (!dr->fname) return 0; @@ -318,7 +318,7 @@ DEF_CMD(dir_same_file) static inline wint_t dir_next(struct pane *p safe, struct doc_ref *r safe, bool bytes) { - struct directory *dr = &p->doc_data; + struct directory *dr = p->doc_data; struct dir_ent *d = r->d; if (d == NULL) @@ -336,7 +336,7 @@ static inline wint_t dir_next(struct pane *p safe, struct doc_ref *r safe, bool static inline wint_t dir_prev(struct pane *p safe, struct doc_ref *r safe, bool bytes) { - struct directory *dr = &p->doc_data; + struct directory *dr = p->doc_data; struct dir_ent *d = r->d; if (d == list_first_entry(&dr->ents, struct dir_ent, lst)) @@ -359,7 +359,7 @@ DEF_CMD(dir_char) DEF_CMD(dir_set_ref) { - struct directory *dr = &ci->home->doc_data; + struct directory *dr = ci->home->doc_data; struct mark *m = ci->mark; if (!m) @@ -491,7 +491,7 @@ static const char *_dir_get_attr(struct pane *home safe, struct mark *m safe, const char *attr safe) { - struct directory *dr = &home->doc_data; + struct directory *dr = home->doc_data; struct dir_ent *de; de = m->ref.d; @@ -652,7 +652,7 @@ DEF_CMD(dir_doc_set_attr) DEF_CMD(dir_get_attr) { - struct directory *dr = &ci->home->doc_data; + struct directory *dr = ci->home->doc_data; const char *attr = ci->str; const char *val; @@ -683,7 +683,7 @@ DEF_CMD(dir_get_attr) DEF_CMD(dir_val_marks) { - struct directory *dr = &ci->home->doc_data; + struct directory *dr = ci->home->doc_data; struct dir_ent *de; int found; @@ -727,7 +727,7 @@ DEF_CMD(dir_val_marks) DEF_CMD(dir_destroy) { - struct directory *dr = &ci->home->doc_data; + struct directory *dr = ci->home->doc_data; while (!list_empty(&dr->ents)) { struct dir_ent *de = list_entry(dr->ents.next, diff --git a/doc-docs.c b/doc-docs.c index d268d2bf..47970ff2 100644 --- a/doc-docs.c +++ b/doc-docs.c @@ -68,7 +68,7 @@ static void docs_demark(struct pane *d safe, struct pane *p safe) /* This document (p) is about to be moved in the list (d->collection). * Any mark pointing at it is moved forward */ - struct docs *doc = &d->doc_data; + struct docs *doc = d->doc_data; struct mark *m, *first = NULL; struct pane *next; struct pane *col = doc->collection; @@ -100,7 +100,7 @@ static void docs_enmark(struct pane *d safe, struct pane *p safe) /* This document has just been added to the list. * any mark pointing just past it is moved back. */ - struct docs *doc = &d->doc_data; + struct docs *doc = d->doc_data; struct mark *m, *first = NULL; struct pane *next; struct pane *col = doc->collection; @@ -177,7 +177,7 @@ static void check_name(struct docs *docs safe, struct pane *pane safe) static void doc_checkname(struct pane *p safe, struct pane *d safe, int n) { - struct docs *ds = &d->doc_data; + struct docs *ds = d->doc_data; ASSERT(p->parent->handle == &docs_aux.c); check_name(ds, p); if (n) { @@ -267,7 +267,7 @@ DEF_CMD(docs_callback_complete) DEF_CMD(docs_callback_byname) { - struct docs *doc = &ci->home->doc_data; + struct docs *doc = ci->home->doc_data; struct pane *p; if (ci->str == NULL || strcmp(ci->str, "*Documents*") == 0) @@ -284,7 +284,7 @@ DEF_CMD(docs_callback_byname) DEF_CMD(docs_callback_byfd) { - struct docs *doc = &ci->home->doc_data; + struct docs *doc = ci->home->doc_data; struct pane *p; list_for_each_entry(p, &doc->collection->children, siblings) { @@ -297,7 +297,7 @@ DEF_CMD(docs_callback_byfd) DEF_CMD(docs_callback_byeach) { - struct docs *doc = &ci->home->doc_data; + struct docs *doc = ci->home->doc_data; struct pane *p; list_for_each_entry(p, &doc->collection->children, siblings) { @@ -311,7 +311,7 @@ DEF_CMD(docs_callback_byeach) DEF_CMD(docs_callback_choose) { - struct docs *doc = &ci->home->doc_data; + struct docs *doc = ci->home->doc_data; struct pane *choice = NULL, *last = NULL; struct pane *p; @@ -343,7 +343,7 @@ DEF_CMD(docs_callback_choose) DEF_CMD(docs_callback_saveall) { - struct docs *doc = &ci->home->doc_data; + struct docs *doc = ci->home->doc_data; struct pane *p; int dirlen = ci->str ? (int)strlen(ci->str) : -1; @@ -364,7 +364,7 @@ DEF_CMD(docs_callback_saveall) DEF_CMD(docs_callback_modified) { - struct docs *doc = &ci->home->doc_data; + struct docs *doc = ci->home->doc_data; struct pane *p; p = home_call_ret(pane, ci->home, "doc:attach-view", ci->focus, @@ -393,7 +393,7 @@ DEF_CMD(docs_callback_modified) DEF_CMD(docs_callback_appeared) { - struct docs *doc = &ci->home->doc_data; + struct docs *doc = ci->home->doc_data; struct pane *p; /* Always return Efallthrough so other handlers get a chance */ @@ -439,7 +439,7 @@ DEF_CMD(doc_revisit) { struct pane *p = ci->focus; struct pane *dp = ci->home->data; - struct docs *docs = &dp->doc_data; + struct docs *docs = dp->doc_data; if (!p) return Einval; @@ -453,7 +453,7 @@ DEF_CMD(doc_revisit) static inline wint_t docs_next(struct pane *home safe, struct doc_ref *r safe, bool bytes) { - struct docs *d = &home->doc_data; + struct docs *d = home->doc_data; struct pane *p = r->p; if (p == NULL) @@ -468,7 +468,7 @@ static inline wint_t docs_next(struct pane *home safe, struct doc_ref *r safe, b } static inline wint_t docs_prev(struct pane *home safe, struct doc_ref *r safe, bool bytes) { - struct docs *d = &home->doc_data; + struct docs *d = home->doc_data; struct pane *p = r->p; if (list_empty(&d->collection->children)) @@ -492,7 +492,7 @@ DEF_CMD(docs_char) DEF_CMD(docs_set_ref) { - struct docs *d = &ci->home->doc_data; + struct docs *d = ci->home->doc_data; struct mark *m = ci->mark; if (!m) @@ -751,7 +751,7 @@ DEF_CMD(docs_shares_ref) DEF_CMD(docs_val_marks) { - struct docs *d = &ci->home->doc_data; + struct docs *d = ci->home->doc_data; struct pane *p; int found; @@ -795,7 +795,7 @@ DEF_CMD(docs_val_marks) DEF_CMD(docs_close) { - struct docs *docs = &ci->home->doc_data; + struct docs *docs = ci->home->doc_data; call_comm("global-set-command-prefix", ci->home, &edlib_noop, 0, NULL, "docs:"); @@ -887,7 +887,7 @@ DEF_CMD(attach_docs) pd = doc_register(ci->home, &docs_handle.c); if (!pd) return Efail; - doc = &pd->doc_data; + doc = pd->doc_data; doc->doc.name = strdup("*Documents*"); paux = pane_register(ci->home, 0, &docs_aux.c, pd); if (!paux) { diff --git a/doc-email.c b/doc-email.c index ca1df7c8..3539a5bd 100644 --- a/doc-email.c +++ b/doc-email.c @@ -960,7 +960,7 @@ out: DEF_CMD(email_view_free) { - struct email_view *evi = &ci->home->data; + struct email_view *evi = ci->home->data; free(evi->invis); return 1; @@ -984,7 +984,7 @@ static int count_buttons(struct pane *p safe, struct mark *m safe) static inline wint_t email_next(struct pane *p safe, struct mark *m safe, struct doc_ref *r safe, bool bytes) { - struct email_view *evi = &p->data; + struct email_view *evi = p->data; bool move = r == &m->ref; wint_t ret; int n = -1; @@ -1010,7 +1010,7 @@ static inline wint_t email_next(struct pane *p safe, struct mark *m safe, static inline wint_t email_prev(struct pane *p safe, struct mark *m safe, struct doc_ref *r safe, bool bytes) { - struct email_view *evi = &p->data; + struct email_view *evi = p->data; bool move = r == &m->ref; wint_t ret; int n = -1; @@ -1046,7 +1046,7 @@ DEF_CMD(email_content) * what is invisible, marking all spacers as invisible */ struct pane *p = ci->home; - struct email_view *evi = &p->data; + struct email_view *evi = p->data; char *invis2 = strsave(p, evi->invis); int i; @@ -1062,7 +1062,7 @@ DEF_CMD(email_content) DEF_CMD(email_set_ref) { struct pane *p = ci->home; - struct email_view *evi = &p->data; + struct email_view *evi = p->data; if (!ci->mark) return Enoarg; @@ -1074,7 +1074,7 @@ DEF_CMD(email_set_ref) DEF_CMD(email_step_part) { struct pane *p = ci->home; - struct email_view *evi = &p->data; + struct email_view *evi = p->data; if (!ci->mark) return Enoarg; @@ -1086,7 +1086,7 @@ DEF_CMD(email_view_get_attr) { int p; char *v; - struct email_view *evi = &ci->home->data; + struct email_view *evi = ci->home->data; if (!ci->str || !ci->mark) return Enoarg; @@ -1112,7 +1112,7 @@ DEF_CMD(email_view_get_attr) DEF_CMD(email_view_set_attr) { int p; - struct email_view *evi = &ci->home->data; + struct email_view *evi = ci->home->data; if (!ci->str || !ci->mark) return Enoarg; @@ -1197,7 +1197,7 @@ DEF_CMD(attach_email_view) p = pane_register(ci->focus, 0, &email_view_handle.c); if (!p) return Efail; - evi = &p->data; + evi = p->data; evi->parts = n; evi->invis = calloc(n+1, sizeof(char)); for (i = 0; i < n; i++) { diff --git a/doc-list.c b/doc-list.c index 68d346b3..1aef17a4 100644 --- a/doc-list.c +++ b/doc-list.c @@ -39,7 +39,7 @@ struct list { static inline wint_t list_next(struct pane *p safe, struct doc_ref *r safe, bool bytes) { - struct list *l = &p->doc_data; + struct list *l = p->doc_data; if (r->p == NULL) return WEOF; @@ -53,7 +53,7 @@ static inline wint_t list_next(struct pane *p safe, struct doc_ref *r safe, bool static inline wint_t list_prev(struct pane *p safe, struct doc_ref *r safe, bool bytes) { - struct list *l = &p->doc_data; + struct list *l = p->doc_data; if (r->p == list_first_entry_or_null(&l->content, struct elmnt, list)) return WEOF; @@ -72,7 +72,7 @@ DEF_CMD(list_char) DEF_CMD(list_set_ref) { - struct list *l = &ci->home->doc_data; + struct list *l = ci->home->doc_data; struct mark *m = ci->mark; if (!m) @@ -129,7 +129,7 @@ DEF_CMD(list_shares_ref) DEF_CMD(list_add_elmnt) { - struct list *l = &ci->home->doc_data; + struct list *l = ci->home->doc_data; struct mark *m = ci->mark; struct elmnt *e; @@ -158,7 +158,7 @@ static char *key(struct list_head *le, const void *data) DEF_CMD(list_sort) { - struct list *l = &ci->home->doc_data; + struct list *l = ci->home->doc_data; struct mark *m; if (!ci->str) @@ -183,7 +183,7 @@ DEF_CMD(list_new) p = doc_register(ci->home, &list_handle.c); if (!p) return Efail; - l = &p->doc_data; + l = p->doc_data; INIT_LIST_HEAD(&l->content); return comm_call(ci->comm2, "callback:doc", p); @@ -191,7 +191,7 @@ DEF_CMD(list_new) DEF_CMD(list_close) { - struct list *l = &ci->home->doc_data; + struct list *l = ci->home->doc_data; struct elmnt *e; while ((e = list_first_entry_or_null(&l->content, diff --git a/doc-multipart.c b/doc-multipart.c index a2f6294d..319ea993 100644 --- a/doc-multipart.c +++ b/doc-multipart.c @@ -218,7 +218,7 @@ static void mp_normalize(struct mp_info *mpi safe, struct mark *m safe, DEF_CMD(mp_close) { - struct mp_info *mpi = &ci->home->doc_data; + struct mp_info *mpi = ci->home->doc_data; int i; struct mark *m; @@ -240,7 +240,7 @@ DEF_CMD(mp_close) DEF_CMD(mp_free) { - struct mp_info *mpi = &ci->home->doc_data; + struct mp_info *mpi = ci->home->doc_data; free(mpi->parts); return 1; @@ -248,7 +248,7 @@ DEF_CMD(mp_free) DEF_CMD(mp_set_ref) { - struct mp_info *mpi = &ci->home->doc_data; + struct mp_info *mpi = ci->home->doc_data; const char *vis = ci->str && (int)strlen(ci->str) >= mpi->nparts ? ci->str : NULL; int ret = 1; @@ -290,7 +290,7 @@ static inline wint_t multipart_next_prev(struct pane *home safe, struct mark *ma int forward, bool bytes, const char *str) { int move = r == &mark->ref; - struct mp_info *mpi = &home->doc_data; + struct mp_info *mpi = home->doc_data; struct mark *m1 = NULL; struct mark *m = mark; const char *vis = str && (int)strlen(str) >= mpi->nparts ? @@ -380,7 +380,7 @@ DEF_CMD(mp_step_part) * Return part number plus 1. * If ->str is given, only consider visible parts. */ - struct mp_info *mpi = &ci->home->doc_data; + struct mp_info *mpi = ci->home->doc_data; struct mark *m = ci->mark; const char *vis = ci->str && (int)strlen(ci->str) >= mpi->nparts ? ci->str : NULL; @@ -472,7 +472,7 @@ DEF_CMD(mp_content) /* Call doc:content on any visible docs in the range. * Callback must re-wrap any marks */ - struct mp_info *mpi = &ci->home->doc_data; + struct mp_info *mpi = ci->home->doc_data; struct mp_cb cb; struct mark *m, *m2; const char *invis = ci->str; @@ -521,7 +521,7 @@ DEF_CMD(mp_content) DEF_CMD(mp_attr) { - struct mp_info *mpi = &ci->home->doc_data; + struct mp_info *mpi = ci->home->doc_data; struct mark *m1 = NULL; struct part *p; int ret = Efallthrough; @@ -590,7 +590,7 @@ DEF_CMD(mp_attr) DEF_CMD(mp_set_attr) { - struct mp_info *mpi = &ci->home->doc_data; + struct mp_info *mpi = ci->home->doc_data; struct part *p; struct mark *m = ci->mark; struct mark *m1; @@ -635,7 +635,7 @@ DEF_CMD(mp_notify_close) /* sub-document has been closed. * Can we survive? or should we just shut down? */ - struct mp_info *mpi = &ci->home->doc_data; + struct mp_info *mpi = ci->home->doc_data; int i; for (i = 0; i < mpi->nparts; i++) @@ -678,7 +678,7 @@ static void mp_resize(struct mp_info *mpi safe, int size) DEF_CMD(mp_add) { - struct mp_info *mpi = &ci->home->doc_data; + struct mp_info *mpi = ci->home->doc_data; struct mark *m; int n; @@ -707,7 +707,7 @@ DEF_CMD(mp_add) DEF_CMD(mp_forward_by_num) { - struct mp_info *mpi = &ci->home->doc_data; + struct mp_info *mpi = ci->home->doc_data; struct mark *m1 = NULL, *m2 = NULL; struct part *p; const char *key; @@ -740,7 +740,7 @@ DEF_CMD(mp_forward_by_num) DEF_CMD(mp_get_part) { - struct mp_info *mpi = &ci->home->doc_data; + struct mp_info *mpi = ci->home->doc_data; struct part *p; int d = ci->num; @@ -758,7 +758,7 @@ DEF_CMD(mp_forward) * ci->mark2. * ci->mark is forwarded if it is in same document */ - struct mp_info *mpi = &ci->home->doc_data; + struct mp_info *mpi = ci->home->doc_data; struct part *p; struct mark *m1, *m2; const char *key; @@ -864,7 +864,7 @@ DEF_CMD(attach_mp) h = doc_register(ci->home, &mp_handle.c); if (!h) return Efail; - mpi = &h->doc_data; + mpi = h->doc_data; mpi->doc.refcnt = mp_mark_refcnt; attr_set_str(&h->attrs, "render-default", "text"); diff --git a/doc-text.c b/doc-text.c index 6ebcd2f0..0a315876 100644 --- a/doc-text.c +++ b/doc-text.c @@ -226,7 +226,7 @@ text_new_alloc(struct text *t safe, int size) static bool check_file_changed(struct pane *p safe) { - struct text *t = &p->doc_data; + struct text *t = p->doc_data; struct stat st; if (t->file_changed) @@ -253,7 +253,7 @@ static bool check_file_changed(struct pane *p safe) DEF_CMD(text_readonly) { struct doc *d = ci->home->data; - struct text *t = &ci->home->doc_data; + struct text *t = ci->home->doc_data; if (t->file_changed && !d->readonly && ci->num) t->file_changed = 2; @@ -286,7 +286,7 @@ DEF_CMD(text_load_file) struct text_alloc *a; struct text_chunk *c = NULL; int len; - struct text *t = &ci->home->doc_data; + struct text *t = ci->home->doc_data; if (t->saved != t->undo) return Einval; @@ -389,7 +389,7 @@ err: DEF_CMD(text_insert_file) { - struct text *t = &ci->home->doc_data; + struct text *t = ci->home->doc_data; struct mark *pm = ci->mark, *early; struct text_alloc *a; int len; @@ -435,7 +435,7 @@ DEF_CMD(text_insert_file) static bool do_text_output_file(struct pane *p safe, struct doc_ref *start, struct doc_ref *end, int fd) { - struct text *t = &p->doc_data; + struct text *t = p->doc_data; struct text_chunk *c; int offset = 0; @@ -469,7 +469,7 @@ static bool do_text_write_file(struct pane *p safe, struct doc_ref *start, * Create a temp file with #basename#~, write to that, * copy mode across, fsync and then rename */ - struct text *t = &p->doc_data; + struct text *t = p->doc_data; char *tempname = malloc(strlen(fname) + 3 + 10); const char *base; char *tbase; @@ -607,7 +607,7 @@ static void autosaves_record(struct pane *p safe, const char *path safe, static void do_text_autosave(struct pane *p safe) { - struct text *t = &p->doc_data; + struct text *t = p->doc_data; int fd = -1; if (!t->fname) @@ -681,7 +681,7 @@ DEF_CMD(text_autosave_tick) static void text_check_autosave(struct pane *p safe) { - struct text *t = &p->doc_data; + struct text *t = p->doc_data; if (t->undo == t->saved) t->as.changes = 0; @@ -702,7 +702,7 @@ static void text_check_autosave(struct pane *p safe) DEF_CMD(text_save_file) { struct doc *d = ci->home->data; - struct text *t = &ci->home->doc_data; + struct text *t = ci->home->doc_data; int ret; char *msg; int change_status = 0; @@ -755,7 +755,7 @@ DEF_CMD(text_write_file) DEF_CMD(text_same_file) { - struct text *t = &ci->home->doc_data; + struct text *t = ci->home->doc_data; struct stat stb, stb2; int fd = ci->num2; @@ -1310,7 +1310,7 @@ static void text_redo(struct text *t safe, struct text_edit *e safe, static bool check_readonly(const struct cmd_info *ci safe) { struct doc *d = ci->home->data; - struct text *t = &ci->home->doc_data; + struct text *t = ci->home->doc_data; if (t->undo == t->saved && check_file_changed(ci->home) && @@ -1332,7 +1332,7 @@ DEF_CMD(text_reundo) struct text_edit *ed = NULL; bool first = 1; int status; - struct text *t = &ci->home->doc_data; + struct text *t = ci->home->doc_data; if (!m) return Enoarg; @@ -1592,7 +1592,7 @@ static void text_add_str(struct text *t safe, struct mark *pm safe, static inline wint_t text_next(struct pane *p safe, struct doc_ref *r safe, bool bytes) { - struct text *t = &p->doc_data; + struct text *t = p->doc_data; wint_t ret = WERR; const char *c; @@ -1613,7 +1613,7 @@ static inline wint_t text_next(struct pane *p safe, struct doc_ref *r safe, bool static inline wint_t text_prev(struct pane *p safe, struct doc_ref *r safe, bool bytes) { - struct text *t = &p->doc_data; + struct text *t = p->doc_data; wint_t ret; const char *c; @@ -1694,7 +1694,7 @@ DEF_CMD(text_new) p = doc_register(ci->home, &text_handle.c); if (!p) return Efail; - t = &p->doc_data; + t = p->doc_data; t->alloc = safe_cast NULL; INIT_LIST_HEAD(&t->text); t->saved = t->undo = t->redo = NULL; @@ -1751,7 +1751,7 @@ DEF_CMD(text_content) { struct mark *from = ci->mark, *to = ci->mark2; struct mark *m; - struct text *t = &ci->home->doc_data; + struct text *t = ci->home->doc_data; struct text_chunk *c, *first, *last; int bytes = strcmp(ci->key, "doc:content-bytes") == 0; int l = 0, head, tail; @@ -1886,7 +1886,7 @@ DEF_CMD(text_debug_mark) DEF_CMD(text_val_marks) { - struct text *t = &ci->home->doc_data; + struct text *t = ci->home->doc_data; struct text_chunk *c; int found; @@ -1930,7 +1930,7 @@ DEF_CMD(text_val_marks) DEF_CMD(text_set_ref) { struct mark *m = ci->mark; - struct text *t = &ci->home->doc_data; + struct text *t = ci->home->doc_data; if (!m) return Enoarg; @@ -1986,7 +1986,7 @@ static int text_retreat_towards(struct text *t safe, struct doc_ref *ref safe, */ if (ref->c != target->c && (!ref->c || ref->o <= ref->c->start)) - if (text_prev(safe_cast container_of(t, struct pane, doc_data), ref, 1) == WEOF) + if (text_prev(safe_cast container_of(t, struct pane, doc_data[0]), ref, 1) == WEOF) return 0; if (ref->c == target->c) { @@ -2161,7 +2161,7 @@ static void text_add_attrs(struct attrset **attrs safe, DEF_CMD(text_replace) { - struct text *t = &ci->home->doc_data; + struct text *t = ci->home->doc_data; struct mark *pm = ci->mark2; struct mark *end = ci->mark; const char *str = ci->str; @@ -2250,7 +2250,7 @@ static struct attrset *text_attrset(struct pane *p safe, struct mark *m safe, int *op safe) { struct text_chunk *c; - struct text *t = &p->doc_data; + struct text *t = p->doc_data; unsigned int o; c = m->ref.c; @@ -2301,7 +2301,7 @@ DEF_CMD(text_doc_get_attr) DEF_CMD(text_get_attr) { - struct text *t = &ci->home->doc_data; + struct text *t = ci->home->doc_data; const char *attr = ci->str; const char *val; @@ -2379,7 +2379,7 @@ DEF_CMD(text_set_attr) const char *attr = ci->str; const char *val = ci->str2; struct text_chunk *c, *c2; - struct text *t = &ci->home->doc_data; + struct text *t = ci->home->doc_data; unsigned int o, o2; if (!attr) @@ -2420,7 +2420,7 @@ DEF_CMD(text_set_attr) DEF_CMD(text_modified) { - struct text *t = &ci->home->doc_data; + struct text *t = ci->home->doc_data; if (ci->num == 0) { /* toggle status */ @@ -2441,7 +2441,7 @@ DEF_CMD(text_modified) DEF_CMD(text_revisited) { - struct text *t = &ci->home->doc_data; + struct text *t = ci->home->doc_data; if (ci->num <= 0) /* Being buried, not visited */ @@ -2518,7 +2518,7 @@ static void text_cleanout(struct text *t safe) DEF_CMD(text_destroy) { - struct text *t = &ci->home->doc_data; + struct text *t = ci->home->doc_data; text_cleanout(t); return Efallthrough; @@ -2529,7 +2529,7 @@ DEF_CMD(text_clear) /* Clear the document, including undo/redo records * i.e. free all text */ - struct text *t = &ci->home->doc_data; + struct text *t = ci->home->doc_data; struct mark *m; text_cleanout(t); @@ -2546,7 +2546,7 @@ DEF_CMD(text_clear) DEF_CMD(text_free) { - struct text *t = &ci->home->doc_data; + struct text *t = ci->home->doc_data; free((void*)t->fname); free((void*)t->autosave_name); diff --git a/lib-askpass.c b/lib-askpass.c index c8805914..e2de20d5 100644 --- a/lib-askpass.c +++ b/lib-askpass.c @@ -29,7 +29,7 @@ DEF_LOOKUP_CMD(askpass_handle, askpass_map); DEF_CMD(askpass_refresh_view) { struct buf b; - struct apinfo *ai = &ci->home->data; + struct apinfo *ai = ci->home->data; int shift = 0; int i; @@ -54,7 +54,7 @@ DEF_CMD(askpass_refresh_view) DEF_CMD(askpass_key) { const char *k = ksuffix(ci, "K-"); - struct apinfo *ai = &ci->home->data; + struct apinfo *ai = ci->home->data; buf_concat(&ai->b, k); pane_damaged(ci->home, DAMAGED_VIEW); @@ -63,7 +63,7 @@ DEF_CMD(askpass_key) DEF_CMD(askpass_bs) { - struct apinfo *ai = &ci->home->data; + struct apinfo *ai = ci->home->data; if (ai->b.len > 0) ai->b.len = utf8_round_len(ai->b.b, ai->b.len-1); @@ -78,7 +78,7 @@ DEF_CMD(askpass_ignore) DEF_CMD(askpass_done) { - struct apinfo *ai = &ci->home->data; + struct apinfo *ai = ci->home->data; comm_call(ai->c, "cb", ci->focus, ai->b.len, NULL, buf_final(&ai->b)); @@ -89,7 +89,7 @@ DEF_CMD(askpass_done) DEF_CMD(askpass_abort) { - struct apinfo *ai = &ci->home->data; + struct apinfo *ai = ci->home->data; memset(ai->b.b, 0, ai->b.size); comm_call(ai->c, "cb", ci->focus, -1); @@ -123,9 +123,9 @@ DEF_CMD(askpass_attach) attr_set_str(&p->attrs, "pane-title", "Ask Password"); - p->data.msg = strdup(ci->str); - p->data.c = command_get(ci->comm2); - buf_init(&p->data.b); + p->data->msg = strdup(ci->str); + p->data->c = command_get(ci->comm2); + buf_init(&p->data->b); pane_damaged(p, DAMAGED_VIEW); return 1; @@ -137,7 +137,7 @@ fail: DEF_CMD(askpass_close) { - struct apinfo *ai = &ci->home->data; + struct apinfo *ai = ci->home->data; free(ai->msg); ai->msg = safe_cast NULL; diff --git a/lib-crop.c b/lib-crop.c index 6bbd9586..c7ebe3e8 100644 --- a/lib-crop.c +++ b/lib-crop.c @@ -61,7 +61,7 @@ static bool crop(struct mark *m, struct crop_data *cd safe) DEF_CMD(crop_close) { - struct crop_data *cd = &ci->home->data; + struct crop_data *cd = ci->home->data; mark_free(cd->start); mark_free(cd->end); @@ -71,7 +71,7 @@ DEF_CMD(crop_close) DEF_CMD(crop_write) { struct pane *p = ci->home->parent; - struct crop_data *cd = &ci->home->data; + struct crop_data *cd = ci->home->data; return home_call(p, ci->key, ci->focus, ci->num, ci->mark ?: cd->start, @@ -84,7 +84,7 @@ static inline wint_t crop_next(struct pane *home safe, struct mark *mark safe, struct doc_ref *r, bool bytes) { struct pane *p = home->parent; - struct crop_data *cd = &home->data; + struct crop_data *cd = home->data; int move = r == &mark->ref; int ret; @@ -107,7 +107,7 @@ static inline wint_t crop_prev(struct pane *home safe, struct mark *mark safe, struct doc_ref *r, bool bytes) { struct pane *p = home->parent; - struct crop_data *cd = &home->data; + struct crop_data *cd = home->data; int move = r == &mark->ref; int ret; @@ -134,7 +134,7 @@ DEF_CMD(crop_char) DEF_CMD(crop_clip) { - struct crop_data *cd = &ci->home->data; + struct crop_data *cd = ci->home->data; mark_clip(cd->start, ci->mark, ci->mark2, !!ci->num); mark_clip(cd->end, ci->mark, ci->mark2, !!ci->num); @@ -143,7 +143,7 @@ DEF_CMD(crop_clip) DEF_CMD(crop_content) { - struct crop_data *cd = &ci->home->data; + struct crop_data *cd = ci->home->data; struct mark *m, *m2; int ret; @@ -167,7 +167,7 @@ DEF_CMD(crop_content) DEF_CMD(crop_generic) { struct pane *p = ci->home->parent; - struct crop_data *cd = &ci->home->data; + struct crop_data *cd = ci->home->data; int ret; if (!ci->mark && !ci->mark2) @@ -205,7 +205,7 @@ DEF_CMD(crop_attach) if (!p) return Efail; - cd = &p->data; + cd = p->data; cd->start = mark_dup(ci->mark); cd->end = mark_dup(ci->mark2); diff --git a/lib-renderline.c b/lib-renderline.c index 515e4322..abe5f5a4 100644 --- a/lib-renderline.c +++ b/lib-renderline.c @@ -364,7 +364,7 @@ static inline struct call_return do_measure(struct pane *p safe, int splitpos, int len, int maxwidth) { - struct rline_data *rd = &p->data; + struct rline_data *rd = p->data; struct call_return cr; char tb[] = " "; char *str = rd->line + ri->start + splitpos; @@ -403,7 +403,7 @@ static inline struct call_return measure_str(struct pane *p safe, char *str safe, const char *attr) { - struct rline_data *rd = &p->data; + struct rline_data *rd = p->data; return call_ret(all, "Draw:text-size", p, -1, NULL, str, @@ -416,7 +416,7 @@ static inline void do_draw(struct pane *p safe, int offset, int x, int y) { - struct rline_data *rd = &p->data; + struct rline_data *rd = p->data; char tmp; char *str; int len; @@ -472,7 +472,7 @@ static inline void draw_wrap(struct pane *p safe, char *str safe, int x, int y) { - struct rline_data *rd = &p->data; + struct rline_data *rd = p->data; home_call(focus, "Draw:text", p, -1, NULL, str, @@ -515,7 +515,7 @@ static int measure_line(struct pane *p safe, struct pane *focus safe, int offset * 3 if both. * 0 if neither */ - struct rline_data *rd = &p->data; + struct rline_data *rd = p->data; struct render_item *ri, *wraprl; int shift_left = pane_attr_get_int(focus, "render-wrap", -1); bool wrap = shift_left < 0; @@ -825,7 +825,7 @@ static int measure_line(struct pane *p safe, struct pane *focus safe, int offset static void draw_line(struct pane *p safe, struct pane *focus safe, int offset) { - struct rline_data *rd = &p->data; + struct rline_data *rd = p->data; struct render_item *ri; char *wrap_tail = rd->wrap_tail ?: "\\"; char *wrap_head = rd->wrap_head ?: ""; @@ -885,7 +885,7 @@ static int find_xy(struct pane *p safe, struct pane *focus safe, * We do not consider the eol render_item */ struct call_return cr; - struct rline_data *rd = &p->data; + struct rline_data *rd = p->data; struct render_item *r, *ri = NULL; int splitpos = 0; int start = 0; @@ -943,7 +943,7 @@ static struct xy find_curs(struct pane *p safe, int offset, const char **cursatt struct xy xy = {0,0}; int split; int st; - struct rline_data *rd = &p->data; + struct rline_data *rd = p->data; struct render_item *r, *ri = NULL; for (r = rd->content; r; r = r->next) { @@ -1033,7 +1033,7 @@ static int render_image(struct pane *p safe, struct pane *focus safe, int dodraw, int offset, int want_xypos, short x, short y) { - struct rline_data *rd = &p->data; + struct rline_data *rd = p->data; char *fname = NULL; const char *orig_line = line; short width, height; @@ -1147,7 +1147,7 @@ static int render_image(struct pane *p safe, struct pane *focus safe, DEF_CMD(renderline_draw) { - struct rline_data *rd = &ci->home->data; + struct rline_data *rd = ci->home->data; struct xy xy; int offset = -1; @@ -1170,7 +1170,7 @@ DEF_CMD(renderline_draw) DEF_CMD(renderline_refresh) { - struct rline_data *rd = &ci->home->data; + struct rline_data *rd = ci->home->data; int offset = -1; if (rd->curspos >= 0) @@ -1187,7 +1187,7 @@ DEF_CMD(renderline_refresh) DEF_CMD(renderline_measure) { - struct rline_data *rd = &ci->home->data; + struct rline_data *rd = ci->home->data; int ret; if (rd->image) @@ -1216,7 +1216,7 @@ DEF_CMD(renderline_measure) DEF_CMD(renderline_findxy) { - struct rline_data *rd = &ci->home->data; + struct rline_data *rd = ci->home->data; const char *xyattr = NULL; int pos; @@ -1240,7 +1240,7 @@ DEF_CMD(renderline_findxy) DEF_CMD(renderline_get) { - struct rline_data *rd = &ci->home->data; + struct rline_data *rd = ci->home->data; char buf[20]; const char *val = buf; @@ -1305,7 +1305,7 @@ static char *cvt(char *str safe) DEF_CMD(renderline_set) { - struct rline_data *rd = &ci->home->data; + struct rline_data *rd = ci->home->data; const char *old = rd->line; char *prefix = pane_attr_get(ci->focus, "prefix"); bool word_wrap = pane_attr_get_int(ci->focus, "word-wrap", 0) != 0; @@ -1337,7 +1337,7 @@ DEF_CMD(renderline_set) DEF_CMD(renderline_close) { - struct rline_data *rd = &ci->home->data; + struct rline_data *rd = ci->home->data; struct render_item *ri = rd->content; free((void*)rd->line); @@ -1377,7 +1377,7 @@ DEF_CMD(renderline_attach) p = pane_register(ci->focus, ci->num, &renderline_handle.c); if (!p) return Efail; - rd = &p->data; + rd = p->data; rd->line = strdup(ETX); // Imposible string return comm_call(ci->comm2, "cb", p); diff --git a/render-format.c b/render-format.c index d9a2a504..37308e16 100644 --- a/render-format.c +++ b/render-format.c @@ -237,7 +237,7 @@ DEF_CMD(render_line_prev) DEF_CMD(format_free) { - struct rf_data *rf = &ci->home->data; + struct rf_data *rf = ci->home->data; free(rf->attr_cache); free(rf->fields); @@ -363,7 +363,7 @@ static int field_size(struct pane *home safe, struct pane *focus safe, struct mark *m safe, int field, const char **valp safe) { - struct rf_data *rd = &home->data; + struct rf_data *rd = home->data; struct rf_field *rf; const char *val; int l; @@ -411,7 +411,7 @@ static int field_size(struct pane *home safe, struct pane *focus safe, static int normalize(struct pane *home safe, struct pane *focus safe, struct mark *m safe, int inc) { - struct rf_data *rd = &home->data; + struct rf_data *rd = home->data; int index = m->ref.i; unsigned short f = FIELD_NUM(index); unsigned short o = FIELD_OFFSET(index); @@ -504,7 +504,7 @@ static void update_offset(struct mark *m safe, struct rf_data *rd safe, static void prev_line(struct pane *home safe, struct mark *m safe) { - struct rf_data *rd = &home->data; + struct rf_data *rd = home->data; /* Move m to end of previous line, just before the newline */ if (doc_prev(home->parent, m) == WEOF) { @@ -518,7 +518,7 @@ static void prev_line(struct pane *home safe, struct mark *m safe) static void next_line(struct pane *home safe, struct mark *m safe) { - struct rf_data *rd = &home->data; + struct rf_data *rd = home->data; doc_next(home->parent, m); update_offset(m, rd, MAKE_INDEX(0, 0)); @@ -529,7 +529,7 @@ static inline wint_t format_next_prev(struct pane *home safe, struct pane *focus struct mark *m safe, struct doc_ref *r safe, int forward, bool bytes) { - struct rf_data *rd = &home->data; + struct rf_data *rd = home->data; struct rf_field *rf; int move = r == &m->ref; int f, o; @@ -640,7 +640,7 @@ DEF_CMD(format_content2) */ struct pane *home = ci->home; struct pane *focus = ci->focus; - struct rf_data *rd = &home->data; + struct rf_data *rd = home->data; struct rf_field *rf; struct mark *m = ci->mark; struct mark *end = ci->mark2; @@ -772,7 +772,7 @@ DEF_CMD(format_attr) * Also "format:plain" which formats the line directly * without the cost of all the lib-markup machinery. */ - struct rf_data *rd = &ci->home->data; + struct rf_data *rd = ci->home->data; struct mark *m = ci->mark; int previ; int f0, f; @@ -831,7 +831,7 @@ DEF_CMD(format_attr) DEF_CMD(format_map) { - struct rf_data *rd = &ci->home->data; + struct rf_data *rd = ci->home->data; struct mark *m = ci->mark; int idx, previ; int f0, f; @@ -886,7 +886,7 @@ DEF_CMD(format_map) DEF_CMD(render_line_prev2) { - struct rf_data *rd = &ci->home->data; + struct rf_data *rd = ci->home->data; struct mark *m = ci->mark; struct mark *m2, *mn;