aboutsummaryrefslogtreecommitdiffstats
path: root/src/gtkutil.c
diff options
context:
space:
mode:
authorDmitry Antipov2014-06-02 22:01:21 +0400
committerDmitry Antipov2014-06-02 22:01:21 +0400
commit5668fb88bf3731d39c4e958c8e79a549f789ce1e (patch)
treeb0d3fd3555fca3b34c47b803a633da2f36d31165 /src/gtkutil.c
parentda11196a248b530c3b3a8329497d71332f8c71a3 (diff)
downloademacs-5668fb88bf3731d39c4e958c8e79a549f789ce1e.tar.gz
emacs-5668fb88bf3731d39c4e958c8e79a549f789ce1e.zip
Use common memory management functions for lwlib and refactor users.
* lwlib/lwlib.h (widget_value): Do not maintain a free list any more. (malloc_widget_value, free_widget_value): Remove prototypes. * lwlib/lwlib.c (malloc_widget_value, free_widget_value): (widget_value_free_list, malloc_cpt): Remove. (free_widget_value_tree, copy_widget_value_tree): Adjust users. * src/menu.h (xmalloc_widget_value): Replaced by ... (make_widget_value): ... new prototype. * src/menu.c (xmalloc_widget_value): Replaced by ... (make_widget_value): ... new function. (free_menubar_widget_value_tree, digest_single_submenu): Adjust users. * src/gtkutil.c (malloc_widget_value, free_widget_value): (widget_value_free_list, malloc_cpt): Remove old lwlib-compatible code. * src/keyboard.h (enum button_type, struct _widget_value): * src/gtkutil.h, src/nsgui.h, src/w32gui.h (malloc_widget_value): (free_widget_value): Likewise. * src/nsmenu.m (ns_update_menubar, ns_menu_show): * src/w32menu.c (set_frame_menubar, w32_menu_show, w32_dialog_show): * src/xmenu.c (set_frame_menubar, xmenu_show, x_dialog_show): Adjust users. * src/xterm.h (XtParent) [USE_GTK]: Remove unused macro.
Diffstat (limited to 'src/gtkutil.c')
-rw-r--r--src/gtkutil.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c
index cebff68614f..8614fe57cb2 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -221,57 +221,6 @@ xg_display_close (Display *dpy)
221/*********************************************************************** 221/***********************************************************************
222 Utility functions 222 Utility functions
223 ***********************************************************************/ 223 ***********************************************************************/
224/* The next two variables and functions are taken from lwlib. */
225static widget_value *widget_value_free_list;
226static int malloc_cpt;
227
228/* Allocate a widget_value structure, either by taking one from the
229 widget_value_free_list or by malloc:ing a new one.
230
231 Return a pointer to the allocated structure. */
232
233widget_value *
234malloc_widget_value (void)
235{
236 widget_value *wv;
237 if (widget_value_free_list)
238 {
239 wv = widget_value_free_list;
240 widget_value_free_list = wv->free_list;
241 wv->free_list = 0;
242 }
243 else
244 {
245 wv = xmalloc (sizeof *wv);
246 malloc_cpt++;
247 }
248 memset (wv, 0, sizeof (widget_value));
249 return wv;
250}
251
252/* This is analogous to free. It frees only what was allocated
253 by malloc_widget_value, and no substructures. */
254
255void
256free_widget_value (widget_value *wv)
257{
258 if (wv->free_list)
259 emacs_abort ();
260
261 if (malloc_cpt > 25)
262 {
263 /* When the number of already allocated cells is too big,
264 We free it. */
265 xfree (wv);
266 malloc_cpt--;
267 }
268 else
269 {
270 wv->free_list = widget_value_free_list;
271 widget_value_free_list = wv;
272 }
273}
274
275 224
276/* Create and return the cursor to be used for popup menus and 225/* Create and return the cursor to be used for popup menus and
277 scroll bars on display DPY. */ 226 scroll bars on display DPY. */