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

[PATCH] quote.h: simplify the inclusion

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jan 5, 2011, 00:36 UTC
Message-ID
<20110105003634.GA5128@burratino>

Attempting to include quote.h without first including strbuf.h results in warnings:

 ./quote.h:33:33: warning: ‘struct strbuf’ declared inside parameter list
 ./quote.h:33:33: warning: its scope is only this definition or declaration, which is probably not what you want
 ./quote.h:34:34: warning: ‘struct strbuf’ declared inside parameter list
 ...
Add a toplevel declaration for struct strbuf to avoid this.

While at it, stop including system headers from quote.h. git source files already need to include git-compat-util.h sooner to ensure the appropriate feature test macros are defined.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Noticed while trying to use quote.h in a source file without strbufs.
 quote.h |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/quote.h b/quote.h
index 38003bf..024e21d 100644
--- a/quote.h
+++ b/quote.h
@@ -1,8 +1,7 @@
 #ifndef QUOTE_H
 #define QUOTE_H
 
-#include <stddef.h>
-#include <stdio.h>
+struct strbuf;
 
 /* Help to copy the thing properly quoted for the shell safety.
  * any single quote is replaced with '\'', any exclamation point
-- 
1.7.4.rc0
Message 1 of 1 in “quote.h: simplify the inclusion”
  1. quote.h: simplify the inclusionJonathan Nieder, Jan 5, 2011

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.