Skip to content

Commit 3ef2d12

Browse files
Use memset instead of bzero. (#131)
1 parent 985f2c4 commit 3ef2d12

File tree

6 files changed

+14
-11
lines changed

6 files changed

+14
-11
lines changed

inc/version.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,6 @@ typedef unsigned char u_char;
289289
typedef unsigned long u_int;
290290
typedef signed char s_char;
291291
typedef unsigned short u_short;
292-
/* DOS doesn't have the BSD bzero &c functions */
293-
#define bzero(place,len) memset(place, 0, len)
294292
#undef UNALIGNED_FETCH_OK
295293
#undef HAS_GETHOSTID
296294
#undef REGISTER

src/Cldeetr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "version.h"
1818

1919
#include <stdio.h>
20+
#include <string.h>
2021
#include <ctype.h>
2122
#include <sys/types.h>
2223
#include <sys/time.h>
@@ -99,7 +100,7 @@ int main(int argc, char *argv[])
99100
perror("Couldn't GIFCONF socket; Net is off");
100101
#else /* OS4 */
101102

102-
bzero(ifbuf, sizeof(ifbuf));
103+
memset(ifbuf, 0, sizeof(ifbuf));
103104
{
104105
/* we have to get the interface name from another socket, since
105106
/dev/nit doesn't know anything until it gets bound, and we

src/ether.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#endif
1919

2020
#include <stdio.h>
21+
#include <string.h>
2122
#include <unistd.h>
2223
#include <ctype.h>
2324
#ifndef DOS
@@ -850,7 +851,7 @@ void init_ether() {
850851
if_data.ifc_len = sizeof(ifbuf);
851852
if_data.ifc_req = ifbuf;
852853
/* 4.0 - before the SIOCGIFCONF, do:
853-
bzero(ifbuf, sizeof(ifbuf))
854+
memset(ifbuf, 0, sizeof(ifbuf))
854855
*/
855856
if (ioctl(ether_fd, SIOCGIFCONF, &if_data) < 0) {
856857
perror("Couldn't GIFCONF socket; Net is off");
@@ -877,7 +878,7 @@ void init_ether() {
877878
}
878879
if_data.ifc_len = sizeof(ifbuf);
879880
if_data.ifc_req = ifbuf;
880-
bzero(ifbuf, sizeof(ifbuf));
881+
memset(ifbuf, 0, sizeof(ifbuf));
881882
{
882883
/* we have to get the interface name from another socket, since
883884
/dev/nit doesn't know anything until it gets bound, and we
@@ -978,7 +979,7 @@ void init_ether() {
978979

979980
#ifndef PKTFILTER
980981
/* establish the operating modes */
981-
bzero(&nioc, sizeof(nioc));
982+
memset(&nioc, 0, sizeof(nioc));
982983
nioc.nioc_bufspace = 20000;
983984
nioc.nioc_chunksize = 50; /* small chunks so each packet read */
984985
nioc.nioc_typetomatch = NT_ALLTYPES;

src/ldeether.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ int main(int argc, char *argv[]) { return (0); }
1818
/* THERE -IS- AN ETHERNET */
1919

2020
#include <stdio.h>
21+
#include <string.h>
2122

2223
#ifdef USE_DLPI
2324
#include <sys/stream.h>
@@ -168,7 +169,7 @@ int main(int argc, char *argv[]) {
168169
perror("Couldn't GIFCONF socket; Net is off");
169170
#else /* OS4 */
170171

171-
bzero(ifbuf, sizeof(ifbuf));
172+
memset(ifbuf, 0, sizeof(ifbuf));
172173
{
173174
/* we have to get the interface name from another socket, since
174175
/dev/nit doesn't know anything until it gets bound, and we

src/oether.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "version.h"
1212

1313
#include <stdio.h>
14+
#include <string.h>
1415
#include <ctype.h>
1516
#ifndef DOS
1617
#include <sys/file.h>
@@ -659,7 +660,7 @@ void init_ether() {
659660
if_data.ifc_len = sizeof(ifbuf);
660661
if_data.ifc_req = ifbuf;
661662
/* 4.0 - before the SIOCGIFCONF, do:
662-
bzero(ifbuf, sizeof(ifbuf))
663+
memset(ifbuf, 0, sizeof(ifbuf))
663664
*/
664665
if (ioctl(ether_fd, SIOCGIFCONF, &if_data) < 0) {
665666
perror("Couldn't GIFCONF socket; Net is off");
@@ -686,7 +687,7 @@ void init_ether() {
686687
}
687688
if_data.ifc_len = sizeof(ifbuf);
688689
if_data.ifc_req = ifbuf;
689-
bzero(ifbuf, sizeof(ifbuf));
690+
memset(ifbuf, 0, sizeof(ifbuf));
690691
{
691692
/* we have to get the interface name from another socket, since
692693
/dev/nit doesn't know anything until it gets bound, and we
@@ -783,7 +784,7 @@ if (ether_fd >= 0) {
783784

784785
#ifndef OS4
785786
/* establish the operating modes */
786-
bzero(&nioc, sizeof(nioc));
787+
memset(&nioc, 0, sizeof(nioc));
787788
nioc.nioc_bufspace = 20000;
788789
nioc.nioc_chunksize = 50; /* small chunks so each packet read */
789790
nioc.nioc_typetomatch = NT_ALLTYPES;

src/oldeether.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ int main(int argc, char *argv[])
1616
#else
1717

1818
#include <stdio.h>
19+
#include <string.h>
1920
#include <ctype.h>
2021
#include <sys/types.h>
2122
#include <sys/time.h>
@@ -97,7 +98,7 @@ int main(int argc, char *argv[])
9798
perror("Couldn't GIFCONF socket; Net is off");
9899
#else /* OS4 */
99100

100-
bzero(ifbuf, sizeof(ifbuf));
101+
memset(ifbuf, 0, sizeof(ifbuf));
101102
{
102103
/* we have to get the interface name from another socket, since
103104
/dev/nit doesn't know anything until it gets bound, and we

0 commit comments

Comments
 (0)