From: Mateo Patino <mateopatinodev@gmail.com>
To: git@vger.kernel.org
Cc: Mateo Patino <mateopatinodev@gmail.com>,
karthik.188@gmail.com, jltobler@gmail.com,
ayu.chandekar@gmail.com, siddharthasthana31@gmail.com, ps@pks.im,
gitster@pobox.com
Subject: [RFC] [GSoC]: STRBUF_INIT_CONST: initialize `strbuf` to constant string
Date: Sun, 22 Mar 2026 02:55:09 -0400 [thread overview]
Message-ID: <20260322065509.5384-1-mateopatinodev@gmail.com> (raw)
Hello,
My name is Mateo, and I'm a new contributor to Git. I'm a 1st year
undergrad at Columbia University studying CS and applied math.
I wanted to ask the community for feedback on a project proposal
regarding the `strbuf` API. Seven years ago, a macro to initialize a
`strbuf` to a constant string literal was proposed in GitGitGadget [1]
called `STRBUF_INIT_CONST`. This macro would work just like `STRBUF_INIT`
but it would set `alloc` to 0 (i.e. the buffer would not be
heap-allocated).
Someone made a pull request to implement this feature [2], but their
changes were not merged. Later, Robear Selwans made a patch series [3]
attempting to implement this same feature. Robear got extensive
feedback, but his patches were not accepted. The same GitHub user from
[2] sent a patch here [4], but his changes were not accepted.
More recently, the potential need for `STRBUF_INIT_CONST` was mentioned
in this patch series [5] by Patrick Steinhardt, though it was marked
as a #leftoverbit and not directly addressed.
`STRBUF_INIT_CONST` has been mentioned for a long time in this list,
but it has not been implemented yet. My Request For Comment is the
following: is `STRBUF_INIT_CONST` a feature that is still of interest
to the community? If so, I would like to make a GSoC proposal around it.
The past email threads have already laid out the considerations of
implementing `STRBUF_INIT_CONST` or something equivalent, so I would
like to propose this as GSoC idea if the community would find it
worthwhile.
I would love to hear any thoughts about this.
Thanks!
Mateo <mateopatinodev@gmail.com>
[1] https://github.com/gitgitgadget/git/issues/398
[2] https://github.com/gitgitgadget/git/pull/824
[3] https://lore.kernel.org/git/20200218041805.10939-1-robear.selwans@outlook.com/
[4] https://lore.kernel.org/git/20210105064502.725307-1-adlternative@gmail.com/
[5] https://lore.kernel.org/git/Zrm9ix5aN_g76Qxq@tanuki/
next reply other threads:[~2026-03-22 6:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-22 6:55 Mateo Patino [this message]
2026-03-22 8:59 ` [RFC] [GSoC]: STRBUF_INIT_CONST: initialize `strbuf` to constant string Eric Sunshine
2026-03-23 16:10 ` Mateo Patino
[not found] ` <CAFRsFoV+k-8GMf=62GJwxP=o0Fy5RRBGW+h4NqOLjFbU6z96tw@mail.gmail.com>
2026-03-24 3:33 ` Eric Sunshine
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260322065509.5384-1-mateopatinodev@gmail.com \
--to=mateopatinodev@gmail.com \
--cc=ayu.chandekar@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jltobler@gmail.com \
--cc=karthik.188@gmail.com \
--cc=ps@pks.im \
--cc=siddharthasthana31@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox