1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-08 11:27:32 +03:00

Merge pull request #1412 from zonque/strempty

tree-wide: use strempty() where possible
This commit is contained in:
Lennart Poettering 2015-09-30 12:00:46 +02:00
commit 68382f22d7
4 changed files with 7 additions and 7 deletions

View File

@ -385,7 +385,7 @@ static int pppoe_send_initiation(sd_pppoe *ppp) {
return r; return r;
log_debug("PPPoE: sent DISCOVER (Service-Name: %s)", log_debug("PPPoE: sent DISCOVER (Service-Name: %s)",
ppp->service_name ? : ""); strempty(ppp->service_name));
pppoe_arm_timeout(ppp); pppoe_arm_timeout(ppp);
@ -625,8 +625,8 @@ static int pppoe_handle_message(sd_pppoe *ppp, struct pppoe_hdr *packet, struct
mac->ether_addr_octet[3], mac->ether_addr_octet[3],
mac->ether_addr_octet[4], mac->ether_addr_octet[4],
mac->ether_addr_octet[5], mac->ether_addr_octet[5],
ppp->tags.service_name ? : "", strempty(ppp->tags.service_name),
ppp->tags.ac_name ? : ""); strempty(ppp->tags.ac_name));
memcpy(&ppp->peer_mac, mac, ETH_ALEN); memcpy(&ppp->peer_mac, mac, ETH_ALEN);

View File

@ -114,7 +114,7 @@ static int show_sysfs_one(
"%s%s:%s%s%s%s", "%s%s:%s%s%s%s",
is_master ? "[MASTER] " : "", is_master ? "[MASTER] " : "",
subsystem, sysname, subsystem, sysname,
name ? " \"" : "", name ? name : "", name ? "\"" : "") < 0) name ? " \"" : "", strempty(name), name ? "\"" : "") < 0)
return -ENOMEM; return -ENOMEM;
free(k); free(k);

View File

@ -3524,7 +3524,7 @@ static void print_status_info(
printf("Condition: start %scondition failed%s at %s%s%s\n", printf("Condition: start %scondition failed%s at %s%s%s\n",
ansi_highlight_yellow(), ansi_normal(), ansi_highlight_yellow(), ansi_normal(),
s2, s1 ? "; " : "", s1 ? s1 : ""); s2, s1 ? "; " : "", strempty(s1));
if (i->failed_condition_trigger) if (i->failed_condition_trigger)
printf(" none of the trigger conditions were met\n"); printf(" none of the trigger conditions were met\n");
else if (i->failed_condition) else if (i->failed_condition)
@ -3540,7 +3540,7 @@ static void print_status_info(
printf(" Assert: start %sassertion failed%s at %s%s%s\n", printf(" Assert: start %sassertion failed%s at %s%s%s\n",
ansi_highlight_red(), ansi_normal(), ansi_highlight_red(), ansi_normal(),
s2, s1 ? "; " : "", s1 ? s1 : ""); s2, s1 ? "; " : "", strempty(s1));
if (i->failed_assert_trigger) if (i->failed_assert_trigger)
printf(" none of the trigger assertions were met\n"); printf(" none of the trigger assertions were met\n");
else if (i->failed_assert) else if (i->failed_assert)

View File

@ -256,7 +256,7 @@ static int parse_password(const char *filename, char **wall) {
if (asprintf(&_wall, if (asprintf(&_wall,
"%s%sPassword entry required for \'%s\' (PID %u).\r\n" "%s%sPassword entry required for \'%s\' (PID %u).\r\n"
"Please enter password with the systemd-tty-ask-password-agent tool!", "Please enter password with the systemd-tty-ask-password-agent tool!",
*wall ? *wall : "", strempty(*wall),
*wall ? "\r\n\r\n" : "", *wall ? "\r\n\r\n" : "",
message, message,
pid) < 0) pid) < 0)