]> git.neil.brown.name Git - edlib.git/commitdiff
Add 'void *misc' field to cmd_info
authorNeilBrown <neil@brown.name>
Fri, 27 Nov 2015 01:05:10 +0000 (12:05 +1100)
committerNeilBrown <neil@brown.name>
Fri, 27 Nov 2015 01:05:10 +0000 (12:05 +1100)
Use this for passing the 'struct stat' for doc:same-file.

Signed-off-by: NeilBrown <neil@brown.name>
core-doc.c
core.h
doc-dir.c
doc-text.c

index f9f8ce45deaeb979a9abf1d795fd1c00dbac8b05..49545d7a5ace0d288526ce069ec64a6fb0e7c544 100644 (file)
@@ -479,7 +479,7 @@ struct pane *doc_open(struct editor *ed, int fd, char *name)
                ci2.key = "doc:same-file";
                ci2.focus = p;
                ci2.extra = -1;
-               ci2.str2 = (void*)&stb;
+               ci2.misc = &stb;
                if (key_handle_focus(&ci2) > 0)
                        return p;
        }
diff --git a/core.h b/core.h
index 57e8829f09fb9d5165a33288cc3d2d33733cb18e..926c58bc2fd2f0d878d962b66566d1efb1a954a0 100644 (file)
--- a/core.h
+++ b/core.h
@@ -270,6 +270,7 @@ struct cmd_info {
        char            *str, *str2;
        struct mark     *mark, *mark2;
        struct command  *comm, *comm2;
+       void            *misc;          /* command specific */
 };
 #define        NO_NUMERIC      (INT_MAX/2)
 #define        RPT_NUM(ci)     ((ci)->numeric == NO_NUMERIC ? 1 : (ci)->numeric)
index d085809c0916e51861dd1e5616555311bb889150..9829c3f59fb90805ebe64ab5dfea39faec2ac9f6 100644 (file)
--- a/doc-dir.c
+++ b/doc-dir.c
@@ -250,7 +250,7 @@ DEF_CMD(dir_same_file)
 {
        struct doc *d = ci->home->data;
        int fd = ci->extra;
-       struct stat *stb = (void*)ci->str2;
+       struct stat *stb = ci->misc;
        struct directory *dr = container_of(d, struct directory, doc);
 
        if (!dr->fname)
index 6dddf39defe1bcf113a811afdb649f2b33fc3a69..180165f75dcf5cb8c11c75533e7a69db05fc2fa5 100644 (file)
@@ -306,7 +306,7 @@ DEF_CMD(text_save_file)
 DEF_CMD(text_same_file)
 {
        struct doc *d = ci->home->data;
-       struct stat *stb = (void*)ci->str2;
+       struct stat *stb = ci->misc;
        struct text *t = container_of(d, struct text, doc);
 
        if (t->fname == NULL)