aboutsummaryrefslogtreecommitdiff
path: root/win32/regcomp.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2017-06-28 12:12:57 +0200
committerJohannes Schindelin <johannes.schindelin@gmx.de>2017-07-14 22:57:49 +0200
commitd416bdac2fff5eed7cfa70499ff61c8b8a9ca7ce (patch)
treea80bd2acee5e59c7d97d14c1dae9c757898888b1 /win32/regcomp.c
parentdacee10ce244e3da9f2d1f0f43a3224ab9e5d26b (diff)
downloadbusybox-w32-d416bdac2fff5eed7cfa70499ff61c8b8a9ca7ce.tar.gz
busybox-w32-d416bdac2fff5eed7cfa70499ff61c8b8a9ca7ce.tar.bz2
busybox-w32-d416bdac2fff5eed7cfa70499ff61c8b8a9ca7ce.zip
win32/regex: fix compile warnings
There are plenty of warnings that were not detected in Git's source code, due to some warnings being turned off in Git's build by default (even with DEVELOPER=1). The warnings fall into three categories: - constants being tested via `#if <name>` instead of `#ifdef <name>` - unused function parameters - one instance of an unnecessarily-shadowing variable This patch fixes all of them. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Diffstat (limited to 'win32/regcomp.c')
-rw-r--r--win32/regcomp.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/win32/regcomp.c b/win32/regcomp.c
index d8bde06f1..dca7e6ef3 100644
--- a/win32/regcomp.c
+++ b/win32/regcomp.c
@@ -18,6 +18,8 @@
18 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA. */ 19 02110-1301 USA. */
20 20
21#define UNUSED_PARAM __attribute__ ((__unused__))
22
21static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern, 23static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern,
22 size_t length, reg_syntax_t syntax); 24 size_t length, reg_syntax_t syntax);
23static void re_compile_fastmap_iter (regex_t *bufp, 25static void re_compile_fastmap_iter (regex_t *bufp,
@@ -542,7 +544,7 @@ weak_alias (__regcomp, regcomp)
542 from either regcomp or regexec. We don't use PREG here. */ 544 from either regcomp or regexec. We don't use PREG here. */
543 545
544size_t 546size_t
545regerror(int errcode, const regex_t *__restrict preg, 547regerror(int errcode, UNUSED_PARAM const regex_t *__restrict preg,
546 char *__restrict errbuf, size_t errbuf_size) 548 char *__restrict errbuf, size_t errbuf_size)
547{ 549{
548 const char *msg; 550 const char *msg;
@@ -841,7 +843,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
841{ 843{
842 unsigned int table_size; 844 unsigned int table_size;
843#ifndef _LIBC 845#ifndef _LIBC
844 char *codeset_name; 846 const char *codeset_name;
845#endif 847#endif
846 848
847 memset (dfa, '\0', sizeof (re_dfa_t)); 849 memset (dfa, '\0', sizeof (re_dfa_t));
@@ -1035,9 +1037,8 @@ create_initial_state (re_dfa_t *dfa)
1035 int dest_idx = dfa->edests[node_idx].elems[0]; 1037 int dest_idx = dfa->edests[node_idx].elems[0];
1036 if (!re_node_set_contains (&init_nodes, dest_idx)) 1038 if (!re_node_set_contains (&init_nodes, dest_idx))
1037 { 1039 {
1038 reg_errcode_t err = re_node_set_merge (&init_nodes, 1040 err = re_node_set_merge (&init_nodes,
1039 dfa->eclosures 1041 dfa->eclosures + dest_idx);
1040 + dest_idx);
1041 if (err != REG_NOERROR) 1042 if (err != REG_NOERROR)
1042 return err; 1043 return err;
1043 i = 0; 1044 i = 0;
@@ -1388,7 +1389,7 @@ calc_first (void *extra, bin_tree_t *node)
1388 1389
1389/* Pass 2: compute NEXT on the tree. Preorder visit. */ 1390/* Pass 2: compute NEXT on the tree. Preorder visit. */
1390static reg_errcode_t 1391static reg_errcode_t
1391calc_next (void *extra, bin_tree_t *node) 1392calc_next (UNUSED_PARAM void *extra, bin_tree_t *node)
1392{ 1393{
1393 switch (node->token.type) 1394 switch (node->token.type)
1394 { 1395 {
@@ -3336,8 +3337,9 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
3336 3337
3337static reg_errcode_t 3338static reg_errcode_t
3338parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp, 3339parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp,
3339 re_token_t *token, int token_len, re_dfa_t *dfa, 3340 re_token_t *token, int token_len,
3340 reg_syntax_t syntax, int accept_hyphen) 3341 UNUSED_PARAM re_dfa_t *dfa, reg_syntax_t syntax,
3342 int accept_hyphen)
3341{ 3343{
3342#ifdef RE_ENABLE_I18N 3344#ifdef RE_ENABLE_I18N
3343 int cur_char_size; 3345 int cur_char_size;
@@ -3831,7 +3833,7 @@ free_token (re_token_t *node)
3831 and its children. */ 3833 and its children. */
3832 3834
3833static reg_errcode_t 3835static reg_errcode_t
3834free_tree (void *extra, bin_tree_t *node) 3836free_tree (UNUSED_PARAM void *extra, bin_tree_t *node)
3835{ 3837{
3836 free_token (&node->token); 3838 free_token (&node->token);
3837 return REG_NOERROR; 3839 return REG_NOERROR;