From patchwork Tue Jan 10 17:23:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 18846 Received: (qmail 28716 invoked by alias); 10 Jan 2017 17:23:34 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 28701 invoked by uid 89); 10 Jan 2017 17:23:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=no version=3.3.2 spammy=__THROW, __destlen, __throw, __dest X-HELO: EUR02-HE1-obe.outbound.protection.outlook.com From: Wilco Dijkstra To: "libc-alpha@sourceware.org" CC: nd Subject: [PATCH] Remove index defines Date: Tue, 10 Jan 2017 17:23:20 +0000 Message-ID: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Wilco.Dijkstra@arm.com; x-ms-office365-filtering-correlation-id: 8bffe5be-dc97-40e3-df3c-08d4397d5f82 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:AM5PR0802MB2609; x-microsoft-exchange-diagnostics: 1; AM5PR0802MB2609; 7:GHxWow2iVBUr7jvH6CSHW/XodZzyO/F7AE4tfZHLmtr9gqYATH6cx9YiRqEyuwqweUTnB+IIxVA9bxzYNvXmZKJj2CnwQqt3+b2guxSn/dTJVlH0ZlXH8qifPPU6laFh2d6wVzB/p9nIRWudW7H/a9fHgjjb5ScIAYEtA/ywbJj7CuaGjuD8+ZkZD99HdZkDt9o9rBWJftR9/CmeCQvoqfF0/4p0ApTD5rCQmGgdG/B3hpT16W0rZzivfYt8xXmqBZDSsl+Y1w/BbldCh2aKrYQbK12F41bBuwjhKj1Hdk/Dwemgu6S1KoPghi9jnQCgJfja+THHRdOfCJ/O6Pv3ML3ksgrOD44lai2rx/Vt682Te0Ss7PIaumwhcMEQsv9npH/0AOP4SVq7aSowwRIS13RPxAE8jtAs+Hifi4JHGVpKNkDB3JlnBgTlyRKk16cZ7Z5BgtoFJEuDzDeYf8ZF8w== nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148); SRVR:AM5PR0802MB2609; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2609; x-forefront-prvs: 01834E39B7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(7916002)(39450400003)(39840400002)(39860400002)(39850400002)(39410400002)(189002)(377424004)(199003)(54534003)(101416001)(122556002)(74316002)(3846002)(6116002)(97736004)(92566002)(105586002)(189998001)(7736002)(305945005)(2900100001)(33656002)(8936002)(6436002)(5660300001)(7696004)(81166006)(8676002)(450100001)(81156014)(68736007)(110136003)(9686003)(2501003)(102836003)(106116001)(106356001)(2906002)(5640700003)(25786008)(55016002)(38730400001)(99286003)(3280700002)(3660700001)(6506006)(77096006)(4326007)(2351001)(66066001)(50986999)(54356999)(575784001)(6916009)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2609; H:AM5PR0802MB2610.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jan 2017 17:23:20.0528 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2609 As a minor cleanup remove the (r)index defines from include/string.h as they are only used internally in a few places. Rename a few uses that occur in libc.so. ChangeLog: 2017-01-10 Wilco Dijkstra * include/string.h (index): Remove define. (rindex): Likewise. * misc/getttyent.c (__getttyent): Rename index to strchr. * misc/ttyslot.c (ttyslot): Rename rindex to strrchr. diff --git a/include/string.h b/include/string.h index e145bfdb4cb781fbced37634410dd2b844571f16..89e4bc4c91b0aea9480b21d43f95c75554d50383 100644 --- a/include/string.h +++ b/include/string.h @@ -149,15 +149,6 @@ extern __typeof (mempcpy) mempcpy __asm__ ("__mempcpy"); extern __typeof (stpcpy) stpcpy __asm__ ("__stpcpy"); #endif -# ifndef _ISOMAC -# ifndef index -# define index(s, c) (strchr ((s), (c))) -# endif -# ifndef rindex -# define rindex(s, c) (strrchr ((s), (c))) -# endif -# endif - extern void *__memcpy_chk (void *__restrict __dest, const void *__restrict __src, size_t __len, size_t __destlen) __THROW; diff --git a/misc/getttyent.c b/misc/getttyent.c index d2af87012343b0596d50dfdecff14ecf55c16732..73002f52d10dc30af95d3163bc5f7a1992fe9dce 100644 --- a/misc/getttyent.c +++ b/misc/getttyent.c @@ -78,7 +78,7 @@ __getttyent (void) return (NULL); } /* skip lines that are too big */ - if (!index(p, '\n')) { + if (!strchr (p, '\n')) { while ((c = getc_unlocked(tf)) != '\n' && c != EOF) ; continue; @@ -127,7 +127,7 @@ __getttyent (void) tty.ty_comment = p; if (*p == 0) tty.ty_comment = 0; - if ((p = index(p, '\n'))) + if ((p = strchr (p, '\n'))) *p = '\0'; return (&tty); } @@ -179,7 +179,7 @@ internal_function value (char *p) { - return ((p = index(p, '=')) ? ++p : NULL); + return ((p = strchr (p, '=')) ? ++p : NULL); } int diff --git a/misc/ttyslot.c b/misc/ttyslot.c index 0ed14d73ea53e7ed09c58717316fea20fa0177eb..2f3c7953d75c8522f3b6447c43a9e33aa19e8f72 100644 --- a/misc/ttyslot.c +++ b/misc/ttyslot.c @@ -56,7 +56,7 @@ ttyslot (void) __setttyent(); for (cnt = 0; cnt < 3; ++cnt) if (__ttyname_r (cnt, name, buflen) == 0) { - if ((p = rindex(name, '/'))) + if ((p = strrchr (name, '/'))) ++p; else p = name;