From patchwork Fri Mar 22 10:43:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 786 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5CF6C6110A for ; Fri, 22 Mar 2019 11:43:59 +0100 (CET) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 96A2810D2; Fri, 22 Mar 2019 11:43:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1553251435; bh=RJ99mCOaa6LBykVeCADsMPf0dkS0adtrYvIBNu4z06o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gnAk8sWeRj96L4RJXBOYNCOJaTb/ZIeWIjft7jvv5JZrDHLs+mWTBuU1GAIBj8Phb 7nQv1SVyjPtpJbkIB7hy1iHa8zk0sDuJ97YYLiM9QEBHfY1eU2B0ely6kCDv6DY549 wQpdb1c8siKmIpWx/ZGWBfoOk+bnrU2TZ8gKOJGs= From: Kieran Bingham To: LibCamera Devel Date: Fri, 22 Mar 2019 10:43:49 +0000 Message-Id: <20190322104350.31091-4-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190322104350.31091-1-kieran.bingham@ideasonboard.com> References: <20190322104350.31091-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/4] libcamera: log: Use internal basename implementation. X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 10:43:59 -0000 Differing implementations of basename() exist, some of which may modify the content of the string passed as an argument. The implementation of basename() is trivial, thus to support different toolchains, provide our own version which accepts and returns a const char*. Signed-off-by: Kieran Bingham --- src/libcamera/log.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp index 26ebf410a7a9..7d930cd6b99e 100644 --- a/src/libcamera/log.cpp +++ b/src/libcamera/log.cpp @@ -358,6 +358,12 @@ static const char *log_severity_name(LogSeverity severity) return "UNKWN"; } +static const char *basename(const char *path) +{ + const char *base = strrchr(path, '/'); + return base ? ++base : path; +} + /** * \class LogMessage * \brief Internal log message representation.