[geocode-glib] geocode-place: Simplify switch statement
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geocode-glib] geocode-place: Simplify switch statement
- Date: Fri, 13 Jan 2017 23:12:08 +0000 (UTC)
commit 7d9130a778d17740b76492c63f91ea3ced6a7b7b
Author: Philip Withnall <philip tecnocode co uk>
Date: Fri Jan 6 23:40:43 2017 +0000
geocode-place: Simplify switch statement
We return immediately at the bottom of the switch statement, so why not
return immediately from each case?
https://bugzilla.gnome.org/show_bug.cgi?id=756311
geocode-glib/geocode-place.c | 41 ++++++++++++-----------------------------
1 files changed, 12 insertions(+), 29 deletions(-)
---
diff --git a/geocode-glib/geocode-place.c b/geocode-glib/geocode-place.c
index 3b11cad..67d9025 100644
--- a/geocode-glib/geocode-place.c
+++ b/geocode-glib/geocode-place.c
@@ -1125,60 +1125,43 @@ geocode_place_get_continent (GeocodePlace *place)
static const char *
get_icon_name (GeocodePlace *place)
{
- const char *icon_name;
-
switch ((int) place->priv->place_type) {
-
case GEOCODE_PLACE_TYPE_BUILDING:
- icon_name = "poi-building";
- break;
+ return "poi-building";
case GEOCODE_PLACE_TYPE_TOWN:
- icon_name = "poi-town";
- break;
+ return "poi-town";
case GEOCODE_PLACE_TYPE_AIRPORT:
- icon_name = "poi-airport";
- break;
+ return "poi-airport";
case GEOCODE_PLACE_TYPE_RAILWAY_STATION:
- icon_name = "poi-railway-station";
- break;
+ return "poi-railway-station";
case GEOCODE_PLACE_TYPE_BUS_STOP:
- icon_name = "poi-bus-stop";
- break;
+ return "poi-bus-stop";
case GEOCODE_PLACE_TYPE_STREET:
- icon_name = "poi-car";
- break;
+ return "poi-car";
case GEOCODE_PLACE_TYPE_SCHOOL:
- icon_name = "poi-school";
- break;
+ return "poi-school";
case GEOCODE_PLACE_TYPE_PLACE_OF_WORSHIP:
- icon_name = "poi-place-of-worship";
- break;
+ return "poi-place-of-worship";
case GEOCODE_PLACE_TYPE_RESTAURANT:
- icon_name = "poi-restaurant";
- break;
+ return "poi-restaurant";
case GEOCODE_PLACE_TYPE_BAR:
- icon_name = "poi-bar";
- break;
+ return "poi-bar";
case GEOCODE_PLACE_TYPE_LIGHT_RAIL_STATION:
- icon_name = "poi-light-rail-station";
- break;
+ return "poi-light-rail-station";
default:
- icon_name = "poi-marker"; /* generic marker */
- break;
+ return "poi-marker"; /* generic marker */
}
-
- return icon_name;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]