1 /* gEDA - GPL Electronic Design Automation
2 * libgeda - gEDA's library
3 * Copyright (C) 1998-2010 Ales Hvezda
4 * Copyright (C) 1998-2020 gEDA Contributors (see ChangeLog for details)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 /*! \todo Finish function documentation!!!
29 * \par Function Description
32 GList
*s_stretch_add (GList
*list
, OBJECT
*object
, int whichone
)
37 /* Check if the object is already in the stretch list */
38 for (s_iter
= list
; s_iter
!= NULL
; s_iter
= g_list_next (s_iter
)) {
39 STRETCH
*s_current
= s_iter
->data
;
40 if (s_current
->object
->sid
== object
->sid
) {
45 s_new
= g_malloc (sizeof (STRETCH
));
46 s_new
->object
= object
;
47 s_new
->whichone
= whichone
;
49 return g_list_append (list
, s_new
);
53 /*! \brief Test if a STRETCH structure points at a given OBJECT
56 * \par Function Description
57 * Compares if (STRETCH *)a->object == (OBJECT *)b
59 * \param [in] a The STRETCH structure
60 * \param [in] b The OBJECT to test for
61 * \returns 0 if STRETCH *a points to OBJECT *b, otherwise 1.
63 static gint
find_object (gconstpointer a
, gconstpointer b
)
65 return (((STRETCH
*)a
)->object
== (OBJECT
*)b
) ? 0 : 1;
69 /*! \todo Finish function documentation!!!
71 * \par Function Description
74 GList
*s_stretch_remove (GList
*list
, OBJECT
*object
)
78 g_return_val_if_fail (object
!= NULL
, list
);
80 item
= g_list_find_custom (list
, object
, find_object
);
83 return g_list_delete_link (list
, item
);
86 /*! \todo Finish function documentation!!!
88 * \par Function Description
91 void s_stretch_destroy_all (GList
*list
)
93 g_list_foreach (list
, (GFunc
)g_free
, NULL
);