From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 5E578138346 for ; Sun, 5 Jan 2020 16:08:36 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DC3A1E09F6; Sun, 5 Jan 2020 16:08:34 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B77E0E09F6 for ; Sun, 5 Jan 2020 16:08:34 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id BE2D334DDC6 for ; Sun, 5 Jan 2020 16:08:33 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id BB3D2B8 for ; Sun, 5 Jan 2020 16:08:30 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1578239968.a13802923b7fef29333c1af7c2b154a83b5bd739.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/ X-VCS-Repository: proj/portage-utils X-VCS-Files: libq/contents.c X-VCS-Directories: libq/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: a13802923b7fef29333c1af7c2b154a83b5bd739 X-VCS-Branch: master Date: Sun, 5 Jan 2020 16:08:30 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 135c305d-7181-424f-90cf-cdf70515ef59 X-Archives-Hash: fcb1e1ab86fb5afeb3fa9f8076abb230 commit: a13802923b7fef29333c1af7c2b154a83b5bd739 Author: Fabian Groffen gentoo org> AuthorDate: Sun Jan 5 15:48:26 2020 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Sun Jan 5 15:59:28 2020 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=a1380292 libq/contents: drop expensive checks for newline and tabs Signed-off-by: Fabian Groffen gentoo.org> libq/contents.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/libq/contents.c b/libq/contents.c index 3e719a6..7f4351d 100644 --- a/libq/contents.c +++ b/libq/contents.c @@ -1,5 +1,5 @@ /* - * Copyright 2005-2019 Gentoo Foundation + * Copyright 2005-2020 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 * * Copyright 2005-2008 Ned Ludd - @@ -24,22 +24,14 @@ contents_parse_line(char *line) static contents_entry e; char *p; - if (!line || !*line || *line == '\n') + if (line == NULL || *line == '\0' || *line == '\n') return NULL; /* chop trailing newline */ - if ((p = strrchr(line, '\n')) != NULL) + p = &line[strlen(line) - 1]; + if (*p == '\n') *p = '\0'; - /* ferringb wants to break portage/vdb by using tabs vs spaces - * so filenames can have lame ass spaces in them.. - * (I smell Windows near by) - * Anyway we just convert that crap to a space so we can still - * parse quickly */ - p = line; - while ((p = strchr(p, '\t')) != NULL) - *p = ' '; - memset(&e, 0x00, sizeof(e)); e._data = line;