Remove unused tui_win_info::detail::opaque
[external/binutils.git] / gdb / tui / tui-data.c
1 /* TUI data manipulation routines.
2
3    Copyright (C) 1998-2018 Free Software Foundation, Inc.
4
5    Contributed by Hewlett-Packard Company.
6
7    This file is part of GDB.
8
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 3 of the License, or
12    (at your option) any later version.
13
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
21
22 #include "defs.h"
23 #include "symtab.h"
24 #include "tui/tui.h"
25 #include "tui/tui-data.h"
26 #include "tui/tui-wingeneral.h"
27 #include "gdb_curses.h"
28
29 /****************************
30 ** GLOBAL DECLARATIONS
31 ****************************/
32 struct tui_win_info *tui_win_list[MAX_MAJOR_WINDOWS];
33
34 /***************************
35 ** Private data
36 ****************************/
37 static enum tui_layout_type current_layout = UNDEFINED_LAYOUT;
38 static int term_height, term_width;
39 static struct tui_gen_win_info _locator;
40 static struct tui_gen_win_info exec_info[2];
41 static struct tui_win_info *src_win_list[2];
42 static struct tui_list source_windows = {src_win_list, 0};
43 static int default_tab_len = DEFAULT_TAB_LEN;
44 static struct tui_win_info *win_with_focus = NULL;
45 static struct tui_layout_def layout_def = {
46   SRC_WIN,                      /* DISPLAY_MODE */
47   FALSE};                       /* SPLIT */
48
49 static int win_resized = FALSE;
50
51
52 /*********************************
53 ** Static function forward decls
54 **********************************/
55 static void free_content (tui_win_content, 
56                           int, 
57                           enum tui_win_type);
58 static void free_content_elements (tui_win_content, 
59                                    int, 
60                                    enum tui_win_type);
61
62
63
64 /*********************************
65 ** PUBLIC FUNCTIONS
66 **********************************/
67
68 int
69 tui_win_is_source_type (enum tui_win_type win_type)
70 {
71   return (win_type == SRC_WIN || win_type == DISASSEM_WIN);
72 }
73
74 int
75 tui_win_is_auxillary (enum tui_win_type win_type)
76 {
77   return (win_type > MAX_MAJOR_WINDOWS);
78 }
79
80 int
81 tui_win_has_locator (struct tui_win_info *win_info)
82 {
83   return (win_info != NULL 
84           && win_info->detail.source_info.has_locator);
85 }
86
87 void
88 tui_set_win_highlight (struct tui_win_info *win_info, 
89                        int highlight)
90 {
91   if (win_info != NULL)
92     win_info->is_highlighted = highlight;
93 }
94
95 /******************************************
96 ** ACCESSORS & MUTATORS FOR PRIVATE DATA
97 ******************************************/
98
99 /* Answer a whether the terminal window has been resized or not.  */
100 int
101 tui_win_resized (void)
102 {
103   return win_resized;
104 }
105
106
107 /* Set a whether the terminal window has been resized or not.  */
108 void
109 tui_set_win_resized_to (int resized)
110 {
111   win_resized = resized;
112 }
113
114
115 /* Answer a pointer to the current layout definition.  */
116 struct tui_layout_def *
117 tui_layout_def (void)
118 {
119   return &layout_def;
120 }
121
122
123 /* Answer the window with the logical focus.  */
124 struct tui_win_info *
125 tui_win_with_focus (void)
126 {
127   return win_with_focus;
128 }
129
130
131 /* Set the window that has the logical focus.  */
132 void
133 tui_set_win_with_focus (struct tui_win_info *win_info)
134 {
135   win_with_focus = win_info;
136 }
137
138
139 /* Answer the length in chars, of tabs.  */
140 int
141 tui_default_tab_len (void)
142 {
143   return default_tab_len;
144 }
145
146
147 /* Set the length in chars, of tabs.  */
148 void
149 tui_set_default_tab_len (int len)
150 {
151   default_tab_len = len;
152 }
153
154
155 /* Accessor for the current source window.  Usually there is only one
156    source window (either source or disassembly), but both can be
157    displayed at the same time.  */
158 struct tui_list *
159 tui_source_windows (void)
160 {
161   return &source_windows;
162 }
163
164
165 /* Clear the list of source windows.  Usually there is only one source
166    window (either source or disassembly), but both can be displayed at
167    the same time.  */
168 void
169 tui_clear_source_windows (void)
170 {
171   source_windows.list[0] = NULL;
172   source_windows.list[1] = NULL;
173   source_windows.count = 0;
174 }
175
176
177 /* Clear the pertinant detail in the source windows.  */
178 void
179 tui_clear_source_windows_detail (void)
180 {
181   int i;
182
183   for (i = 0; i < (tui_source_windows ())->count; i++)
184     tui_clear_win_detail ((tui_source_windows ())->list[i]);
185 }
186
187
188 /* Add a window to the list of source windows.  Usually there is only
189    one source window (either source or disassembly), but both can be
190    displayed at the same time.  */
191 void
192 tui_add_to_source_windows (struct tui_win_info *win_info)
193 {
194   if (source_windows.count < 2)
195     source_windows.list[source_windows.count++] = win_info;
196 }
197
198
199 /* Clear the pertinant detail in the windows.  */
200 void
201 tui_clear_win_detail (struct tui_win_info *win_info)
202 {
203   if (win_info != NULL)
204     {
205       switch (win_info->generic.type)
206         {
207         case SRC_WIN:
208         case DISASSEM_WIN:
209           win_info->detail.source_info.gdbarch = NULL;
210           win_info->detail.source_info.start_line_or_addr.loa = LOA_ADDRESS;
211           win_info->detail.source_info.start_line_or_addr.u.addr = 0;
212           win_info->detail.source_info.horizontal_offset = 0;
213           break;
214         case CMD_WIN:
215           wmove (win_info->generic.handle, 0, 0);
216           break;
217         case DATA_WIN:
218           win_info->detail.data_display_info.data_content =
219             (tui_win_content) NULL;
220           win_info->detail.data_display_info.data_content_count = 0;
221           win_info->detail.data_display_info.regs_content =
222             (tui_win_content) NULL;
223           win_info->detail.data_display_info.regs_content_count = 0;
224           win_info->detail.data_display_info.regs_column_count = 1;
225           win_info->detail.data_display_info.display_regs = FALSE;
226           break;
227         default:
228           break;
229         }
230     }
231 }
232
233
234 /* Accessor for the source execution info ptr.  */
235 struct tui_gen_win_info *
236 tui_source_exec_info_win_ptr (void)
237 {
238   return &exec_info[0];
239 }
240
241
242 /* Accessor for the disassem execution info ptr.  */
243 struct tui_gen_win_info *
244 tui_disassem_exec_info_win_ptr (void)
245 {
246   return &exec_info[1];
247 }
248
249
250 /* Accessor for the locator win info.  Answers a pointer to the static
251    locator win info struct.  */
252 struct tui_gen_win_info *
253 tui_locator_win_info_ptr (void)
254 {
255   return &_locator;
256 }
257
258
259 /* Accessor for the term_height.  */
260 int
261 tui_term_height (void)
262 {
263   return term_height;
264 }
265
266
267 /* Mutator for the term height.  */
268 void
269 tui_set_term_height_to (int h)
270 {
271   term_height = h;
272 }
273
274
275 /* Accessor for the term_width.  */
276 int
277 tui_term_width (void)
278 {
279   return term_width;
280 }
281
282
283 /* Mutator for the term_width.  */
284 void
285 tui_set_term_width_to (int w)
286 {
287   term_width = w;
288 }
289
290
291 /* Accessor for the current layout.  */
292 enum tui_layout_type
293 tui_current_layout (void)
294 {
295   return current_layout;
296 }
297
298
299 /* Mutator for the current layout.  */
300 void
301 tui_set_current_layout_to (enum tui_layout_type new_layout)
302 {
303   current_layout = new_layout;
304 }
305
306
307 /*****************************
308 ** OTHER PUBLIC FUNCTIONS
309 *****************************/
310
311
312 /* Answer the next window in the list, cycling back to the top if
313    necessary.  */
314 struct tui_win_info *
315 tui_next_win (struct tui_win_info *cur_win)
316 {
317   int type = cur_win->generic.type;
318   struct tui_win_info *next_win = NULL;
319
320   if (cur_win->generic.type == CMD_WIN)
321     type = SRC_WIN;
322   else
323     type = cur_win->generic.type + 1;
324   while (type != cur_win->generic.type && (next_win == NULL))
325     {
326       if (tui_win_list[type]
327           && tui_win_list[type]->generic.is_visible)
328         next_win = tui_win_list[type];
329       else
330         {
331           if (type == CMD_WIN)
332             type = SRC_WIN;
333           else
334             type++;
335         }
336     }
337
338   return next_win;
339 }
340
341
342 /* Answer the prev window in the list, cycling back to the bottom if
343    necessary.  */
344 struct tui_win_info *
345 tui_prev_win (struct tui_win_info *cur_win)
346 {
347   int type = cur_win->generic.type;
348   struct tui_win_info *prev = NULL;
349
350   if (cur_win->generic.type == SRC_WIN)
351     type = CMD_WIN;
352   else
353     type = cur_win->generic.type - 1;
354   while (type != cur_win->generic.type && (prev == NULL))
355     {
356       if (tui_win_list[type]
357           && tui_win_list[type]->generic.is_visible)
358         prev = tui_win_list[type];
359       else
360         {
361           if (type == SRC_WIN)
362             type = CMD_WIN;
363           else
364             type--;
365         }
366     }
367
368   return prev;
369 }
370
371
372 /* Answer the window represented by name.  */
373 struct tui_win_info *
374 tui_partial_win_by_name (const char *name)
375 {
376   struct tui_win_info *win_info = NULL;
377
378   if (name != (char *) NULL)
379     {
380       int i = 0;
381
382       while (i < MAX_MAJOR_WINDOWS && win_info == NULL)
383         {
384           if (tui_win_list[i] != 0)
385             {
386               const char *cur_name =
387                 tui_win_name (&tui_win_list[i]->generic);
388
389               if (strlen (name) <= strlen (cur_name)
390                   && startswith (cur_name, name))
391                 win_info = tui_win_list[i];
392             }
393           i++;
394         }
395     }
396
397   return win_info;
398 }
399
400
401 /* Answer the name of the window.  */
402 const char *
403 tui_win_name (const struct tui_gen_win_info *win_info)
404 {
405   const char *name = NULL;
406
407   switch (win_info->type)
408     {
409     case SRC_WIN:
410       name = SRC_NAME;
411       break;
412     case CMD_WIN:
413       name = CMD_NAME;
414       break;
415     case DISASSEM_WIN:
416       name = DISASSEM_NAME;
417       break;
418     case DATA_WIN:
419       name = DATA_NAME;
420       break;
421     default:
422       name = "";
423       break;
424     }
425
426   return name;
427 }
428
429
430 void
431 tui_initialize_static_data (void)
432 {
433   tui_init_generic_part (tui_source_exec_info_win_ptr ());
434   tui_init_generic_part (tui_disassem_exec_info_win_ptr ());
435   tui_init_generic_part (tui_locator_win_info_ptr ());
436 }
437
438
439 struct tui_gen_win_info *
440 tui_alloc_generic_win_info (void)
441 {
442   struct tui_gen_win_info *win = XNEW (struct tui_gen_win_info);
443
444   if (win != NULL)
445     tui_init_generic_part (win);
446
447   return win;
448 }
449
450
451 void
452 tui_init_generic_part (struct tui_gen_win_info *win)
453 {
454   win->width =
455     win->height =
456     win->origin.x =
457     win->origin.y =
458     win->viewport_height =
459     win->content_size =
460     win->last_visible_line = 0;
461   win->handle = NULL;
462   win->content = NULL;
463   win->content_in_use =
464     win->is_visible = FALSE;
465   win->title = 0;
466 }
467
468
469 /* init_content_element().
470  */
471 static void
472 init_content_element (struct tui_win_element *element, 
473                       enum tui_win_type type)
474 {
475   element->highlight = FALSE;
476   switch (type)
477     {
478     case SRC_WIN:
479     case DISASSEM_WIN:
480       element->which_element.source.line = NULL;
481       element->which_element.source.line_or_addr.loa = LOA_LINE;
482       element->which_element.source.line_or_addr.u.line_no = 0;
483       element->which_element.source.is_exec_point = FALSE;
484       element->which_element.source.has_break = FALSE;
485       break;
486     case DATA_WIN:
487       tui_init_generic_part (&element->which_element.data_window);
488       element->which_element.data_window.type = DATA_ITEM_WIN;
489       element->which_element.data_window.content =
490         tui_alloc_content (1, DATA_ITEM_WIN);
491       element->which_element.data_window.content_size = 1;
492       break;
493     case CMD_WIN:
494       element->which_element.command.line = NULL;
495       break;
496     case DATA_ITEM_WIN:
497       element->which_element.data.name = NULL;
498       element->which_element.data.type = TUI_REGISTER;
499       element->which_element.data.item_no = UNDEFINED_ITEM;
500       element->which_element.data.value = NULL;
501       element->which_element.data.highlight = FALSE;
502       element->which_element.data.content = NULL;
503       break;
504     case LOCATOR_WIN:
505       element->which_element.locator.full_name[0] =
506         element->which_element.locator.proc_name[0] = (char) 0;
507       element->which_element.locator.line_no = 0;
508       element->which_element.locator.addr = 0;
509       break;
510     case EXEC_INFO_WIN:
511       memset(element->which_element.simple_string, ' ',
512              sizeof(element->which_element.simple_string));
513       break;
514     default:
515       break;
516     }
517 }
518
519 static void
520 init_win_info (struct tui_win_info *win_info)
521 {
522   tui_init_generic_part (&win_info->generic);
523   win_info->can_highlight =
524     win_info->is_highlighted = FALSE;
525   switch (win_info->generic.type)
526     {
527     case SRC_WIN:
528     case DISASSEM_WIN:
529       win_info->detail.source_info.execution_info
530         = (struct tui_gen_win_info *) NULL;
531       win_info->detail.source_info.has_locator = FALSE;
532       win_info->detail.source_info.horizontal_offset = 0;
533       win_info->detail.source_info.gdbarch = NULL;
534       win_info->detail.source_info.start_line_or_addr.loa = LOA_ADDRESS;
535       win_info->detail.source_info.start_line_or_addr.u.addr = 0;
536       win_info->detail.source_info.fullname = NULL;
537       break;
538     case DATA_WIN:
539       win_info->detail.data_display_info.data_content = (tui_win_content) NULL;
540       win_info->detail.data_display_info.data_content_count = 0;
541       win_info->detail.data_display_info.regs_content = (tui_win_content) NULL;
542       win_info->detail.data_display_info.regs_content_count = 0;
543       win_info->detail.data_display_info.regs_column_count = 1;
544       win_info->detail.data_display_info.display_regs = FALSE;
545       win_info->detail.data_display_info.current_group = 0;
546       break;
547     case CMD_WIN:
548       break;
549     }
550 }
551
552
553 struct tui_win_info *
554 tui_alloc_win_info (enum tui_win_type type)
555 {
556   struct tui_win_info *win_info = XNEW (struct tui_win_info);
557
558   if (win_info != NULL)
559     {
560       win_info->generic.type = type;
561       init_win_info (win_info);
562     }
563
564   return win_info;
565 }
566
567
568 /* Allocates the content and elements in a block.  */
569 tui_win_content
570 tui_alloc_content (int num_elements, enum tui_win_type type)
571 {
572   tui_win_content content;
573   struct tui_win_element *element_block_ptr;
574   int i;
575
576   content = XNEWVEC (struct tui_win_element *, num_elements);
577
578   /*
579    * All windows, except the data window, can allocate the
580    * elements in a chunk.  The data window cannot because items
581    * can be added/removed from the data display by the user at any
582    * time.
583    */
584   if (type != DATA_WIN)
585     {
586       element_block_ptr = XNEWVEC (struct tui_win_element, num_elements);
587       for (i = 0; i < num_elements; i++)
588         {
589           content[i] = element_block_ptr;
590           init_content_element (content[i], type);
591           element_block_ptr++;
592         }
593     }
594
595   return content;
596 }
597
598
599 /* Adds the input number of elements to the windows's content.  If no
600    content has been allocated yet, alloc_content() is called to do
601    this.  The index of the first element added is returned, unless
602    there is a memory allocation error, in which case, (-1) is
603    returned.  */
604 int
605 tui_add_content_elements (struct tui_gen_win_info *win_info, 
606                           int num_elements)
607 {
608   struct tui_win_element *element_ptr;
609   int i, index_start;
610
611   if (win_info->content == NULL)
612     {
613       win_info->content = tui_alloc_content (num_elements, win_info->type);
614       index_start = 0;
615     }
616   else
617     index_start = win_info->content_size;
618   if (win_info->content != NULL)
619     {
620       for (i = index_start; (i < num_elements + index_start); i++)
621         {
622           element_ptr = XNEW (struct tui_win_element);
623           if (element_ptr != NULL)
624             {
625               win_info->content[i] = element_ptr;
626               init_content_element (element_ptr, win_info->type);
627               win_info->content_size++;
628             }
629           else  /* Things must be really hosed now!  We ran out of
630                    memory!?  */
631             return (-1);
632         }
633     }
634
635   return index_start;
636 }
637
638
639 /* Delete all curses windows associated with win_info, leaving
640    everything else intact.  */
641 void
642 tui_del_window (struct tui_win_info *win_info)
643 {
644   struct tui_gen_win_info *generic_win;
645
646   switch (win_info->generic.type)
647     {
648     case SRC_WIN:
649     case DISASSEM_WIN:
650       generic_win = tui_locator_win_info_ptr ();
651       if (generic_win != (struct tui_gen_win_info *) NULL)
652         {
653           tui_delete_win (generic_win->handle);
654           generic_win->handle = NULL;
655           generic_win->is_visible = FALSE;
656         }
657       if (win_info->detail.source_info.fullname)
658         {
659           xfree (win_info->detail.source_info.fullname);
660           win_info->detail.source_info.fullname = NULL;
661         }
662       generic_win = win_info->detail.source_info.execution_info;
663       if (generic_win != (struct tui_gen_win_info *) NULL)
664         {
665           tui_delete_win (generic_win->handle);
666           generic_win->handle = NULL;
667           generic_win->is_visible = FALSE;
668         }
669       break;
670     case DATA_WIN:
671       if (win_info->generic.content != NULL)
672         {
673           tui_del_data_windows (win_info->detail.data_display_info.regs_content,
674                                 win_info->detail.data_display_info.regs_content_count);
675           tui_del_data_windows (win_info->detail.data_display_info.data_content,
676                                 win_info->detail.data_display_info.data_content_count);
677         }
678       break;
679     default:
680       break;
681     }
682   if (win_info->generic.handle != (WINDOW *) NULL)
683     {
684       tui_delete_win (win_info->generic.handle);
685       win_info->generic.handle = NULL;
686       win_info->generic.is_visible = FALSE;
687     }
688 }
689
690
691 void
692 tui_free_window (struct tui_win_info *win_info)
693 {
694   struct tui_gen_win_info *generic_win;
695
696   switch (win_info->generic.type)
697     {
698     case SRC_WIN:
699     case DISASSEM_WIN:
700       if (win_info->detail.source_info.fullname)
701         {
702           xfree (win_info->detail.source_info.fullname);
703           win_info->detail.source_info.fullname = NULL;
704         }
705       generic_win = win_info->detail.source_info.execution_info;
706       if (generic_win != (struct tui_gen_win_info *) NULL)
707         {
708           tui_delete_win (generic_win->handle);
709           generic_win->handle = NULL;
710           tui_free_win_content (generic_win);
711         }
712       break;
713     case DATA_WIN:
714       if (win_info->generic.content != NULL)
715         {
716           tui_free_data_content (win_info->detail.data_display_info.regs_content,
717                                  win_info->detail.data_display_info.regs_content_count);
718           win_info->detail.data_display_info.regs_content =
719             (tui_win_content) NULL;
720           win_info->detail.data_display_info.regs_content_count = 0;
721           tui_free_data_content (win_info->detail.data_display_info.data_content,
722                                  win_info->detail.data_display_info.data_content_count);
723           win_info->detail.data_display_info.data_content =
724             (tui_win_content) NULL;
725           win_info->detail.data_display_info.data_content_count = 0;
726           win_info->detail.data_display_info.regs_column_count = 1;
727           win_info->detail.data_display_info.display_regs = FALSE;
728           win_info->generic.content = NULL;
729           win_info->generic.content_size = 0;
730         }
731       break;
732     default:
733       break;
734     }
735   if (win_info->generic.handle != (WINDOW *) NULL)
736     {
737       tui_delete_win (win_info->generic.handle);
738       win_info->generic.handle = NULL;
739       tui_free_win_content (&win_info->generic);
740     }
741   if (win_info->generic.title)
742     xfree (win_info->generic.title);
743   xfree (win_info);
744 }
745
746
747 void
748 tui_free_all_source_wins_content (void)
749 {
750   int i;
751
752   for (i = 0; i < (tui_source_windows ())->count; i++)
753     {
754       struct tui_win_info *win_info = (tui_source_windows ())->list[i];
755
756       if (win_info != NULL)
757         {
758           tui_free_win_content (&(win_info->generic));
759           tui_free_win_content (win_info->detail.source_info.execution_info);
760         }
761     }
762 }
763
764
765 void
766 tui_free_win_content (struct tui_gen_win_info *win_info)
767 {
768   if (win_info->content != NULL)
769     {
770       free_content ((tui_win_content) win_info->content,
771                    win_info->content_size,
772                    win_info->type);
773       win_info->content = NULL;
774     }
775   win_info->content_size = 0;
776 }
777
778
779 void
780 tui_del_data_windows (tui_win_content content, 
781                       int content_size)
782 {
783   int i;
784
785   /* Remember that data window content elements are of type struct
786      tui_gen_win_info *, each of which whose single element is a data
787      element.  */
788   for (i = 0; i < content_size; i++)
789     {
790       struct tui_gen_win_info *generic_win
791         = &content[i]->which_element.data_window;
792
793       if (generic_win != (struct tui_gen_win_info *) NULL)
794         {
795           tui_delete_win (generic_win->handle);
796           generic_win->handle = NULL;
797           generic_win->is_visible = FALSE;
798         }
799     }
800 }
801
802
803 void
804 tui_free_data_content (tui_win_content content, 
805                        int content_size)
806 {
807   int i;
808
809   /* Remember that data window content elements are of type struct
810      tui_gen_win_info *, each of which whose single element is a data
811      element.  */
812   for (i = 0; i < content_size; i++)
813     {
814       struct tui_gen_win_info *generic_win
815         = &content[i]->which_element.data_window;
816
817       if (generic_win != (struct tui_gen_win_info *) NULL)
818         {
819           tui_delete_win (generic_win->handle);
820           generic_win->handle = NULL;
821           tui_free_win_content (generic_win);
822         }
823     }
824   free_content (content,
825                 content_size,
826                 DATA_WIN);
827 }
828
829
830 /**********************************
831 ** LOCAL STATIC FUNCTIONS        **
832 **********************************/
833
834
835 static void
836 free_content (tui_win_content content, 
837               int content_size, 
838               enum tui_win_type win_type)
839 {
840   if (content != (tui_win_content) NULL)
841     {
842       free_content_elements (content, content_size, win_type);
843       xfree (content);
844     }
845 }
846
847
848 /* free_content_elements().
849  */
850 static void
851 free_content_elements (tui_win_content content, 
852                        int content_size, 
853                        enum tui_win_type type)
854 {
855   if (content != (tui_win_content) NULL)
856     {
857       int i;
858
859       if (type == SRC_WIN || type == DISASSEM_WIN)
860         {
861           /* Free whole source block.  */
862           xfree (content[0]->which_element.source.line);
863         }
864       else
865         {
866           for (i = 0; i < content_size; i++)
867             {
868               struct tui_win_element *element;
869
870               element = content[i];
871               if (element != (struct tui_win_element *) NULL)
872                 {
873                   switch (type)
874                     {
875                     case DATA_WIN:
876                       xfree (element);
877                       break;
878                     case DATA_ITEM_WIN:
879                       /* Note that data elements are not allocated in
880                          a single block, but individually, as
881                          needed.  */
882                       if (element->which_element.data.type != TUI_REGISTER)
883                         xfree ((void *)element->which_element.data.name);
884                       xfree (element->which_element.data.value);
885                       xfree (element->which_element.data.content);
886                       xfree (element);
887                       break;
888                     case CMD_WIN:
889                       xfree (element->which_element.command.line);
890                       break;
891                     default:
892                       break;
893                     }
894                 }
895             }
896         }
897       if (type != DATA_WIN && type != DATA_ITEM_WIN)
898         xfree (content[0]);     /* Free the element block.  */
899     }
900 }