[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-dev] [PATCH 2/6] bzero() is gone in POSIX 2008. Use memset()
From: |
Gary E. Miller |
Subject: |
Re: [gpsd-dev] [PATCH 2/6] bzero() is gone in POSIX 2008. Use memset() |
Date: |
Tue, 6 Sep 2016 17:08:45 -0700 |
Yo Fred!
No need, bzerto() was removed in:
commit bdc21096c8bf8e49c9149a048c9b2b010ab9e6ef
On Mon, 5 Sep 2016 18:09:24 -0700
Fred Wright <address@hidden> wrote:
> This is the bzero() fix from commit 6692860, without the other
> _DEFAULT_SOURCE hacks.
>
> TESTED:
> Ran "scons build-all check" successfully on OSX, Linux, FreeBSD,
> OpenBSD, and NetBSD.
> ---
> contrib/binlog.c | 2 +-
> contrib/motosend.c | 6 +++---
> driver_garmin_txt.c | 4 ++--
> driver_sirf.c | 2 +-
> gpspipe.c | 2 +-
> 5 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/contrib/binlog.c b/contrib/binlog.c
> index 8e5e8d9..3093732 100644
> --- a/contrib/binlog.c
> +++ b/contrib/binlog.c
> @@ -62,7 +62,7 @@ int main(int argc, char **argv) {
> if (l > 0)
> assert(write(ofd, buf, l) > 0);
> usleep(1000);
> - bzero(buf, BUFSIZ);
> + memset(buf, 0, BUFSIZ);
> spinner( n++ );
> }
> /* NOTREACHED */
> diff --git a/contrib/motosend.c b/contrib/motosend.c
> index 3073158..0778fda 100644
> --- a/contrib/motosend.c
> +++ b/contrib/motosend.c
> @@ -83,7 +83,7 @@ int main(int argc, char **argv) {
> t = 0; n = 0;
> while (1){
> usleep(1000);
> - bzero(buf, BSIZ);
> + memset(buf, 0, BSIZ);
> if ((l = read(fd, buf, BSIZ)) == -1)
> if (!(EINTR == errno || EAGAIN == errno))
> err(1, "read");
> @@ -121,7 +121,7 @@ static int moto_send(int fd, char *type, char
> *body ) { if ((buf = malloc(l+7)) == NULL)
> return -1;
>
> - bzero(buf, l+7);
> + memset(buf, 0, l+7);
> buf[0] = '@'; buf[1] = '@';
> buf[2] = type[0]; buf[3] = type[1];
>
> @@ -174,7 +174,7 @@ int gpsd_hexpack(char *src, char *dst, int len)
> if ((l < 1) || (l > len))
> return -1;
>
> - bzero(dst, len);
> + memset(dst, 0, len);
> for (i = 0; i < l; i++) {
> int k;
> if ((k = hex2bin(src+i*2)) != -1)
> diff --git a/driver_garmin_txt.c b/driver_garmin_txt.c
> index 8631ee3..c14c516 100644
> --- a/driver_garmin_txt.c
> +++ b/driver_garmin_txt.c
> @@ -155,7 +155,7 @@ static int gar_decode(const struct gps_context_t
> *context, return -1;
> }
>
> - bzero(buf, (int)sizeof(buf));
> + memset(buf, 0, (int)sizeof(buf));
> (void)strlcpy(buf, data, length);
> gpsd_log(&context->errout, LOG_RAW + 2, "Decoded string: %s\n",
> buf);
> @@ -223,7 +223,7 @@ static int gar_int_decode(const struct
> gps_context_t *context, return -1;
> }
>
> - bzero(buf, (int)sizeof(buf));
> + memset(buf, 0, (int)sizeof(buf));
> (void)strlcpy(buf, data, length);
> gpsd_log(&context->errout, LOG_RAW + 2, "Decoded string: %s\n",
> buf);
> diff --git a/driver_sirf.c b/driver_sirf.c
> index a377d7f..deec232 100644
> --- a/driver_sirf.c
> +++ b/driver_sirf.c
> @@ -415,7 +415,7 @@ static gps_mask_t sirf_msg_debug(struct
> gps_device_t *device, char msgbuf[MAX_PACKET_LENGTH * 3 + 2];
> int i;
>
> - bzero(msgbuf, (int)sizeof(msgbuf));
> + memset(msgbuf, 0, (int)sizeof(msgbuf));
>
> if (0xe1 == buf[0]) { /* Development statistics messages
> */ for (i = 2; i < (int)len; i++)
> diff --git a/gpspipe.c b/gpspipe.c
> index 33d015c..a670581 100644
> --- a/gpspipe.c
> +++ b/gpspipe.c
> @@ -77,7 +77,7 @@ static void open_serial(char *device)
> }
>
> /* Clear struct for new port settings. */
> - bzero(&newtio, sizeof(newtio));
> + memset(&newtio, 0, sizeof(newtio));
>
> /* make it raw */
> (void)cfmakeraw(&newtio);
RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
address@hidden Tel:+1 541 382 8588
pgpIB3jcpsFSu.pgp
Description: OpenPGP digital signature
- Re: [gpsd-dev] [PATCH 4/6] Replaces deprecated usleep() with nanosleep()-based alternative., (continued)
[gpsd-dev] [PATCH 5/6] Fixes usleep() and other issues in contrib/ programs., Fred Wright, 2016/09/05
[gpsd-dev] [PATCH 6/6] Eliminates the one use of the portability-challenged alloca()., Fred Wright, 2016/09/05
[gpsd-dev] [PATCH 2/6] bzero() is gone in POSIX 2008. Use memset(), Fred Wright, 2016/09/05
- Re: [gpsd-dev] [PATCH 2/6] bzero() is gone in POSIX 2008. Use memset(),
Gary E. Miller <=
[gpsd-dev] [PATCH 3/6] bcopy() gone in POSIX 2008., Fred Wright, 2016/09/05
Re: [gpsd-dev] [PATCH 1/6] Reverts most C99-related changes., Gary E. Miller, 2016/09/05