* [PATCH] commit-graph: fix some "plain integer as NULL pointer" warnings
@ 2018-02-24 2:24 Ramsay Jones
2018-02-24 5:42 ` René Scharfe
0 siblings, 1 reply; 3+ messages in thread
From: Ramsay Jones @ 2018-02-24 2:24 UTC (permalink / raw)
To: stolee; +Cc: Junio C Hamano, GIT Mailing-list
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
Hi Derrick,
If you need to re-roll your 'ds/commit-graph' branch, could you
please squash this into the relevant patches (corresponding to
commits 0fd2d95ee6 ["commit-graph: implement --set-latest"],
a33b9b79ff ["commit-graph: implement --delete-expired"] and finally
commit b534f9e961 ["commit-graph: implement git commit-graph read"]).
Also, I note that two symbols are only used in commit-graph.c but
are declared extern. Namely 'commit_graph' (declared line #42) and
'prepare_commit_graph' (declared line #212). Do these symbols need
to be extern (in future patches, perhaps)?
Thanks!
ATB,
Ramsay Jones
builtin/commit-graph.c | 2 +-
commit-graph.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
index be1883f1b..efdb003ca 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -33,7 +33,7 @@ static struct opts_commit_graph {
static int graph_read(int argc, const char **argv)
{
- struct commit_graph *graph = 0;
+ struct commit_graph *graph = NULL;
struct strbuf full_path = STRBUF_INIT;
static struct option builtin_commit_graph_read_options[] = {
diff --git a/commit-graph.c b/commit-graph.c
index fc5ee7e99..c2f443436 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -45,7 +45,7 @@ char *get_graph_latest_filename(const char *obj_dir)
{
struct strbuf fname = STRBUF_INIT;
strbuf_addf(&fname, "%s/info/graph-latest", obj_dir);
- return strbuf_detach(&fname, 0);
+ return strbuf_detach(&fname, NULL);
}
char *get_graph_latest_contents(const char *obj_dir)
@@ -60,7 +60,7 @@ char *get_graph_latest_contents(const char *obj_dir)
FREE_AND_NULL(fname);
if (!f)
- return 0;
+ return NULL;
while (!feof(f)) {
if (fgets(buf, sizeof(buf), f))
@@ -95,10 +95,10 @@ struct commit_graph *load_commit_graph_one(const char *graph_file)
unsigned char graph_version, hash_version;
if (fd < 0)
- return 0;
+ return NULL;
if (fstat(fd, &st)) {
close(fd);
- return 0;
+ return NULL;
}
graph_size = xsize_t(st.st_size);
--
2.16.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] commit-graph: fix some "plain integer as NULL pointer" warnings
2018-02-24 2:24 [PATCH] commit-graph: fix some "plain integer as NULL pointer" warnings Ramsay Jones
@ 2018-02-24 5:42 ` René Scharfe
2018-02-26 14:31 ` Derrick Stolee
0 siblings, 1 reply; 3+ messages in thread
From: René Scharfe @ 2018-02-24 5:42 UTC (permalink / raw)
To: Ramsay Jones, stolee; +Cc: Junio C Hamano, GIT Mailing-list
Am 24.02.2018 um 03:24 schrieb Ramsay Jones:
> diff --git a/commit-graph.c b/commit-graph.c
> index fc5ee7e99..c2f443436 100644
> --- a/commit-graph.c
> +++ b/commit-graph.c
> @@ -45,7 +45,7 @@ char *get_graph_latest_filename(const char *obj_dir)
> {
> struct strbuf fname = STRBUF_INIT;
> strbuf_addf(&fname, "%s/info/graph-latest", obj_dir);
> - return strbuf_detach(&fname, 0);
> + return strbuf_detach(&fname, NULL);
> }
You could also replace that function body with:
return xstrfmt("%s/info/graph-latest", obj_dir);
René
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] commit-graph: fix some "plain integer as NULL pointer" warnings
2018-02-24 5:42 ` René Scharfe
@ 2018-02-26 14:31 ` Derrick Stolee
0 siblings, 0 replies; 3+ messages in thread
From: Derrick Stolee @ 2018-02-26 14:31 UTC (permalink / raw)
To: René Scharfe, Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list
On 2/24/2018 12:42 AM, René Scharfe wrote:
> Am 24.02.2018 um 03:24 schrieb Ramsay Jones:
>> diff --git a/commit-graph.c b/commit-graph.c
>> index fc5ee7e99..c2f443436 100644
>> --- a/commit-graph.c
>> +++ b/commit-graph.c
>> @@ -45,7 +45,7 @@ char *get_graph_latest_filename(const char *obj_dir)
>> {
>> struct strbuf fname = STRBUF_INIT;
>> strbuf_addf(&fname, "%s/info/graph-latest", obj_dir);
>> - return strbuf_detach(&fname, 0);
>> + return strbuf_detach(&fname, NULL);
>> }
> You could also replace that function body with:
>
> return xstrfmt("%s/info/graph-latest", obj_dir);
>
> René
Thanks for the feedback! I will apply these locally as I am re-rolling
today.
-Stolee
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-02-26 14:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-24 2:24 [PATCH] commit-graph: fix some "plain integer as NULL pointer" warnings Ramsay Jones
2018-02-24 5:42 ` René Scharfe
2018-02-26 14:31 ` Derrick Stolee
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).