From: Jonathan Nieder <jrnieder@gmail.com>
To: Thomas Rast <tr@thomasrast.ch>
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
git@vger.kernel.org
Subject: Re: [PATCH 1/2] commit-slab: document clear_$slabname()
Date: Mon, 25 Nov 2013 12:24:09 -0800 [thread overview]
Message-ID: <20131125202409.GO4212@google.com> (raw)
In-Reply-To: <7f773c5c5ea16b19840f67ba99961be132940d32.1385405977.git.tr@thomasrast.ch>
Thomas Rast wrote:
> The clear_$slabname() function was only documented by source code so
> far. Write something about it.
Good idea.
[...]
> --- a/commit-slab.h
> +++ b/commit-slab.h
> @@ -24,6 +24,10 @@
> * to each commit. 'stride' specifies how big each array is. The slab
> * that id initialied by the variant without "_with_stride" associates
> * each commit with an array of one integer.
> + *
> + * - void clear_indegree(struct indegree *);
> + *
> + * Free the slab's data structures.
Tense shift (previous descriptions were in the present tense, while
this one is in the imperative).
More importantly, this doesn't answer the questions I'd have if I were
in a hurry, which are what exactly is being freed (has the slab taken
ownership of any memory from the user, e.g. when elemtype is a
pointer?) and whether the slab needs to be init_ ed again.
Maybe something like the following would work?
- void clear_indegree(struct indegree *);
Empties the slab. The slab can be reused with the same
stride without calling init_indegree again or can be
reconfigured to a different stride by calling
init_indegree_with_stride.
Call this function before the slab falls out of scope to
avoid leaking memory.
Thanks,
Jonathan
next prev parent reply other threads:[~2013-11-25 20:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-25 19:01 [PATCH 0/2] commit-slab cleanups Thomas Rast
2013-11-25 19:02 ` [PATCH 1/2] commit-slab: document clear_$slabname() Thomas Rast
2013-11-25 20:24 ` Jonathan Nieder [this message]
2013-11-29 19:35 ` Thomas Rast
2013-11-25 20:39 ` Junio C Hamano
2013-11-27 10:39 ` Eric Sunshine
2013-11-25 19:02 ` [PATCH 2/2] commit-slab: declare functions "static inline" Thomas Rast
2013-11-25 19:36 ` Junio C Hamano
2013-11-25 19:53 ` Thomas Rast
2013-11-25 20:04 ` [PATCH v2] " Thomas Rast
2013-11-25 20:12 ` Jonathan Nieder
2013-11-25 20:15 ` Thomas Rast
2013-11-25 20:35 ` Jonathan Nieder
2013-11-25 20:33 ` Junio C Hamano
2013-11-25 20:23 ` Junio C Hamano
2013-12-01 10:36 ` [PATCH 2/2] " Duy Nguyen
2013-12-01 20:41 ` [PATCH] commit-slab: sizeof() the right type in xrealloc Thomas Rast
2013-12-02 15:35 ` Jeff King
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=20131125202409.GO4212@google.com \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=tr@thomasrast.ch \
/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;
as well as URLs for NNTP newsgroup(s).