Michael W. Bombardieri wrote:
> On Thu, Nov 05, 2015 at 03:50:29PM +0100, Tobias Stoeckmann wrote:
> > On Thu, Nov 05, 2015 at 09:50:48AM +0000, Nicholas Marriott wrote:
> > > I don't know why cvs and rcs xmalloc.c has ended up so different.
> >
> > It's not just about cvs and rcs:
> >
> > /usr/src/usr.bin/cvs/xmalloc.c
> > /usr/src/usr.bin/diff/xmalloc.c
> > /usr/src/usr.bin/file/xmalloc.c
> > /usr/src/usr.bin/rcs/xmalloc.c
> > /usr/src/usr.bin/ssh/xmalloc.c
> > /usr/src/usr.bin/tmux/xmalloc.c (probably not same origin)
>
> Also note that aucat(1)'s utils.c contains xmalloc() and xfree().
> Its version of xfree() contains no special logic so remove it?
ok mmcc@
> Index: abuf.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/aucat/abuf.c,v
> retrieving revision 1.26
> diff -u -p -u -r1.26 abuf.c
> --- abuf.c 21 Jan 2015 08:43:55 -0000 1.26
> +++ abuf.c 8 Nov 2015 02:16:41 -0000
> @@ -62,7 +62,7 @@ abuf_done(struct abuf *buf)
> }
> }
> #endif
> - xfree(buf->data);
> + free(buf->data);
> buf->data = (void *)0xdeadbeef;
> }
>
> Index: aucat.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/aucat/aucat.c,v
> retrieving revision 1.149
> diff -u -p -u -r1.149 aucat.c
> --- aucat.c 27 Aug 2015 07:25:56 -0000 1.149
> +++ aucat.c 8 Nov 2015 02:16:42 -0000
> @@ -214,7 +214,7 @@ slot_new(char *path, int mode, struct ap
> if (!afile_open(&s->afile, path, hdr,
> mode == SIO_PLAY ? AFILE_FREAD : AFILE_FWRITE,
> par, rate, cmax - cmin + 1)) {
> - xfree(s);
> + free(s);
> return 0;
> }
> s->cmin = cmin;
> @@ -413,15 +413,13 @@ slot_del(struct slot *s)
> }
> #endif
> abuf_done(&s->buf);
> - if (s->resampbuf)
> - xfree(s->resampbuf);
> - if (s->convbuf)
> - xfree(s->convbuf);
> + free(s->resampbuf);
> + free(s->convbuf);
> }
> for (ps = &slot_list; *ps != s; ps = &(*ps)->next)
> ; /* nothing */
> *ps = s->next;
> - xfree(s);
> + free(s);
> }
>
> static int
> @@ -672,9 +670,9 @@ dev_close(void)
> if (dev_mh)
> mio_close(dev_mh);
> if (dev_mode & SIO_PLAY)
> - xfree(dev_pbuf);
> + free(dev_pbuf);
> if (dev_mode & SIO_REC)
> - xfree(dev_rbuf);
> + free(dev_rbuf);
> }
>
> static void
> @@ -999,7 +997,7 @@ offline(void)
> slot_list_copy(todo, dev_pchan, dev_pbuf);
> slot_list_iodo();
> }
> - xfree(dev_pbuf);
> + free(dev_pbuf);
> while (slot_list)
> slot_del(slot_list);
> return 1;
> @@ -1148,7 +1146,7 @@ playrec(char *dev, int mode, int bufsz,
>
> if (dev_pstate == DEV_START)
> dev_mmcstop();
> - xfree(pfds);
> + free(pfds);
> dev_close();
> while (slot_list)
> slot_del(slot_list);
> Index: utils.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/aucat/utils.c,v
> retrieving revision 1.1
> diff -u -p -u -r1.1 utils.c
> --- utils.c 21 Jan 2015 08:43:55 -0000 1.1
> +++ utils.c 8 Nov 2015 02:16:42 -0000
> @@ -158,15 +158,6 @@ xmalloc(size_t size)
> }
>
> /*
> - * free memory allocated with xmalloc()
> - */
> -void
> -xfree(void *p)
> -{
> - free(p);
> -}
> -
> -/*
> * xmalloc-style strdup(3)
> */
> char *
> Index: utils.h
> ===================================================================
> RCS file: /cvs/src/usr.bin/aucat/utils.h,v
> retrieving revision 1.1
> diff -u -p -u -r1.1 utils.h
> --- utils.h 21 Jan 2015 08:43:55 -0000 1.1
> +++ utils.h 8 Nov 2015 02:16:42 -0000
> @@ -29,7 +29,6 @@ void log_flush(void);
>
> void *xmalloc(size_t);
> char *xstrdup(char *);
> -void xfree(void *);
>
> /*
> * Log levels:
>