1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

refcnt: refcnt is unsigned, fix comparisons

This does not make a difference, but the code was confusing.
This commit is contained in:
Tom Gundersen 2015-01-13 23:03:11 +01:00
parent ab5e3a1bcc
commit f0c4b1c3fd
9 changed files with 9 additions and 9 deletions

View File

@ -1672,7 +1672,7 @@ sd_dhcp_client *sd_dhcp_client_ref(sd_dhcp_client *client) {
} }
sd_dhcp_client *sd_dhcp_client_unref(sd_dhcp_client *client) { sd_dhcp_client *sd_dhcp_client_unref(sd_dhcp_client *client) {
if (client && REFCNT_DEC(client->n_ref) <= 0) { if (client && REFCNT_DEC(client->n_ref) == 0) {
log_dhcp_client(client, "FREE"); log_dhcp_client(client, "FREE");
client_initialize(client); client_initialize(client);

View File

@ -193,7 +193,7 @@ sd_dhcp_lease *sd_dhcp_lease_ref(sd_dhcp_lease *lease) {
} }
sd_dhcp_lease *sd_dhcp_lease_unref(sd_dhcp_lease *lease) { sd_dhcp_lease *sd_dhcp_lease_unref(sd_dhcp_lease *lease) {
if (lease && REFCNT_DEC(lease->n_ref) <= 0) { if (lease && REFCNT_DEC(lease->n_ref) == 0) {
free(lease->hostname); free(lease->hostname);
free(lease->domainname); free(lease->domainname);
free(lease->dns); free(lease->dns);

View File

@ -1254,7 +1254,7 @@ sd_dhcp6_client *sd_dhcp6_client_ref(sd_dhcp6_client *client) {
} }
sd_dhcp6_client *sd_dhcp6_client_unref(sd_dhcp6_client *client) { sd_dhcp6_client *sd_dhcp6_client_unref(sd_dhcp6_client *client) {
if (client && REFCNT_DEC(client->n_ref) <= 0) { if (client && REFCNT_DEC(client->n_ref) == 0) {
client_reset(client); client_reset(client);
sd_dhcp6_client_detach_event(client); sd_dhcp6_client_detach_event(client);

View File

@ -195,7 +195,7 @@ sd_dhcp6_lease *sd_dhcp6_lease_ref(sd_dhcp6_lease *lease) {
} }
sd_dhcp6_lease *sd_dhcp6_lease_unref(sd_dhcp6_lease *lease) { sd_dhcp6_lease *sd_dhcp6_lease_unref(sd_dhcp6_lease *lease) {
if (lease && REFCNT_DEC(lease->n_ref) <= 0) { if (lease && REFCNT_DEC(lease->n_ref) == 0) {
free(lease->serverid); free(lease->serverid);
dhcp6_lease_free_ia(&lease->ia); dhcp6_lease_free_ia(&lease->ia);

View File

@ -145,7 +145,7 @@ static int icmp6_nd_init(sd_icmp6_nd *nd) {
} }
sd_icmp6_nd *sd_icmp6_nd_unref(sd_icmp6_nd *nd) { sd_icmp6_nd *sd_icmp6_nd_unref(sd_icmp6_nd *nd) {
if (nd && REFCNT_DEC(nd->n_ref) <= 0) { if (nd && REFCNT_DEC(nd->n_ref) == 0) {
icmp6_nd_init(nd); icmp6_nd_init(nd);
sd_icmp6_nd_detach_event(nd); sd_icmp6_nd_detach_event(nd);

View File

@ -605,7 +605,7 @@ sd_ipv4ll *sd_ipv4ll_ref(sd_ipv4ll *ll) {
} }
sd_ipv4ll *sd_ipv4ll_unref(sd_ipv4ll *ll) { sd_ipv4ll *sd_ipv4ll_unref(sd_ipv4ll *ll) {
if (ll && REFCNT_DEC(ll->n_ref) <= 0) { if (ll && REFCNT_DEC(ll->n_ref) == 0) {
ll->receive_message = ll->receive_message =
sd_event_source_unref(ll->receive_message); sd_event_source_unref(ll->receive_message);
ll->fd = safe_close(ll->fd); ll->fd = safe_close(ll->fd);

View File

@ -344,7 +344,7 @@ _public_ sd_hwdb *sd_hwdb_ref(sd_hwdb *hwdb) {
} }
_public_ sd_hwdb *sd_hwdb_unref(sd_hwdb *hwdb) { _public_ sd_hwdb *sd_hwdb_unref(sd_hwdb *hwdb) {
if (hwdb && REFCNT_DEC(hwdb->n_ref) <= 0) { if (hwdb && REFCNT_DEC(hwdb->n_ref) == 0) {
if (hwdb->map) if (hwdb->map)
munmap((void *)hwdb->map, hwdb->st.st_size); munmap((void *)hwdb->map, hwdb->st.st_size);
if (hwdb->f) if (hwdb->f)

View File

@ -586,7 +586,7 @@ sd_rtnl_message *sd_rtnl_message_ref(sd_rtnl_message *m) {
} }
sd_rtnl_message *sd_rtnl_message_unref(sd_rtnl_message *m) { sd_rtnl_message *sd_rtnl_message_unref(sd_rtnl_message *m) {
if (m && REFCNT_DEC(m->n_ref) <= 0) { if (m && REFCNT_DEC(m->n_ref) == 0) {
unsigned i; unsigned i;
free(m->hdr); free(m->hdr);

View File

@ -187,7 +187,7 @@ sd_rtnl *sd_rtnl_unref(sd_rtnl *rtnl) {
assert_return(!rtnl_pid_changed(rtnl), NULL); assert_return(!rtnl_pid_changed(rtnl), NULL);
if (REFCNT_DEC(rtnl->n_ref) <= 0) { if (REFCNT_DEC(rtnl->n_ref) == 0) {
struct match_callback *f; struct match_callback *f;
unsigned i; unsigned i;