]> granicus.if.org Git - graphviz/commitdiff
smyrna filter_attributes: take attribute as a const
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 25 Sep 2022 19:15:26 +0000 (12:15 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 26 Sep 2022 15:06:30 +0000 (08:06 -0700)
This removes the need for casts, squashing some -Wcast-qual warnings.

cmd/smyrna/gui/frmobjectui.c

index 0c7bcc386b58e5a1ca58b600af79f51acf759149..b738683f3dbe1609ff8e33748f5d300b964fd8a6 100644 (file)
@@ -275,8 +275,7 @@ static attr_t *binarySearch(attr_list * l, char *searchKey)
     return NULL;
 }
 
-static attr_t *pBinarySearch(attr_list * l, char *searchKey)
-{
+static attr_t *pBinarySearch(attr_list *l, const char *searchKey) {
     int middle, low, high, res;
     low = 0;
     high = l->attr_count - 1;
@@ -296,8 +295,8 @@ static attr_t *pBinarySearch(attr_list * l, char *searchKey)
     return NULL;
 }
 
-static void create_filtered_list(char *prefix, attr_list * sl, attr_list * tl)
-{
+static void create_filtered_list(const char *prefix, attr_list *sl,
+                                 attr_list *tl) {
     int res;
     attr_t *at;
     int objKind = get_object_type();
@@ -324,8 +323,7 @@ static void create_filtered_list(char *prefix, attr_list * sl, attr_list * tl)
     }
 }
 
-static void filter_attributes(char *prefix, topview * t)
-{
+static void filter_attributes(const char *prefix, topview *t) {
     int ind;
     int tmp;
 
@@ -418,8 +416,7 @@ static void filter_attributes(char *prefix, topview * t)
 
 _BB void on_txtAttr_changed(GtkWidget * widget, gpointer user_data)
 {
-    filter_attributes((char *) gtk_entry_get_text((GtkEntry *) widget),
-                     view->Topview);
+  filter_attributes(gtk_entry_get_text((GtkEntry*)widget), view->Topview);
 }
 
 static void set_refresh_filters(ViewInfo * v, int type, char *name)
@@ -504,11 +501,8 @@ _BB void on_attrRB0_clicked(GtkWidget * widget, gpointer user_data)
     (void)widget;
     (void)user_data;
 
-    filter_attributes((char *)
-                     gtk_entry_get_text((GtkEntry *)
-                                        glade_xml_get_widget(xml,
-                                                             "txtAttr")),
-                     view->Topview);
+    filter_attributes(gtk_entry_get_text((GtkEntry*)glade_xml_get_widget(xml,
+                                                             "txtAttr")), view->Topview);
 
 }