chiark / gitweb /
tree-wide: use our memset() macros instead of memset() itself
authorLennart Poettering <lennart@poettering.net>
Thu, 11 Dec 2014 15:58:45 +0000 (16:58 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 11 Dec 2014 15:58:45 +0000 (16:58 +0100)
src/libsystemd-network/sd-icmp6-nd.c
src/libsystemd-terminal/term-screen.c
src/shared/hashmap.c
src/test/test-pty.c
src/test/test-ring.c

index cb06151514051b45030bbee9b1530e4fd09cbaaf..fbaf093ad88fe00d1286741af335ae8543d508fe 100644 (file)
@@ -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;
 
index 51d93765e49e8d4c30afb3ef4f9dc0b0abeb8822..f021ffee23c960c80347a047c21ac3de51a51e86 100644 (file)
@@ -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;
         }
 
index 5b329e0851fd80287539f0e985068b87fdd9222f..18c2c0ea3cb50a6c874f1bf6da6f4d2c09f86e56 100644 (file)
@@ -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 {
                         /*
index ed23e9f0f128f6261964efcfd7dcadddf10f163d..cab569a9da78280c02612be3f599124529cade07 100644 (file)
@@ -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);
 
index 5e4efdbde9a4c53bc3846513fc3fc11391d97c4a..a9dd01ca01b722291c578a8b84d9f18722f0fa7d 100644 (file)
@@ -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);