2 /* This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * This module was all original code
20 * Copyright 1993, Robert Nation
21 * You may use this code for any purpose, as long as the original
22 * copyright remains in the source code and all documentation
25 /* code for parsing the fvwm style command */
27 /* ---------------------------- included header files ---------------------- */
32 #include "safemalloc.h"
35 /* ---------------------------- local definitions -------------------------- */
37 /* ---------------------------- local macros ------------------------------- */
39 /* ---------------------------- imports ------------------------------------ */
41 /* ---------------------------- included code files ------------------------ */
43 /* ---------------------------- local types -------------------------------- */
45 /* ---------------------------- forward declarations ----------------------- */
47 /* ---------------------------- local variables ---------------------------- */
49 /* ---------------------------- exported variables (globals) --------------- */
51 /* ---------------------------- local functions ---------------------------- */
53 /* ---------------------------- interface functions ------------------------ */
55 flist
*flist_append_obj(flist
*list
, void *object
)
57 flist
*new = (flist
*)safemalloc(sizeof(flist
));
78 flist
*flist_prepend_obj(flist
*list
, void *object
)
80 flist
*new = (flist
*)safemalloc(sizeof(flist
));
93 list
->prev
->next
= new;
94 new->prev
= list
->prev
;
102 flist
*flist_insert_obj(flist
*list
, void *object
, int position
)
109 return flist_append_obj(list
, object
);
113 return flist_prepend_obj(list
, object
);
116 while(tl
&& position
-- > 0)
123 return flist_append_obj(list
, object
);
126 new = (flist
*)safemalloc(sizeof(flist
));;
127 new->object
= object
;
132 tl
->prev
->next
= new;
133 new->prev
= tl
->prev
;
146 flist
*flist_remove_obj(flist
*list
, void *object
)
150 while (tl
&& tl
->object
!= object
)
162 tl
->prev
->next
= tl
->next
;
166 tl
->next
->prev
= tl
->prev
;
177 flist
*flist_free_list(flist
*list
)