{"thread":{"id":"37757","subject":"[PATCH] revision: remove definition of unused 'add_object' function","startedAt":"2014-10-18T21:36:12Z","lastAt":"2014-10-19T10:16:00Z","messageCount":3,"participants":["Ramsay Jones","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"250811","messageId":"5442DD4C.9050908@ramsay1.demon.co.uk","threadId":"37757","inReplyTo":null,"subject":"[PATCH] revision: remove definition of unused 'add_object' function","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2014-10-18T21:36:12Z","receivedAt":"2014-10-18T21:36:12Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n\nHi Jeff,\n\nI noticed that your 'jk/prune-mtime' branch removes the last caller\nof the add_object() function; specifically commit 5f78a431a\n(\"reachable: use traverse_commit_list instead of custom walk\", 15-10-2014).\n\nIf you need to re-roll those patches, could you please squash this\npatch into the above commit. (unless you have plans to add some new\ncallers, of course! ;-) ).\n\nThanks!\n\nATB,\nRamsay Jones\n\n revision.c | 10 ----------\n revision.h |  5 -----\n 2 files changed, 15 deletions(-)\n\ndiff --git a/revision.c b/revision.c\nindex 1316fe0..7bdf760 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -87,16 +87,6 @@ void show_object_with_name(FILE *out, struct object *obj,\n \tfputc('\\n', out);\n }\n \n-void add_object(struct object *obj,\n-\t\tstruct object_array *p,\n-\t\tstruct name_path *path,\n-\t\tconst char *name)\n-{\n-\tchar *pn = path_name(path, name);\n-\tadd_object_array(obj, pn, p);\n-\tfree(pn);\n-}\n-\n static void mark_blob_uninteresting(struct blob *blob)\n {\n \tif (!blob)\ndiff --git a/revision.h b/revision.h\nindex 9ab6755..b90f907 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -282,11 +282,6 @@ char *path_name(const struct name_path *path, const char *name);\n extern void show_object_with_name(FILE *, struct object *,\n \t\t\t\t  const struct name_path *, const char *);\n \n-extern void add_object(struct object *obj,\n-\t\t       struct object_array *p,\n-\t\t       struct name_path *path,\n-\t\t       const char *name);\n-\n extern void add_pending_object(struct rev_info *revs,\n \t\t\t       struct object *obj, const char *name);\n extern void add_pending_sha1(struct rev_info *revs,\n-- \n2.1.0\n"},{"id":"250815","messageId":"20141019013646.GA17908@peff.net","threadId":"37757","inReplyTo":"5442DD4C.9050908@ramsay1.demon.co.uk","subject":"Re: [PATCH] revision: remove definition of unused 'add_object' function","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-10-19T01:36:46Z","receivedAt":"2014-10-19T01:36:46Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Oct 18, 2014 at 10:36:12PM +0100, Ramsay Jones wrote:\n\n> I noticed that your 'jk/prune-mtime' branch removes the last caller\n> of the add_object() function; specifically commit 5f78a431a\n> (\"reachable: use traverse_commit_list instead of custom walk\", 15-10-2014).\n\nThanks. I usually rely on the compiler to catch any static instances\nthat I missed, but of course this one is extern. Did you use an\nautomated tool for this (I know you often catch \"X has no declaration;\nshould it be static?\" with clang, but does clang catch this, too?).\n\n> If you need to re-roll those patches, could you please squash this\n> patch into the above commit. (unless you have plans to add some new\n> callers, of course! ;-) ).\n\nNope, I just didn't notice that I dropped the last caller. I don't think\nwe need another re-roll (fingers crossed), but I'd be happy to have this\non top.\n\n-Peff\n"},{"id":"250821","messageId":"54438F60.1020500@ramsay1.demon.co.uk","threadId":"37757","inReplyTo":"20141019013646.GA17908@peff.net","subject":"Re: [PATCH] revision: remove definition of unused 'add_object' function","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2014-10-19T10:16:00Z","receivedAt":"2014-10-19T10:16:00Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"On 19/10/14 02:36, Jeff King wrote:\n> On Sat, Oct 18, 2014 at 10:36:12PM +0100, Ramsay Jones wrote:\n> \n>> I noticed that your 'jk/prune-mtime' branch removes the last caller\n>> of the add_object() function; specifically commit 5f78a431a\n>> (\"reachable: use traverse_commit_list instead of custom walk\", 15-10-2014).\n> \n> Thanks. I usually rely on the compiler to catch any static instances\n> that I missed, but of course this one is extern. Did you use an\n> automated tool for this\n\nYes, see below.\n\n>                         (I know you often catch \"X has no declaration;\n> should it be static?\" with clang,\n\nNo, these are caught with sparse.\n\n>                                    but does clang catch this, too?).\n> \n>> If you need to re-roll those patches, could you please squash this\n>> patch into the above commit. (unless you have plans to add some new\n>> callers, of course! ;-) ).\n> \n> Nope, I just didn't notice that I dropped the last caller. I don't think\n> we need another re-roll (fingers crossed), but I'd be happy to have this\n> on top.\n\nOK, Thanks!\n\nThe tool that I use to spot these situations is actually my evolution\nof a perl script that Junio sent to the list ages ago! ;-)\n\nI made only minor alterations so that it would work on MinGW 32-bit\n(well, actually msysGit, to be more precise), Cygwin 32-bit and 64-bit.\n(The 'stop list' of acceptable symbols is _way_ out of date, but the\nway I use the script that doesn't matter; still its on my TODO).\n\nI run the script over each branch I build, master then next then pu, and\ndiff the results (ie ignoring the master base symbols), so I generally\nonly notice new symbols introduced into pu by new topics. It has been on\nmy TODO list for a while (OK years!) to go through the output from the\nmaster branch and remove/make static those symbols which shouldn't be\nexternal. (There are currently 53 symbols on 64-bit Linux. The list is\nnot identical on every platform, so you need to be careful. Also cgit\nuses some symbols which would otherwise be static in git! ;-) ).\n\nAhem, I don't use git to version the script (static-check.pl), so I'm\nonly reasonable confident that the script I have easily to hand (Linux\nMint 64-bit) is the same on all platforms ... included below.\n\nATB,\nRamsay Jones\n\n-- >8 --\n#!/usr/bin/perl -w\n\nmy %defd = ();\nmy %used = ();\nmy %def_ok = map { $_ => 1 } qw(\n\tmain\n\talloc_report\n\thave_git_dir\n\tprepare_git_cmd\n\tprint_string_list\n\ttm_to_time_t\n\tunsorted_string_list_has_string\n\txdl_atol\n\txdl_cha_first\n\txdl_cha_next\n\txdl_mmfile_size\n\txdl_num_out\n\txdl_recs_cmp\n);\n\nfor (<*.o>, <*/*.o>, <*/*/*.o>) {\n\tmy $obj = $_;\n\topen(I, \"-|\", qw(nm -gC), $obj) or die;\n\twhile (<I>) {\n\t\tunless (/^[0-9a-f ]+([A-Z]) (\\S*)$/) {\n\t\t\tprint STDERR \"? $_\";\n\t\t\tnext;\n\t\t}\n\t\tnext if ($2 =~ /^\\.refptr\\./);\n\t\tif (($1 eq \"U\") || $1 eq \"C\") {\n\t\t\t$used{$2}++;\n\t\t}\n\t\telse {\n\t\t\tpush @{$defd{$obj}}, $2;\n\t\t}\n\t}\n\tclose I;\n}\n\nfor my $obj (sort keys %defd) {\n\tmy $syms = $defd{$obj};\n\tfor my $sym (@$syms) {\n\t\tnext if exists $used{$sym} or exists $def_ok{$sym};\n\t\tprint \"$obj\t- $sym\\n\";\n\t}\n}\n"}]}