Skip to contentSkip to conversation

compat/regex: fix typos in comments.

PATCH In review Yi, EungJun 3 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 compat/regex: fix typos in comments.

From: "Yi, EungJun" <[email protected]>

occured => occurred

---
 compat/regex/regcomp.c        |    4 ++--
 compat/regex/regex_internal.c |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
compat/regex/regcomp.c +2 -2
index 8c96ed9..aab8153 100644
@@ -2095,7 +2095,7 @@ peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
 
 /* Entry point of the parser.
    Parse the regular expression REGEXP and return the structure tree.
-   If an error is occured, ERR is set by error code, and return NULL.
+   If an error is occurred, ERR is set by error code, and return NULL.
    This function build the following tree, from regular expression <reg_exp>:
 	   CAT
 	   / \
@@ -3715,7 +3715,7 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
 /* This is intended for the expressions like "a{1,3}".
    Fetch a number from `input', and return the number.
    Return -1, if the number field is empty like "{,1}".
-   Return -2, If an error is occured.  */
+   Return -2, If an error is occurred.  */
 
 static int
 fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax)
compat/regex/regex_internal.c +3 -3
index 193854c..237642c 100644
@@ -1284,7 +1284,7 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src)
 
 /* Insert the new element ELEM to the re_node_set* SET.
    SET should not already have ELEM.
-   return -1 if an error is occured, return 1 otherwise.  */
+   return -1 if an error is occurred, return 1 otherwise.  */
 
 static int
 internal_function
@@ -1341,7 +1341,7 @@ re_node_set_insert (re_node_set *set, int elem)
 
 /* Insert the new element ELEM to the re_node_set* SET.
    SET should not already have any element greater than or equal to ELEM.
-   Return -1 if an error is occured, return 1 otherwise.  */
+   Return -1 if an error is occurred, return 1 otherwise.  */
 
 static int
 internal_function
@@ -1416,7 +1416,7 @@ re_node_set_remove_at (re_node_set *set, int idx)
 
 
 /* Add the token TOKEN to dfa->nodes, and return the index of the token.
-   Or return -1, if an error will be occured.  */
+   Or return -1, if an error will be occurred.  */
 
 static int
 internal_function
Signature · 1 line
1.7.5.4
#1 lore raw
Quoted 15 lines · EungJun

From: "Yi, EungJun" <[email protected]>

occured => occurred

---
 compat/regex/regcomp.c        |    4 ++--
 compat/regex/regex_internal.c |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
compat/regex/regcomp.c +0 -0
index 8c96ed9..aab8153 100644

compat/regex/regcomp.c peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax) · line 2098

Quoted 5 lines
compat/regex/regcomp.c +1 -1
@@ -2095,7 +2095,7 @@ peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
 
 /* Entry point of the parser.
    Parse the regular expression REGEXP and return the structure tree.
-   If an error is occured, ERR is set by error code, and return NULL.
+   If an error is occurred, ERR is set by error code, and return NULL.

Hi,
you might want to fix the grammatical errors instead:
"If an error occurs, ERR is set to the error code, and NULL is returned.", or something like that, I haven't actually read the code.

Best,
Zbyszek

Quoted 43 lines
compat/regex/regcomp.c +1 -1
    This function build the following tree, from regular expression <reg_exp>:
 	   CAT
 	   / \
@@ -3715,7 +3715,7 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
 /* This is intended for the expressions like "a{1,3}".
    Fetch a number from `input', and return the number.
    Return -1, if the number field is empty like "{,1}".
-   Return -2, If an error is occured.  */
+   Return -2, If an error is occurred.  */
 
 static int
 fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax)
compat/regex/regex_internal.c +3 -3
index 193854c..237642c 100644
@@ -1284,7 +1284,7 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src)
 
 /* Insert the new element ELEM to the re_node_set* SET.
    SET should not already have ELEM.
-   return -1 if an error is occured, return 1 otherwise.  */
+   return -1 if an error is occurred, return 1 otherwise.  */
 
 static int
 internal_function
@@ -1341,7 +1341,7 @@ re_node_set_insert (re_node_set *set, int elem)
 
 /* Insert the new element ELEM to the re_node_set* SET.
    SET should not already have any element greater than or equal to ELEM.
-   Return -1 if an error is occured, return 1 otherwise.  */
+   Return -1 if an error is occurred, return 1 otherwise.  */
 
 static int
 internal_function
@@ -1416,7 +1416,7 @@ re_node_set_remove_at (re_node_set *set, int idx)
 
 
 /* Add the token TOKEN to dfa->nodes, and return the index of the token.
-   Or return -1, if an error will be occured.  */
+   Or return -1, if an error will be occurred.  */
 
 static int
 internal_function
#2 lore raw
In reply to Yi, EungJun
Quoted 3 lines · EungJun

From: "Yi, EungJun" <[email protected]>

occured => occurred

In d18f76d I changed compat/regex to use the engine from gawk, there have been a few fixes of ours to it since then, some of which may be applicable for upstream inclusion:

    $ git --no-pager log --oneline --reverse d18f76d.. -- compat/regex
    a997bf4 compat/regex: get the gawk regex engine to compile within git
    de83172 Change regerror() declaration from K&R style to ANSI C (C89)
    b50f370 compat/regex: define out variables only used under RE_ENABLE_I18N
    178b331 compat/regex: get rid of old-style definition
    ce518bb Fix compat/regex ANSIfication on MinGW

But I don't think we should be taking patches like these. I think they should instead be sent to the upstream gawk developers who I'm sure would be happy to take them.

But this is not code that we're maintaining, and patches like these just make it harder to merge the code from upstream.

#3 lore raw

You're right. I will send this patch to gawk developers.

Thanks to your advice!

2012/5/6 Ævar Arnfjörð Bjarmason <[email protected]>:

Quoted 22 lines · EungJun
Quoted 3 lines

From: "Yi, EungJun" <[email protected]>

occured => occurred

In d18f76d I changed compat/regex to use the engine from gawk, there have been a few fixes of ours to it since then, some of which may be applicable for upstream inclusion:

   $ git --no-pager log --oneline --reverse d18f76d.. -- compat/regex
   a997bf4 compat/regex: get the gawk regex engine to compile within git
   de83172 Change regerror() declaration from K&R style to ANSI C (C89)
   b50f370 compat/regex: define out variables only used under RE_ENABLE_I18N
   178b331 compat/regex: get rid of old-style definition
   ce518bb Fix compat/regex ANSIfication on MinGW

But I don't think we should be taking patches like these. I think they should instead be sent to the upstream gawk developers who I'm sure would be happy to take them.

But this is not code that we're maintaining, and patches like these just make it harder to merge the code from upstream.

#4 lore raw
Quoted 1 line · EungJun

You're right. I will send this patch to gawk developers.

If you're doing that anyway it would also be very useful to see if they'd be willing to take the the rest of the patches we've accumulated since we initially brought it into our tree. I.e. the ones I showed in the shortlog I posted.