FREE(&tempfile);
}
- mutt_window_free();
+ mutt_window_free_all();
if (rv != 0)
goto main_curses; // TEST36: neomutt -H existing -s test john@example.com -E (cancel sending)
mutt_buffer_free(&folder);
mutt_list_free(&queries);
crypto_module_free();
- mutt_window_free();
+ mutt_window_free_all();
mutt_buffer_pool_free();
mutt_envlist_free();
mutt_browser_cleanup();
struct MuttWindow *MuttSidebarWindow = NULL; /**< Sidebar Window */
#endif
+/**
+ * mutt_window_new - Create a new Window
+ * @retval ptr New Window
+ */
+struct MuttWindow *mutt_window_new(void)
+{
+ struct MuttWindow *win = mutt_mem_calloc(1, sizeof(struct MuttWindow));
+
+ return win;
+}
+
+/**
+ * mutt_window_free - Free a Window
+ * @param ptr Window to free
+ */
+void mutt_window_free(struct MuttWindow **ptr)
+{
+ if (!ptr || !*ptr)
+ return;
+
+ // struct MuttWindow *win = *ptr;
+
+ FREE(ptr);
+}
+
#ifdef USE_SLANG_CURSES
/**
* vw_printw - Write a formatted string to a Window (function missing from Slang)
}
/**
- * mutt_window_free - Free the default Windows
+ * mutt_window_free_all - Free all the default Windows
*/
-void mutt_window_free(void)
+void mutt_window_free_all(void)
{
FREE(&MuttHelpWindow);
FREE(&MuttIndexWindow);
*/
void mutt_window_init(void)
{
- MuttHelpWindow = mutt_mem_calloc(1, sizeof(struct MuttWindow));
- MuttIndexWindow = mutt_mem_calloc(1, sizeof(struct MuttWindow));
- MuttStatusWindow = mutt_mem_calloc(1, sizeof(struct MuttWindow));
- MuttMessageWindow = mutt_mem_calloc(1, sizeof(struct MuttWindow));
+ MuttHelpWindow = mutt_window_new();
+ MuttIndexWindow = mutt_window_new();
+ MuttStatusWindow = mutt_window_new();
+ MuttMessageWindow = mutt_window_new();
#ifdef USE_SIDEBAR
- MuttSidebarWindow = mutt_mem_calloc(1, sizeof(struct MuttWindow));
+ MuttSidebarWindow = mutt_window_new();
#endif
}
#endif
extern struct MuttWindow *MuttStatusWindow;
-void mutt_window_clearline(struct MuttWindow *win, int row);
-void mutt_window_clrtoeol(struct MuttWindow *win);
-void mutt_window_free(void);
-void mutt_window_getxy(struct MuttWindow *win, int *x, int *y);
-void mutt_window_init(void);
-int mutt_window_move(struct MuttWindow *win, int row, int col);
-int mutt_window_mvaddstr(struct MuttWindow *win, int row, int col, const char *str);
-int mutt_window_mvprintw(struct MuttWindow *win, int row, int col, const char *fmt, ...);
-void mutt_window_reflow_message_rows(int mw_rows);
-void mutt_window_reflow(void);
-int mutt_window_wrap_cols(int width, short wrap);
+void mutt_window_clearline (struct MuttWindow *win, int row);
+void mutt_window_clrtoeol (struct MuttWindow *win);
+void mutt_window_free (struct MuttWindow **ptr);
+void mutt_window_free_all (void);
+void mutt_window_getxy (struct MuttWindow *win, int *x, int *y);
+void mutt_window_init (void);
+int mutt_window_move (struct MuttWindow *win, int row, int col);
+int mutt_window_mvaddstr (struct MuttWindow *win, int row, int col, const char *str);
+int mutt_window_mvprintw (struct MuttWindow *win, int row, int col, const char *fmt, ...);
+struct MuttWindow *mutt_window_new (void);
+void mutt_window_reflow (void);
+void mutt_window_reflow_message_rows(int mw_rows);
+int mutt_window_wrap_cols (int width, short wrap);
#endif /* MUTT_MUTT_WINDOW_H */
}
rd.helpstr = mutt_b2s(helpstr);
- rd.index_status_window = mutt_mem_calloc(1, sizeof(struct MuttWindow));
- rd.index_window = mutt_mem_calloc(1, sizeof(struct MuttWindow));
- rd.pager_status_window = mutt_mem_calloc(1, sizeof(struct MuttWindow));
- rd.pager_window = mutt_mem_calloc(1, sizeof(struct MuttWindow));
+ rd.index_status_window = mutt_window_new();
+ rd.index_window = mutt_window_new();
+ rd.pager_status_window = mutt_window_new();
+ rd.pager_window = mutt_window_new();
pager_menu = mutt_menu_new(MENU_PAGER);
pager_menu->menu_custom_redraw = pager_custom_redraw;
mutt_menu_destroy(&rd.index);
mutt_buffer_free(&helpstr);
- FREE(&rd.index_status_window);
- FREE(&rd.index_window);
- FREE(&rd.pager_status_window);
- FREE(&rd.pager_window);
+ mutt_window_free(&rd.index_status_window);
+ mutt_window_free(&rd.index_window);
+ mutt_window_free(&rd.pager_status_window);
+ mutt_window_free(&rd.pager_window);
return (rc != -1) ? rc : 0;
}