From eccaf899331ecbe3807739b6356ebba3d71480c7 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 11 Dec 2014 16:58:45 +0100 Subject: tree-wide: use our memset() macros instead of memset() itself --- src/libsystemd-network/sd-icmp6-nd.c | 2 +- src/libsystemd-terminal/term-screen.c | 2 +- src/shared/hashmap.c | 6 +++--- src/test/test-pty.c | 2 +- src/test/test-ring.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/libsystemd-network/sd-icmp6-nd.c b/src/libsystemd-network/sd-icmp6-nd.c index cb06151514..fbaf093ad8 100644 --- a/src/libsystemd-network/sd-icmp6-nd.c +++ b/src/libsystemd-network/sd-icmp6-nd.c @@ -87,7 +87,7 @@ int sd_icmp6_nd_set_mac(sd_icmp6_nd *nd, const struct ether_addr *mac_addr) { if (mac_addr) memcpy(&nd->mac_addr, mac_addr, sizeof(nd->mac_addr)); else - memset(&nd->mac_addr, 0x00, sizeof(nd->mac_addr)); + zero(nd->mac_addr); return 0; diff --git a/src/libsystemd-terminal/term-screen.c b/src/libsystemd-terminal/term-screen.c index 51d93765e4..f021ffee23 100644 --- a/src/libsystemd-terminal/term-screen.c +++ b/src/libsystemd-terminal/term-screen.c @@ -3184,7 +3184,7 @@ static int screen_TBC(term_screen *screen, const term_seq *seq) { break; case 3: if (screen->page->width > 0) - memset(screen->tabs, 0, (screen->page->width + 7) / 8); + memzero(screen->tabs, (screen->page->width + 7) / 8); break; } diff --git a/src/shared/hashmap.c b/src/shared/hashmap.c index 5b329e0851..18c2c0ea3c 100644 --- a/src/shared/hashmap.c +++ b/src/shared/hashmap.c @@ -482,7 +482,7 @@ static unsigned skip_free_buckets(HashmapBase *h, unsigned idx) { } static void bucket_mark_free(HashmapBase *h, unsigned idx) { - memset(bucket_at(h, idx), 0, hashmap_type_info[h->type].entry_size); + memzero(bucket_at(h, idx), hashmap_type_info[h->type].entry_size); bucket_set_dib(h, idx, DIB_FREE); } @@ -1154,7 +1154,7 @@ static int resize_buckets(HashmapBase *h, unsigned entries_add) { } /* Zero the area of newly added entries (including the old DIB area) */ - memset(bucket_at(h, old_n_buckets), 0, + memzero(bucket_at(h, old_n_buckets), (n_buckets(h) - old_n_buckets) * hi->entry_size); /* The upper half of the new DIB array needs initialization */ @@ -1182,7 +1182,7 @@ static int resize_buckets(HashmapBase *h, unsigned entries_add) { new_dibs[idx] = DIB_RAW_FREE; bucket_move_entry(h, &swap, idx, IDX_PUT); /* bucket_move_entry does not clear the source */ - memset(bucket_at(h, idx), 0, hi->entry_size); + memzero(bucket_at(h, idx), hi->entry_size); do { /* diff --git a/src/test/test-pty.c b/src/test/test-pty.c index ed23e9f0f1..cab569a9da 100644 --- a/src/test/test-pty.c +++ b/src/test/test-pty.c @@ -100,7 +100,7 @@ static void test_pty(void) { Pty *pty; rcvsiz = 0; - memset(rcvbuf, 0, sizeof(rcvbuf)); + zero(rcvbuf); assert_se(sd_event_default(&event) >= 0); diff --git a/src/test/test-ring.c b/src/test/test-ring.c index 5e4efdbde9..a9dd01ca01 100644 --- a/src/test/test-ring.c +++ b/src/test/test-ring.c @@ -36,7 +36,7 @@ static void test_ring(void) { struct iovec vec[2]; int s; - memset(&r, 0, sizeof(r)); + zero(r); l = ring_peek(&r, vec); assert_se(l == 0); -- cgit v1.2.3-54-g00ecf