From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: Regular expression libraries Date: Fri, 16 Dec 2016 09:54:35 -0500 Message-ID: References: <01d7e608-04d2-84a4-6143-e954bc9d569f@mit.edu> <2212c006-4a4d-a649-5857-01f4249d1e29@cs.ucla.edu> <874m24svia.fsf@linux-m68k.org> <460074d9-394a-5c0c-33f3-6be16e7082bb@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="RRn2DgHmdHFlt3vJOgqMHlV5GqanU3Ath" X-Trace: blaine.gmane.org 1481900102 10021 195.159.176.226 (16 Dec 2016 14:55:02 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 16 Dec 2016 14:55:02 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 16 15:54:56 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cHtuP-000165-WC for ged-emacs-devel@m.gmane.org; Fri, 16 Dec 2016 15:54:54 +0100 Original-Received: from localhost ([::1]:60952 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cHtuT-0002LI-LE for ged-emacs-devel@m.gmane.org; Fri, 16 Dec 2016 09:54:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cHtuJ-0002DZ-Ka for emacs-devel@gnu.org; Fri, 16 Dec 2016 09:54:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cHtuG-0000ye-IU for emacs-devel@gnu.org; Fri, 16 Dec 2016 09:54:47 -0500 Original-Received: from mout.kundenserver.de ([212.227.126.131]:56922) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cHtuG-0000wu-7h for emacs-devel@gnu.org; Fri, 16 Dec 2016 09:54:44 -0500 Original-Received: from [18.26.2.123] ([18.26.2.123]) by mrelayeu.kundenserver.de (mreue005 [212.227.15.168]) with ESMTPSA (Nemesis) id 0MOETY-1cCQFy1V2a-005VoZ for ; Fri, 16 Dec 2016 15:54:42 +0100 In-Reply-To: <460074d9-394a-5c0c-33f3-6be16e7082bb@cs.ucla.edu> X-Provags-ID: V03:K0:67JZr1+EzSE/W+Ksn6JoYzbk+VH/0zYpyILB8ENVZptNd6d4ixd +t7n2qE0gdja/wj9Z2hnlMzDANume7mxMcqPn8Gy/68XS667qVKajXiyRSZ8BWWLrR4rVOd o+glq45/F27313t4u+iStF4X35rop7aqtYUEKAIQrpl5IBfLSZRRodi0ecJrL1ZTuPNMv4Z IQe4OJPBvhRcxFoSiaq0A== X-UI-Out-Filterresults: notjunk:1;V01:K0:HmO8HBnsAqg=:KO3K6IqfT2Z+VN7ijhAWfu VVD+MDwk40T4RH+g8MQt67fle/N83mIHm8bQoYKT52U44es1Rk9BG0Xp6uJE6Xse47sCuOlmR q02PkUlXafqGwu3DSkxqLeR1FIvd2ZRQzda7/Zlv26I95VseGumOgZZXJDeM5bT5DyQDSM+XY PP4JyTNIYJ+eIJ4xtHveMppE04Z4hU2p/ojhaVR/5BlTZVfRX57ZeAY9rDvINApYFJgPtAYzx yxL2EIieoW+h073KyKfz2oZ6N4L29x67lVdL5usLqusPbvBU7rLo90SH+3nnzeinBFemH7jZL ZizU1Z2moc3BIYqVm+nlcAjO6PX8tzJAU07XHW2MmqZFx+LubDe2Ysegyi1z2kQclBeY/mWOm o+Uczl3b03DcWXs9TNpHTZC33sX/M7+NKN0UyZUcVrze6VwAz7BgO29MiqI+u9ibz9/trqNah yvjGzNuM0Il/lzzuhxQmm1mSnw9M4Ef6eaupe9ljZ3Op/4uDEKqeOAvi5mYCc4+cSh6CH/7Ez eDy4+EuPfKO+w1h0d+/CVOPoNar9fqHE94yhBRIFPr+YZGEx5eJktr6a0cUOCOLekqe4vepbh x7er7kgZjjkktIHezDLYPLfJkDsYoYYnUGZ8VaH1iWg2QW+j+LqhAN4GyMpMFq6UUaFPkeTII BhhYN7vI9bSgypt9r8dELqL0p3U1DyZbzoya+BtW9znpWLQcqz+mBWrstAOzUQlbme20= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.131 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:210517 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --RRn2DgHmdHFlt3vJOgqMHlV5GqanU3Ath Content-Type: multipart/mixed; boundary="6DuECwqj5OM9H456aUr5OxLhD8SifJEtT"; protected-headers="v1" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: emacs-devel@gnu.org Message-ID: Subject: Re: Regular expression libraries References: <01d7e608-04d2-84a4-6143-e954bc9d569f@mit.edu> <2212c006-4a4d-a649-5857-01f4249d1e29@cs.ucla.edu> <874m24svia.fsf@linux-m68k.org> <460074d9-394a-5c0c-33f3-6be16e7082bb@cs.ucla.edu> In-Reply-To: <460074d9-394a-5c0c-33f3-6be16e7082bb@cs.ucla.edu> --6DuECwqj5OM9H456aUr5OxLhD8SifJEtT Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2016-12-16 02:20, Paul Eggert wrote: > Andreas Schwab wrote: >>> Another library is in that list: >>>=20 >>> - The GNU C library, which ordinarily uses a DFA but which uses=20 >>> backtracking if needed. >>=20 >> But it doesn't support a gap. >=20 > True, but none of the others do either. Only the old glibc code > (which survives only in Emacs now) does that, as far as I know. Wait, now I'm confused. The master branch of glibc *does* include the fo= llowing in regex.h: extern int __re_search_2 (struct re_pattern_buffer *buffer, const char *string1, int length1, const char *string2, int length2, int start, int range, struct re_registers *regs, int stop); =E2=80=A6 but the implementation just allocates a large buffer and concat= enates both strings? Also, one naive question: the code does this: int len =3D length1 + length2; char *s =3D NULL; if (BE (length1 < 0 || length2 < 0 || stop < 0 || len < length1, 0)) return -2; According to the git history, the last check (len < length1) was added to= "avoid overflow in computing sum of lengths". But I thought int overflow= was undefined behaviour, so why does the len < length1 check make sense?= Thanks! Cl=C3=A9ment. --6DuECwqj5OM9H456aUr5OxLhD8SifJEtT-- --RRn2DgHmdHFlt3vJOgqMHlV5GqanU3Ath Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYVAArAAoJEPqg+cTm90wjsg4P/1spLQGCzRaBT3Uh6fjWGF/e Ap4k3LwZf/XSUH3Q4v0LEpN751ONKQLOT4jrphRsXoDJL+Y0u/9K/urgimBNwQOt AYHTrt8yHH9lfcOKSF9nsWXaPPE6TbL/H9z/AxNC5s6sR5deuCN2VOr9ThFHkLx7 j8d53D4R8mGpiXyoRG6axDptsLe5xy9kbwqacqfnk38s90iqZJVunUNfKtfm8KzY 93auGvP+TRG1N8mC2CCvw+7SEK9jVNyrkjZ6w3/T9iCstzPlR8lTy50ECM6PNME4 ILBLRTTSj7iCLyzjRxv36kieHbF9acFPYLLlnR7hCHoV6n04AY2ImJlIDA9E0qC8 i+I+y+y+40KBqN1oOTe93AC+H+8eO0AXdRSKMPHiXCKWl2Wc5e1T81ssx2sYfI+g 1o8VCEVTfii2VMief6sxOsOtxfGalW0Td7IGDA9rWhpiRVWt4/rDshagvNb1oXf1 zs4fkvjcUjP1yIi6HszlzF7PjDl7V1kvpQut3d+ijRVHlogoDfpjtmCb2H5yIYVe Vnga8KvcLHdR9Cpfwz4YodkxMy0qwR0NL41LJpzHTrOpBd79Xlg/MyraHJ1j/iIH 23n/TvAvNRgn3JYjXxfzmooNFuJv52F5wNFWbITbIZwRVG8YHcgZnHHEpA9h0MNS cSAqnKicjXxLIXqVospO =hCpa -----END PGP SIGNATURE----- --RRn2DgHmdHFlt3vJOgqMHlV5GqanU3Ath--