Skip to content

Commit

Permalink
ctype.c: Fix a sparse warning
Browse files Browse the repository at this point in the history
In particular, sparse complains as follows:

        SP ctype.c
    ctype.c:30:12: warning: symbol 'tolower_trans_tbl' was not declared.\
         Should it be static?

An appropriate extern declaration for the 'tolower_trans_tbl' symbol
is included in the "cache.h" header file. In order to suppress the
warning, therefore, we could replace the "git-compat-util.h" header
inclusion with "cache.h", since "cache.h" includes "git-compat-util.h"
in turn. Here, however, we choose to move the extern declaration for
'tolower_trans_tbl' into "git-compat-util.h", alongside the other
extern declaration from ctype.c for 'sane_ctype'.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Ramsay Jones authored and gitster committed Mar 5, 2012
1 parent accccde commit f1589d1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 0 additions & 3 deletions cache.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1258,7 +1258,4 @@ extern struct startup_info *startup_info;
/* builtin/merge.c */ /* builtin/merge.c */
int checkout_fast_forward(const unsigned char *from, const unsigned char *to); int checkout_fast_forward(const unsigned char *from, const unsigned char *to);


/* in ctype.c, for kwset users */
extern const char tolower_trans_tbl[256];

#endif /* CACHE_H */ #endif /* CACHE_H */
3 changes: 3 additions & 0 deletions git-compat-util.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -457,6 +457,9 @@ static inline int has_extension(const char *filename, const char *ext)
return len > extlen && !memcmp(filename + len - extlen, ext, extlen); return len > extlen && !memcmp(filename + len - extlen, ext, extlen);
} }


/* in ctype.c, for kwset users */
extern const char tolower_trans_tbl[256];

/* Sane ctype - no locale, and works with signed chars */ /* Sane ctype - no locale, and works with signed chars */
#undef isascii #undef isascii
#undef isspace #undef isspace
Expand Down

0 comments on commit f1589d1

Please sign in to comment.