git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] notes: Initialize variable to appease Sun Studio

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jun 14, 2010, 23:40 UTC
Message-ID
<1276558805-26573-1-git-send-email-avarab@gmail.com>
In-Reply-To
<e0fbd6edc13d94a097e8e7e3649b9e669f9b4ee3.1268413246.git.trast@student.ethz.ch>

Sun Studio 12 Update 1 thinks that *t could be uninitialized, ostensibly because it doesn't take rewrite_cmd into account in its static analysis.

    builtin/notes.c: In function `notes_copy_from_stdin':
    builtin/notes.c:419: warning: 't' might be used uninitialized in this function
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/notes.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin/notes.c b/builtin/notes.c
index ba8fd17..648033c 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -416,7 +416,7 @@ int notes_copy_from_stdin(int force, const char *rewrite_cmd)
 {
 	struct strbuf buf = STRBUF_INIT;
 	struct notes_rewrite_cfg *c = NULL;
-	struct notes_tree *t;
+	struct notes_tree *t = NULL;
 	int ret = 0;
 
 	if (rewrite_cmd) {
-- 
1.7.1.251.g92a7
Previous: Thomas RastNext: Junio C Hamano
Message 9 of 18 in “tr/display-notes”
  1. 00/13 tr/display-notesThomas Rast, Mar 12, 2010
  2. 01/13 test-lib: unset GIT_NOTES_REF to stop it from influencing testsThomas Rast, Mar 12, 2010
  3. 02/13 Support showing notes from more than one notes treeThomas Rast, Mar 12, 2010
  4. 03/13 Documentation: document post-rewrite hookThomas Rast, Mar 12, 2010
  5. 04/13 commit --amend: invoke post-rewrite hookThomas Rast, Mar 12, 2010
  6. 05/13 rebase: invoke post-rewrite hookThomas Rast, Mar 12, 2010
  7. 06/13 rebase -i: invoke post-rewrite hookThomas Rast, Mar 12, 2010
  8. 07/13 notes: implement 'git notes copy --stdin'Thomas Rast, Mar 12, 2010
  9. notes: Initialize variable to appease Sun StudioÆvar Arnfjörð Bjarmason, Jun 14, 2010
  10. Junio C HamanoJun 19, 2010
  11. Ævar Arnfjörð BjarmasonJun 19, 2010
  12. Ramsay JonesJun 21, 2010
  13. 08/13 notes: implement helpers needed for note copying during rewriteThomas Rast, Mar 12, 2010
  14. 09/13 rebase: support automatic notes copyingThomas Rast, Mar 12, 2010
  15. 10/13 commit --amend: copy notes to the new commitThomas Rast, Mar 12, 2010
  16. 11/13 notes: add shorthand --ref to override GIT_NOTES_REFThomas Rast, Mar 12, 2010
  17. 12/13 notes: track whether notes_trees were changed at allThomas Rast, Mar 12, 2010
  18. 13/13 git-notes(1): add a section about the meaning of historyThomas Rast, Mar 12, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.