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

Merge pull request #1108 from phomes/dont-shadow-globals

tree-wide: do not shadow the global var timezone
This commit is contained in:
David Herrmann 2015-09-01 18:33:54 +02:00
commit 3a487d41d7
6 changed files with 20 additions and 20 deletions

View File

@ -1046,7 +1046,7 @@ clockid_t clock_boottime_or_monotonic(void) {
return clock; return clock;
} }
int get_timezone(char **timezone) { int get_timezone(char **tz) {
_cleanup_free_ char *t = NULL; _cleanup_free_ char *t = NULL;
const char *e; const char *e;
char *z; char *z;
@ -1069,6 +1069,6 @@ int get_timezone(char **timezone) {
if (!z) if (!z)
return -ENOMEM; return -ENOMEM;
*timezone = z; *tz = z;
return 0; return 0;
} }

View File

@ -1121,13 +1121,13 @@ int dhcp_lease_set_client_id(sd_dhcp_lease *lease, const void *client_id, size_t
return 0; return 0;
} }
int sd_dhcp_lease_get_timezone(sd_dhcp_lease *lease, const char **timezone) { int sd_dhcp_lease_get_timezone(sd_dhcp_lease *lease, const char **tz) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(timezone, -EINVAL); assert_return(tz, -EINVAL);
if (!lease->timezone) if (!lease->timezone)
return -ENODATA; return -ENODATA;
*timezone = lease->timezone; *tz = lease->timezone;
return 0; return 0;
} }

View File

@ -1062,16 +1062,16 @@ int sd_dhcp_server_forcerenew(sd_dhcp_server *server) {
return r; return r;
} }
int sd_dhcp_server_set_timezone(sd_dhcp_server *server, const char *timezone) { int sd_dhcp_server_set_timezone(sd_dhcp_server *server, const char *tz) {
int r; int r;
assert_return(server, -EINVAL); assert_return(server, -EINVAL);
assert_return(timezone_is_valid(timezone), -EINVAL); assert_return(timezone_is_valid(tz), -EINVAL);
if (streq_ptr(timezone, server->timezone)) if (streq_ptr(tz, server->timezone))
return 0; return 0;
r = free_and_strdup(&server->timezone, timezone); r = free_and_strdup(&server->timezone, tz);
if (r < 0) if (r < 0)
return r; return r;

View File

@ -497,7 +497,7 @@ static int link_status_one(
sd_hwdb *hwdb, sd_hwdb *hwdb,
const char *name) { const char *name) {
_cleanup_strv_free_ char **dns = NULL, **ntp = NULL, **domains = NULL; _cleanup_strv_free_ char **dns = NULL, **ntp = NULL, **domains = NULL;
_cleanup_free_ char *setup_state = NULL, *operational_state = NULL, *timezone = NULL; _cleanup_free_ char *setup_state = NULL, *operational_state = NULL, *tz = NULL;
_cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL; _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
_cleanup_device_unref_ sd_device *d = NULL; _cleanup_device_unref_ sd_device *d = NULL;
char devid[2 + DECIMAL_STR_MAX(int)]; char devid[2 + DECIMAL_STR_MAX(int)];
@ -662,9 +662,9 @@ static int link_status_one(
if (!strv_isempty(carrier_bound_by)) if (!strv_isempty(carrier_bound_by))
dump_list("Carrier Bound By: ", carrier_bound_by); dump_list("Carrier Bound By: ", carrier_bound_by);
(void) sd_network_link_get_timezone(ifindex, &timezone); (void) sd_network_link_get_timezone(ifindex, &tz);
if (timezone) if (tz)
printf(" Time Zone: %s", timezone); printf(" Time Zone: %s", tz);
return 0; return 0;
} }

View File

@ -967,14 +967,14 @@ static int set_timezone_handler(sd_bus_message *m, void *userdata, sd_bus_error
return 1; return 1;
} }
int link_set_timezone(Link *link, const char *timezone) { int link_set_timezone(Link *link, const char *tz) {
int r; int r;
assert(link); assert(link);
assert(link->manager); assert(link->manager);
assert(timezone); assert(tz);
log_link_debug(link, "Setting system timezone: '%s'", timezone); log_link_debug(link, "Setting system timezone: '%s'", tz);
if (!link->manager->bus) { if (!link->manager->bus) {
log_link_info(link, "Not connected to system bus, ignoring timezone."); log_link_info(link, "Not connected to system bus, ignoring timezone.");
@ -991,7 +991,7 @@ int link_set_timezone(Link *link, const char *timezone) {
set_timezone_handler, set_timezone_handler,
link, link,
"sb", "sb",
timezone, tz,
false); false);
if (r < 0) if (r < 0)
return log_link_error_errno(link, r, "Could not set timezone: %m"); return log_link_error_errno(link, r, "Could not set timezone: %m");

View File

@ -786,7 +786,7 @@ int config_parse_timezone(
void *data, void *data,
void *userdata) { void *userdata) {
char **timezone = data, *tz = NULL; char **datap = data, *tz = NULL;
int r; int r;
assert(filename); assert(filename);
@ -803,8 +803,8 @@ int config_parse_timezone(
return 0; return 0;
} }
free(*timezone); free(*datap);
*timezone = tz; *datap = tz;
return 0; return 0;
} }