[systemd-commits] src/libsystemd-network src/libsystemd-terminal src/shared src/test

Lennart Poettering lennart at kemper.freedesktop.org
Thu Dec 11 07:58:50 PST 2014


 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(-)

New commits:
commit eccaf899331ecbe3807739b6356ebba3d71480c7
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Dec 11 16:58:45 2014 +0100

    tree-wide: use our memset() macros instead of memset() itself

diff --git a/src/libsystemd-network/sd-icmp6-nd.c b/src/libsystemd-network/sd-icmp6-nd.c
index cb06151..fbaf093 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 51d9376..f021ffe 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 5b329e0..18c2c0e 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 ed23e9f..cab569a 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 5e4efdb..a9dd01c 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);



More information about the systemd-commits mailing list