Skip to content

Commit

Permalink
liblepton: Make attrib name argument in attrib searching functions to…
Browse files Browse the repository at this point in the history
… be const char*.

This eliminates several cast errors reported by g++.
  • Loading branch information
vzh committed Mar 14, 2017
1 parent 805ce64 commit f3d90a3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion liblepton/include/liblepton/geda_complex_object.h
Expand Up @@ -58,7 +58,7 @@ void
geda_complex_object_mirror (TOPLEVEL *toplevel, int world_centerx, int world_centery, OBJECT *object);

OBJECT *
o_complex_find_pin_by_attribute(OBJECT *object, char *name, char *wanted_value);
o_complex_find_pin_by_attribute (OBJECT *object, const char *name, char *wanted_value);

void
o_complex_check_symversion(TOPLEVEL* toplevel, OBJECT* object);
Expand Down
6 changes: 3 additions & 3 deletions liblepton/include/liblepton/prototype.h
Expand Up @@ -59,9 +59,9 @@ gboolean o_attrib_string_get_name_value (const gchar *string, gchar **name_ptr,
gboolean o_attrib_get_name_value (const OBJECT *attrib, gchar **name_ptr, gchar **value_ptr);
const char *o_attrib_get_name (const OBJECT *attrib);
GList *o_attrib_find_floating_attribs (const GList *list);
char *o_attrib_search_floating_attribs_by_name (const GList *list, char *name, int counter);
char *o_attrib_search_attached_attribs_by_name (OBJECT *object, char *name, int counter);
char *o_attrib_search_inherited_attribs_by_name (OBJECT *object, char *name, int counter);
char *o_attrib_search_floating_attribs_by_name (const GList *list, const char *name, int counter);
char *o_attrib_search_attached_attribs_by_name (OBJECT *object, const char *name, int counter);
char *o_attrib_search_inherited_attribs_by_name (OBJECT *object, const char *name, int counter);
char *o_attrib_search_object_attribs_by_name (OBJECT *object, const char *name, int counter);
GList *o_attrib_return_attribs(OBJECT *object);
int o_attrib_is_inherited(const OBJECT *attrib);
Expand Down
2 changes: 1 addition & 1 deletion liblepton/include/prototype_priv.h
Expand Up @@ -33,7 +33,7 @@ GList *o_read_attribs(TOPLEVEL *toplevel,
TextBuffer *tb,
unsigned int release_ver,
unsigned int fileformat_ver, GError **err);
OBJECT *o_attrib_find_attrib_by_name(const GList *list, char *name, int count);
OBJECT *o_attrib_find_attrib_by_name (const GList *list, const char *name, int count);

/* o_basic.c */
void o_bounds_invalidate(TOPLEVEL *toplevel, OBJECT *object);
Expand Down
4 changes: 3 additions & 1 deletion liblepton/src/geda_complex_object.c
Expand Up @@ -850,7 +850,9 @@ void geda_complex_object_mirror (TOPLEVEL *toplevel,
* \param [in] wanted_value the attribute value to search for.
* \return The pin OBJECT with the given attribute, NULL otherwise.
*/
OBJECT *o_complex_find_pin_by_attribute (OBJECT *object, char *name, char *wanted_value)
OBJECT *o_complex_find_pin_by_attribute (OBJECT *object,
const char *name,
char *wanted_value)
{
GList *iter;
OBJECT *o_current;
Expand Down
20 changes: 15 additions & 5 deletions liblepton/src/o_attrib.c
Expand Up @@ -477,7 +477,9 @@ GList *o_attrib_find_floating_attribs (const GList *list)
* \param [in] count Which occurance to return.
* \return The n'th attribute object in the given list with the given name.
*/
OBJECT *o_attrib_find_attrib_by_name (const GList *list, char *name, int count)
OBJECT *o_attrib_find_attrib_by_name (const GList *list,
const char *name,
int count)
{
g_return_val_if_fail (name, NULL);

Expand Down Expand Up @@ -510,7 +512,9 @@ OBJECT *o_attrib_find_attrib_by_name (const GList *list, char *name, int count)
* \param [in] counter Which occurance to return.
* \return Character string with attribute value, NULL otherwise.
*/
static char *o_attrib_search_attrib_list_by_name (const GList *list, char *name, int counter)
static char *o_attrib_search_attrib_list_by_name (const GList *list,
const char *name,
int counter)
{
OBJECT *attrib;
char *value = NULL;
Expand Down Expand Up @@ -539,7 +543,9 @@ static char *o_attrib_search_attrib_list_by_name (const GList *list, char *name,
* \warning
* Caller must g_free returned character string.
*/
char *o_attrib_search_floating_attribs_by_name (const GList *list, char *name, int counter)
char *o_attrib_search_floating_attribs_by_name (const GList *list,
const char *name,
int counter)
{
char *result;
GList *attributes;
Expand Down Expand Up @@ -567,7 +573,9 @@ char *o_attrib_search_floating_attribs_by_name (const GList *list, char *name, i
* \warning
* Caller must g_free returned character string.
*/
char *o_attrib_search_attached_attribs_by_name (OBJECT *object, char *name, int counter)
char *o_attrib_search_attached_attribs_by_name (OBJECT *object,
const char *name,
int counter)
{
return o_attrib_search_attrib_list_by_name (object->attribs, name, counter);
}
Expand All @@ -588,7 +596,9 @@ char *o_attrib_search_attached_attribs_by_name (OBJECT *object, char *name, int
* \warning
* Caller must g_free returned character string.
*/
char *o_attrib_search_inherited_attribs_by_name (OBJECT *object, char *name, int counter)
char *o_attrib_search_inherited_attribs_by_name (OBJECT *object,
const char *name,
int counter)
{
g_return_val_if_fail (object->type == OBJ_COMPLEX ||
object->type == OBJ_PLACEHOLDER, NULL);
Expand Down

0 comments on commit f3d90a3

Please sign in to comment.