Skip to contentSkip to conversation

quote.h: simplify the inclusion

PATCH New Jonathan Nieder 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 quote.h: simplify the inclusion

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.

---
Noticed while trying to use quote.h in a source file without strbufs.

 quote.h |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
quote.h +1 -2
index 38003bf..024e21d 100644
@@ -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
Signature · 1 line
1.7.4.rc0