On Tue, Jul 24, 2012 at 4:54 PM, Glenn Fowler <g...@research.att.com> wrote: > On Tue, 24 Jul 2012 16:13:46 +0200 Roland Mainz wrote: >> Attached (as "astksh_stpcpy.diff") is a small patch which adds >> |stpcpy()| and |stpncpy()| to libast (if the system doesn't provide >> them). > >> IMO it would be nice to put this _both_ into the ksh93u+ and ksh93v- >> trees... risk should be very small (except there is a platform which >> doesn't have |strnlen()|). > [snip] > >> P.S.: ast-open needs a purge of cases where |strcat()| is used >> multiple times in sequence, cases of |sprintf(buf, "%s%s", ...)| etc. >> etc. and have these abdominations all replaced by |stpcpy()| (because >> it's faster&&more efficient, e.g. |strcat(buf, "aaa"); strcat(buf, >> "bbb");| can be replaced with |char *s=buf; s=stpcpy(s, "aaa"); >> s=stpcpy(s, "bbb");| ... this will be faster because |strcat()| always >> starts from the beginning of the buffer and then searches for the end >> while |stpcpy()| allows an application to always continue immediately >> where the old string ended). [snip] > > except for some contributed ksh code ast does not use strcat() > from way back ast had strcopy() which is basically stpcpy() > if sizes are know we use strcopy() or memcpy() > otherwise the typical paradigm is to use stk*() or sfstr*() > > no patches to ksh93u+ code base > "even the seemingly simplest change can wreak unforseen havoc" > we are only fixing dire ksh93u+ regressions at this point > and we are down to one of those on freebsd > > for ksh93v- code base I will change strcopy() to use stpcpy() > and ast will provide stpcpy() if its not there > ast will also provide stpncpy() with an iffe for strnlen() > that will fall back to memchr() > Erm... ping! ... ... |stpcpy()| is still missing... ... should I re-send the patch ?
---- Bye, Roland -- __ . . __ (o.\ \/ /.o) roland.ma...@nrubsig.org \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 3992797 (;O/ \/ \O;) _______________________________________________ ast-developers mailing list ast-developers@research.att.com https://mailman.research.att.com/mailman/listinfo/ast-developers