Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0D006200C26 for ; Sat, 25 Feb 2017 22:24:19 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 0B7E4160B5D; Sat, 25 Feb 2017 21:24:19 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 57485160B50 for ; Sat, 25 Feb 2017 22:24:18 +0100 (CET) Received: (qmail 81216 invoked by uid 500); 25 Feb 2017 21:24:17 -0000 Mailing-List: contact commits-help@trafficserver.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@trafficserver.apache.org Delivered-To: mailing list commits@trafficserver.apache.org Received: (qmail 81207 invoked by uid 99); 25 Feb 2017 21:24:17 -0000 Received: from Unknown (HELO matt-storage.apache.org) (207.244.88.132) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 25 Feb 2017 21:24:17 +0000 Received: by matt-storage.apache.org (ASF Mail Server at matt-storage.apache.org, from userid 33) id 63DA55FB5B; Sat, 25 Feb 2017 21:24:16 +0000 (UTC) Date: Sat, 25 Feb 2017 21:24:16 +0000 To: "commits@trafficserver.apache.org" Subject: [trafficserver] branch master updated: MemView: Fix strlen issue for OmniOS. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <20170225212416.12549.99710@matt-storage.apache.org> From: amc@apache.org Reply-To: "commits@trafficserver.apache.org" X-Git-Host: matt-storage.apache.org X-Git-Repo: trafficserver X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 7ce75e61ec68f215828dfd36215f2c59ce118ac5 X-Git-Newrev: 52037d977d91c2dd3a13236eea930fd585b9f4ad X-Git-Rev: 52037d977d91c2dd3a13236eea930fd585b9f4ad X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.3.dev Auto-Submitted: auto-generated archived-at: Sat, 25 Feb 2017 21:24:19 -0000 This is an automated email from the ASF dual-hosted git repository. amc pushed a commit to branch master in repository https://git-dual.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 52037d9 MemView: Fix strlen issue for OmniOS. 52037d9 is described below commit 52037d977d91c2dd3a13236eea930fd585b9f4ad Author: Alan M. Carroll AuthorDate: Fri Feb 24 19:30:25 2017 -0600 MemView: Fix strlen issue for OmniOS. --- lib/ts/MemView.cc | 9 ++++++++- lib/ts/MemView.h | 27 ++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/lib/ts/MemView.cc b/lib/ts/MemView.cc index f0f3eb9..bf0c1c9 100644 --- a/lib/ts/MemView.cc +++ b/lib/ts/MemView.cc @@ -26,9 +26,14 @@ #include #include #include +#include namespace ts { +StringView::StringView(const char *s) : _ptr(s), _size(strlen(s)) +{ +} + int memcmp(MemView const &lhs, MemView const &rhs) { @@ -69,7 +74,9 @@ intmax_t svtoi(StringView src, StringView *out, int base) { static const int8_t convert[256] = { - // 0 1 2 3 4 5 6 7 8 9 A B C D E F + /* [can't do this nicely because clang format won't allow exdented comments] + 0 1 2 3 4 5 6 7 8 9 A B C D E F + */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 00 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 10 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 20 diff --git a/lib/ts/MemView.h b/lib/ts/MemView.h index 39136f3..42388bc 100644 --- a/lib/ts/MemView.h +++ b/lib/ts/MemView.h @@ -40,8 +40,32 @@ namespace ts class MemView; class StringView; +/// Compare the memory in two views. +/// Return based on the first different byte. If one argument is a prefix of the other, the prefix +/// is considered the "smaller" value. +/// @return +/// - -1 if @a lhs byte is less than @a rhs byte. +/// - 1 if @a lhs byte is greater than @a rhs byte. +/// - 0 if the views contain identical memory. int memcmp(MemView const &lhs, MemView const &rhs); +/// Compare the strings in two views. +/// Return based on the first different character. If one argument is a prefix of the other, the prefix +/// is considered the "smaller" value. +/// @return +/// - -1 if @a lhs char is less than @a rhs char. +/// - 1 if @a lhs char is greater than @a rhs char. +/// - 0 if the views contain identical strings. int strcmp(StringView const &lhs, StringView const &rhs); +/// Compare the strings in two views. +/// Return based on the first different character. If one argument is a prefix of the other, the prefix +/// is considered the "smaller" value. The values are compared ignoring case. +/// @return +/// - -1 if @a lhs char is less than @a rhs char. +/// - 1 if @a lhs char is greater than @a rhs char. +/// - 0 if the views contain identical strings. +/// +/// @internal Why not ? Because the implementation would make copies anyway, might as well save +/// the cost of passing the pointers. int strcasecmp(StringView lhs, StringView rhs); /** Convert the text in @c StringView @a src to a numeric value. @@ -837,9 +861,6 @@ inline constexpr StringView::StringView(const char *ptr, size_t n) : _ptr(ptr), inline constexpr StringView::StringView(const char *start, const char *end) : _ptr(start), _size(end - start) { } -inline StringView::StringView(const char *s) : _ptr(s), _size(strlen(s)) -{ -} inline constexpr StringView::StringView(std::nullptr_t) : _ptr(nullptr), _size(0) { } -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" '].