0cd4b781a6fa - main - pw(8): use openmemstream instead of sbuf(9)

Baptiste Daroussin bapt at FreeBSD.org
Tue Apr 27 07:05:58 UTC 2021


On Mon, Apr 26, 2021 at 09:13:53PM -0700, Ravi Pokala wrote:
> -----Original Message-----
> From: <owner-src-committers at freebsd.org> on behalf of Baptiste Daroussin <bapt at FreeBSD.org>
> Date: 2021-04-26, Monday at 20:09
> To: <src-committers at FreeBSD.org>, <dev-commits-src-all at FreeBSD.org>, <dev-commits-src-main at FreeBSD.org>
> Subject: git: 0cd4b781a6fa - main - pw(8): use openmemstream instead of sbuf(9)
> 
>     The branch main has been updated by bapt:
> 
>     URL: https://cgit.FreeBSD.org/src/commit/?id=0cd4b781a6fa1ed4ca04a7b642f41652e25bbc9b
> 
>     commit 0cd4b781a6fa1ed4ca04a7b642f41652e25bbc9b
>     Author:     Baptiste Daroussin <bapt at FreeBSD.org>
>     AuthorDate: 2021-04-27 03:05:13 +0000
>     Commit:     Baptiste Daroussin <bapt at FreeBSD.org>
>     CommitDate: 2021-04-27 03:09:07 +0000
> 
> Hi Baptiste,
> 
>         pw(8): use openmemstream instead of sbuf(9)
> 
> That's the "what", but what's the "why"?
> 
> Thanks,
> 
You are right about this. Here the why. I have been the one introducing sbug in
pw(8) when I rewrote it, but since the beginning while I found this was better
than the solution in place I didn't like adding another external lib just for
that.

Short after I discovered about open_memstream(3) and figured it could fill the
same spot here but keeping the dep only on libc. I was puzzled about pushing
this change, and the switch to git reminded me about some uncommit patches
sitting on my tree and I ended up pushing it.

If people have strong opinion I can revert it back.

Things that have not been taken in account in the change, but to answer
questions asked privately:

- I have performed absolutely no performance benchmark, it does not matter here.

- The size of the final binary is smaller:
  - 76k on amd64 for the new version
  - 77k for the old version

Best regards,
Bapt


More information about the dev-commits-src-main mailing list