[Bug 195929] New: usr.bin/sed -- eliminate one malloc and add consts

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Dec 12 21:55:14 UTC 2014


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195929

            Bug ID: 195929
           Summary: usr.bin/sed -- eliminate one malloc and add consts
           Product: Base System
           Version: 10.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: mi at ALDAN.algebra.com

Created attachment 150515
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=150515&action=edit
Process -e optarg verbatim

When encountering an -e argument, sed currently mallocs a string to COPY the
optarg -- with '\n' appended. The appendage does not seem necessary -- indeed,
the same call to add_compunit processing the sole command (given without -e)
passes the *argv verbatim: without making a copy, and without appending
newline.

The patch eliminates the seemingly redundant malloc/string-copying.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list