On Wed, Dec 06, 2017 at 04:58:27PM +0800, Michael W. Bombardieri wrote: > Hello, > > Mostly dc(1) uses its own bstrdup() which exits on error. > It can be used in two more places. > > - Michael
Committed, thanks -Otto > > > Index: dc.c > =================================================================== > RCS file: /cvs/src/usr.bin/dc/dc.c,v > retrieving revision 1.19 > diff -u -p -u -r1.19 dc.c > --- dc.c 29 Nov 2017 14:34:17 -0000 1.19 > +++ dc.c 6 Dec 2017 08:44:30 -0000 > @@ -47,8 +47,7 @@ dc_main(int argc, char *argv[]) > char *buf, *p; > struct stat st; > > - if ((buf = strdup("")) == NULL) > - err(1, NULL); > + buf = bstrdup(""); > /* accept and ignore a single dash to be 4.4BSD dc(1) compatible */ > optind = 1; > optreset = 1; > Index: stack.c > =================================================================== > RCS file: /cvs/src/usr.bin/dc/stack.c,v > retrieving revision 1.14 > diff -u -p -u -r1.14 stack.c > --- stack.c 27 Mar 2016 15:55:13 -0000 1.14 > +++ stack.c 6 Dec 2017 08:44:30 -0000 > @@ -79,9 +79,7 @@ stack_dup_value(const struct value *a, s > copy->u.num = dup_number(a->u.num); > break; > case BCODE_STRING: > - copy->u.string = strdup(a->u.string); > - if (copy->u.string == NULL) > - err(1, NULL); > + copy->u.string = bstrdup(a->u.string); > break; > } >