diff options
| author | Mattias EngdegÄrd | 2020-04-16 11:04:24 +0200 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2020-04-16 12:14:38 +0200 |
| commit | 905c0a13f7929298cb36151f46dbef03f7bdcbe4 (patch) | |
| tree | b2adb12f5e6810bf3784628efae69828bba3c464 /lisp/erc | |
| parent | 01436fddfb2587271391e72b7eaa6c5c541b46d8 (diff) | |
| download | emacs-905c0a13f7929298cb36151f46dbef03f7bdcbe4.tar.gz emacs-905c0a13f7929298cb36151f46dbef03f7bdcbe4.zip | |
Fix bugs, inefficiencies and bad style in regexps
Found by relint. See discussion at
https://lists.gnu.org/archive/html/emacs-devel/2020-04/msg00265.html
* lisp/org/org-table.el (org-table-finish-edit-field):
* lisp/arc-mode.el (archive-rar-summarize):
Avoid wrapped subsumption in repeated sequences.
* lisp/erc/erc-dcc.el (erc-dcc-ctcp-query-send-regexp): Replace
inefficient repeated empty-matching expression with a plain greedy
form.
(erc-dcc-handle-ctcp-send): Adjust group numbers.
* lisp/net/puny.el (puny-encode-domain): Fix fast-path shortcut
pattern so that it actually works as intended.
* lisp/progmodes/gdb-mi.el (gdb-control-commands-regexp):
* lisp/vc/diff-mode.el (diff-imenu-generic-expression):
Remove superfluous backslashes.
* lisp/progmodes/scheme.el (scheme-imenu-generic-expression):
Correct confused definition-matching pattern which would match more
than intended.
* lisp/textmodes/sgml-mode.el (sgml-tag-name-re): Avoid inefficient
matching by using the fact that the first character cannot match the
last char of sgml-name-re.
Diffstat (limited to 'lisp/erc')
| -rw-r--r-- | lisp/erc/erc-dcc.el | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index 26701cec1e4..8ccceec4594 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el | |||
| @@ -627,11 +627,11 @@ that subcommand." | |||
| 627 | ?q query ?n nick ?u login ?h host)))) | 627 | ?q query ?n nick ?u login ?h host)))) |
| 628 | 628 | ||
| 629 | (defconst erc-dcc-ctcp-query-send-regexp | 629 | (defconst erc-dcc-ctcp-query-send-regexp |
| 630 | (concat "^DCC SEND \\(" | 630 | (concat "^DCC SEND \\(?:" |
| 631 | ;; Following part matches either filename without spaces | 631 | ;; Following part matches either filename without spaces |
| 632 | ;; or filename enclosed in double quotes with any number | 632 | ;; or filename enclosed in double quotes with any number |
| 633 | ;; of escaped double quotes inside. | 633 | ;; of escaped double quotes inside. |
| 634 | "\"\\(\\(.*?\\(\\\\\"\\)?\\)+?\\)\"\\|\\([^ ]+\\)" | 634 | "\"\\(\\(?:\\\\\"\\|[^\"\\]\\)+\\)\"\\|\\([^ ]+\\)" |
| 635 | "\\) \\([0-9]+\\) \\([0-9]+\\) *\\([0-9]*\\)")) | 635 | "\\) \\([0-9]+\\) \\([0-9]+\\) *\\([0-9]*\\)")) |
| 636 | 636 | ||
| 637 | (define-inline erc-dcc-unquote-filename (filename) | 637 | (define-inline erc-dcc-unquote-filename (filename) |
| @@ -653,11 +653,11 @@ It extracts the information about the dcc request and adds it to | |||
| 653 | ?r "SEND" ?n nick ?u login ?h host)) | 653 | ?r "SEND" ?n nick ?u login ?h host)) |
| 654 | ((string-match erc-dcc-ctcp-query-send-regexp query) | 654 | ((string-match erc-dcc-ctcp-query-send-regexp query) |
| 655 | (let ((filename | 655 | (let ((filename |
| 656 | (or (match-string 5 query) | 656 | (or (match-string 2 query) |
| 657 | (erc-dcc-unquote-filename (match-string 2 query)))) | 657 | (erc-dcc-unquote-filename (match-string 1 query)))) |
| 658 | (ip (erc-decimal-to-ip (match-string 6 query))) | 658 | (ip (erc-decimal-to-ip (match-string 3 query))) |
| 659 | (port (match-string 7 query)) | 659 | (port (match-string 4 query)) |
| 660 | (size (match-string 8 query))) | 660 | (size (match-string 5 query))) |
| 661 | ;; FIXME: a warning really should also be sent | 661 | ;; FIXME: a warning really should also be sent |
| 662 | ;; if the ip address != the host the dcc sender is on. | 662 | ;; if the ip address != the host the dcc sender is on. |
| 663 | (erc-display-message | 663 | (erc-display-message |