[MacPorts] #69571: Add stpncpy to legacy support

MacPorts noreply at macports.org
Thu Apr 4 20:26:33 UTC 2024


#69571: Add stpncpy to legacy support
-----------------------------+----------------------
  Reporter:  ryandesign      |      Owner:  mascguy
      Type:  enhancement     |     Status:  assigned
  Priority:  Normal          |  Milestone:
 Component:  ports           |    Version:
Resolution:                  |   Keywords:
      Port:  legacy-support  |
-----------------------------+----------------------

Comment (by fhgwright):

 I was about to attack this, so you can feel free to assign it to me.

 The obvious thing to do is to copy Apple's implementation from the later
 OS versions where they provide them.  It looks like this happened in
 `Libc-825.24`, and never changed since.  It's a dumb two-pass
 implementation (as is the GCC version shown above) that fails to avoid the
 extra overhead that motivated `stpcpy()/stpncpy()` in the first place, but
 in keeping with the philosophy of never doing anything better than Apple
 in `legacy-support`, it makes sense.  Thus, the only real benefit over
 `strcpy()/strncpy()` is in compatibility and convenience.

 The larger part of the work is in creating tests, since Apple doesn't have
 any.  One could argue that adding tests for code coped verbatim from Apple
 shouldn't really be necessary, but in the interests of completeness, it
 makes sense to add them.

-- 
Ticket URL: <https://trac.macports.org/ticket/69571#comment:3>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list