Small performance fixes

Removed some unnecessary checks
This commit is contained in:
Gergely Polonkai 2013-10-04 01:00:26 +02:00
parent bd54b5d37a
commit 20a350eacc
4 changed files with 16 additions and 52 deletions

View File

@ -239,11 +239,7 @@ gswe_aspect_data_set_planet2(GsweAspectData *aspect_data, GswePlanetData *planet
GswePlanetData *
gswe_aspect_data_get_planet2(GsweAspectData *aspect_data)
{
if (aspect_data) {
return aspect_data->planet2;
} else {
return NULL;
}
return aspect_data->planet2;
}
/**
@ -257,11 +253,7 @@ gswe_aspect_data_get_planet2(GsweAspectData *aspect_data)
gdouble
gswe_aspect_data_get_distance(GsweAspectData *aspect_data)
{
if (aspect_data) {
return aspect_data->distance;
} else {
return -1.0;
}
return aspect_data->distance;
}
/**
@ -293,11 +285,7 @@ gswe_aspect_data_get_aspect(GsweAspectData *aspect_data)
GsweAspectInfo *
gswe_aspect_data_get_aspect_info(GsweAspectData *aspect_data)
{
if (aspect_data) {
return aspect_data->aspect_info;
} else {
return NULL;
}
return aspect_data->aspect_info;
}
/**
@ -311,10 +299,6 @@ gswe_aspect_data_get_aspect_info(GsweAspectData *aspect_data)
gdouble
gswe_aspect_data_get_difference(GsweAspectData *aspect_data)
{
if (aspect_data) {
return aspect_data->difference;
} else {
return -1.0;
}
return aspect_data->difference;
}

View File

@ -42,13 +42,11 @@ G_DEFINE_BOXED_TYPE(GsweAspectInfo, gswe_aspect_info, (GBoxedCopyFunc)gswe_aspec
static void
gswe_aspect_info_free(GsweAspectInfo *aspect_info)
{
if (aspect_info) {
if (aspect_info->name) {
g_free(aspect_info->name);
}
g_free(aspect_info);
if (aspect_info->name) {
g_free(aspect_info->name);
}
g_free(aspect_info);
}
/**
@ -240,11 +238,7 @@ gswe_aspect_info_set_harmonic(GsweAspectInfo *aspect_info, gboolean harmonic)
gboolean
gswe_aspect_info_get_harmonic(GsweAspectInfo *aspect_info)
{
if (aspect_info) {
return aspect_info->harmonic;
} else {
return FALSE;
}
return aspect_info->harmonic;
}
/**
@ -273,10 +267,6 @@ gswe_aspect_info_set_major(GsweAspectInfo *aspect_info, gboolean major)
gboolean
gswe_aspect_info_get_major(GsweAspectInfo *aspect_info)
{
if (aspect_info) {
return aspect_info->major;
} else {
return FALSE;
}
return aspect_info->major;
}

View File

@ -93,11 +93,7 @@ gswe_moon_phase_data_unref(GsweMoonPhaseData *moon_phase_data)
GsweMoonPhase
gswe_moon_phase_data_get_phase(GsweMoonPhaseData *moon_phase_data)
{
if (moon_phase_data) {
return moon_phase_data->phase;
} else {
return GSWE_MOON_PHASE_NONE;
}
return moon_phase_data->phase;
}
/**
@ -111,10 +107,6 @@ gswe_moon_phase_data_get_phase(GsweMoonPhaseData *moon_phase_data)
gdouble
gswe_moon_phase_data_get_illumination(GsweMoonPhaseData *moon_phase_data)
{
if (moon_phase_data) {
return moon_phase_data->illumination;
} else {
return 0.0;
}
return moon_phase_data->illumination;
}

View File

@ -35,13 +35,11 @@ G_DEFINE_BOXED_TYPE(GsweSignInfo, gswe_sign_info, (GBoxedCopyFunc)gswe_sign_info
static void
gswe_sign_info_free(GsweSignInfo *sign_info)
{
if (sign_info) {
if (sign_info->name) {
g_free(sign_info->name);
}
g_free(sign_info);
if (sign_info->name) {
g_free(sign_info->name);
}
g_free(sign_info);
}
/**