summaryrefslogtreecommitdiff
path: root/utf8.h
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2015-06-05 06:42:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-06-05 22:36:35 (GMT)
commite654eb29ab9da97f6acabc261f88aa1f41f78a8f (patch)
treecad8610ce7b2981a0fb54155ffd638eb4ef3b686 /utf8.h
parent282616c72d1d08a77ca4fe1186cb708c38408d87 (diff)
downloadgit-e654eb29ab9da97f6acabc261f88aa1f41f78a8f.zip
git-e654eb29ab9da97f6acabc261f88aa1f41f78a8f.tar.gz
git-e654eb29ab9da97f6acabc261f88aa1f41f78a8f.tar.bz2
utf8: NO_ICONV: silence uninitialized variable warning
The last argument of reencode_string_len() is an 'int *' which is assigned the length of the converted string. When NO_ICONV is defined, however, reencode_string_len() is stubbed out by the macro: #define reencode_string_len(a,b,c,d,e) NULL which never assigns a value to the final argument. When called like this: int n; char *s = reencode_string_len(..., &n); if (s) do_something(s, n); some compilers complain that 'n' is used uninitialized within the conditional. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'utf8.h')
-rw-r--r--utf8.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/utf8.h b/utf8.h
index e4d9183..07e7054 100644
--- a/utf8.h
+++ b/utf8.h
@@ -28,7 +28,9 @@ char *reencode_string_len(const char *in, int insz,
const char *in_encoding,
int *outsz);
#else
-#define reencode_string_len(a,b,c,d,e) NULL
+static inline char *reencode_string_len(const char *a, int b,
+ const char *c, const char *d, int *e)
+{ if (e) *e = 0; return NULL; }
#endif
static inline char *reencode_string(const char *in,