GNU bug report logs - #17814
24.3.91; better string manipulation in subr-x

Previous Next

Package: emacs;

Reported by: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>

Date: Thu, 19 Jun 2014 19:12:01 UTC

Severity: wishlist

Found in version 24.3.91

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>
Cc: 17814 <at> debbugs.gnu.org
Subject: bug#17814: 24.3.91; better string manipulation in subr-x
Date: Fri, 20 Jun 2014 15:14:56 -0400
>   (string-match "\\`[\s\t\n\r]*\\(.*?\\)[\s\t\n\r]*\\'" string)
>   (if (or (< 0 (match-beginning 1)) (< (match-end 1) (match-end 0)))
>       (match-string 1 string)
>     string))

The above string-match will fail on a string that has a newline, and the
subsequent code will use whatever was the old match-data, resulting in
broken behavior.

Other than that, I don't have any opinion on such changes (I've never
heard anyone complain about code size or cpu-time of any of those
functions, so I think it largely doesn't matter either way).

        Stefan




This bug report was last modified 6 years and 253 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.