From: Junio C Hamano <gitster@pobox.com>
To: Chandra Pratap <chandrapratap3519@gmail.com>
Cc: git@vger.kernel.org, Patrick Steinhardt <ps@pks.im>,
Christian Couder <chriscool@tuxfamily.org>
Subject: Re: [PATCH v2 2/4] t-reftable-readwrite: use free_names() instead of a for loop
Date: Fri, 09 Aug 2024 11:57:49 -0700 [thread overview]
Message-ID: <xmqqjzgpcymq.fsf@gitster.g> (raw)
In-Reply-To: <20240809111312.4401-3-chandrapratap3519@gmail.com> (Chandra Pratap's message of "Fri, 9 Aug 2024 16:35:42 +0530")
Chandra Pratap <chandrapratap3519@gmail.com> writes:
> free_names() as defined by reftable/basics.{c,h} frees a NULL
> terminated array of malloced strings along with the array itself.
> Use this function instead of a for loop to free such an array.
Going back to [1/4], the headers included in this test looked like this:
-#include "system.h"
-
-#include "basics.h"
-#include "block.h"
-#include "blocksource.h"
-#include "reader.h"
-#include "record.h"
-#include "test_framework.h"
-#include "reftable-tests.h"
-#include "reftable-writer.h"
+#include "test-lib.h"
+#include "reftable/reader.h"
+#include "reftable/blocksource.h"
+#include "reftable/reftable-error.h"
+#include "reftable/reftable-writer.h"
I found this part a bit curious, perhaps because I was not involved
in either reftable/ or unit-tests/ development. So I may be asking
a stupid question, but is it intended that some headers like
"block.h" and "record.h" are no longer included?
It is understandable that inclusion of "test-lib.h" is new (and
needs to be there to work as part of t/unit-tests/), and the leading
directory name "reftable/" added to header files are also justified,
of course. But if you depend on "basics.h" and do not include it,
that does not sound like the most hygenic thing to do, at least to
me.
The code changes themselves look good; I can see that the
implementation of free_names() in reftable/basics.c safely replaces
these loops. There is a slight behaviour difference that names[]
that was fed to reftable_iterator_seek_ref() earlier goes away
before the iterator is destroyed, but _seek_ref() does not retain
the names[0] argument in the iterator object, so that is OK.
Thanks.
next prev parent reply other threads:[~2024-08-09 18:57 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-07 14:11 [GSoC][PATCH 0/5] t: port reftable/readwrite_test.c to the unit testing framework Chandra Pratap
2024-08-07 14:11 ` [PATCH 1/5] t: move " Chandra Pratap
2024-08-07 14:11 ` [PATCH 2/5] t-reftable-readwrite: use free_names() instead of a for loop Chandra Pratap
2024-08-07 14:11 ` [PATCH 3/5] t-reftable-readwrite: use 'for' in place of infinite 'while' loops Chandra Pratap
2024-08-07 14:12 ` [PATCH 4/5] t-reftable-readwrite: add test for known error Chandra Pratap
2024-08-07 14:12 ` [PATCH 5/5] t-reftable-readwrite: add tests for print functions Chandra Pratap
2024-08-08 8:12 ` Patrick Steinhardt
2024-08-08 12:00 ` Patrick Steinhardt
2024-08-08 14:25 ` Chandra Pratap
2024-08-09 16:56 ` Junio C Hamano
2024-08-09 11:05 ` [GSoC][PATCH v2 0/4] t: port reftable/readwrite_test.c to the unit testing framework Chandra Pratap
2024-08-09 11:05 ` [PATCH v2 1/4] t: move " Chandra Pratap
2024-08-09 18:12 ` Junio C Hamano
2024-08-12 14:50 ` Chandra Pratap
2024-08-09 11:05 ` [PATCH v2 2/4] t-reftable-readwrite: use free_names() instead of a for loop Chandra Pratap
2024-08-09 18:57 ` Junio C Hamano [this message]
2024-08-10 5:50 ` Chandra Pratap
2024-08-10 6:10 ` Junio C Hamano
2024-08-09 11:05 ` [PATCH v2 3/4] t-reftable-readwrite: use 'for' in place of infinite 'while' loops Chandra Pratap
2024-08-09 19:06 ` Junio C Hamano
2024-08-09 11:05 ` [PATCH v2 4/4] t-reftable-readwrite: add test for known error Chandra Pratap
2024-08-13 14:34 ` [GSoC][PATCH v3 0/4] t: port reftable/readwrite_test.c to the unit testing framework Chandra Pratap
2024-08-13 14:34 ` [PATCH v3 1/4] t: move " Chandra Pratap
2024-08-13 22:33 ` Josh Steadmon
2024-08-14 11:48 ` Chandra Pratap
2024-08-14 13:08 ` Patrick Steinhardt
2024-08-13 14:34 ` [PATCH v3 2/4] t-reftable-readwrite: use free_names() instead of a for loop Chandra Pratap
2024-08-13 14:34 ` [PATCH v3 3/4] t-reftable-readwrite: use 'for' in place of infinite 'while' loops Chandra Pratap
2024-08-13 14:34 ` [PATCH v3 4/4] t-reftable-readwrite: add test for known error Chandra Pratap
2024-08-13 17:10 ` [GSoC][PATCH v3 0/4] t: port reftable/readwrite_test.c to the unit testing framework Junio C Hamano
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=xmqqjzgpcymq.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=chandrapratap3519@gmail.com \
--cc=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
/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).