Introduce helper function empty_string()

There are ca. 50 constructs of the kind
  same_string(s, "")
to test for empty or null strings. Replace them by the new helper
function empty_string().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-01-07 11:12:48 +01:00 committed by Lubomir I. Ivanov
parent 86ef9fce75
commit e85ecdd925
21 changed files with 53 additions and 48 deletions

View file

@ -1177,11 +1177,11 @@ void filter_dive(struct dive *d, bool shown)
* (or the second one if the first one is empty */
void combine_trips(struct dive_trip *trip_a, struct dive_trip *trip_b)
{
if (same_string(trip_a->location, "") && trip_b->location) {
if (empty_string(trip_a->location) && trip_b->location) {
free(trip_a->location);
trip_a->location = strdup(trip_b->location);
}
if (same_string(trip_a->notes, "") && trip_b->notes) {
if (empty_string(trip_a->notes) && trip_b->notes) {
free(trip_a->notes);
trip_a->notes = strdup(trip_b->notes);
}