From patchwork Tue Mar 23 01:42:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 11650 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 16652C32E1 for ; Tue, 23 Mar 2021 01:42:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BC56D68D6D; Tue, 23 Mar 2021 02:42:47 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="aimzPDmL"; dkim-atps=neutral Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AAD5B68D65 for ; Tue, 23 Mar 2021 02:42:44 +0100 (CET) Received: by mail-pg1-x532.google.com with SMTP id u19so10112107pgh.10 for ; Mon, 22 Mar 2021 18:42:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8V85V8tXNr1xchcUdM20iZoQf/t2GgfTSG7qr1XgV9c=; b=aimzPDmLvZIGX159TOhNYr0p4uOrBjWN4vSgo0Euh8ccdzmmzG6k7jp744LAmr8tG5 4bXClizverSkbCZIUalmApwzwJeEZGoGls3PfB1ekJXax/pR0fpXEErvGJ0ljdALEUFT uR6LUyZFz1ZFs1nhUOMkl/diJ0fcIshEBDD94= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8V85V8tXNr1xchcUdM20iZoQf/t2GgfTSG7qr1XgV9c=; b=UpBxdwUx+az4GS8yKWIRBLJ3p17C1axGiRRIEW0VaJIGvXXUyntxOLHnWbYhMzOi13 vVTGq6uV7zGZXHudHY9TV6k8wNmMHHd27XcZIVtqMdGbJOCf8h51pcL3wos7NWrE/l9Y tuasVdhX8/BYoFunfa9lLY//TBUH6G/CORk/QnGt2k1iFNh0SsVngDlzDGvlzMUf+lfL 3gTDDKra7OQruGNtv3YODcgq4MqCTB8rXnRF6g6whAA5ibWo4b7mMFXldkkLBqiOQ3Ig xEUTE1aDAqRMcqrVkCFQwLQmhna6cYUmpSxT76z/fNn9QC2I6rOGESiDNYslrvxLkZDl uXIg== X-Gm-Message-State: AOAM530bncNeqOI3ySW7IkX2MfvMdo0KrLguVJ0J6Z1zgZuPEJN80Px4 DVA5tsYUdNjS8P6BM/kpCQyOC5o9EzHjAQ== X-Google-Smtp-Source: ABdhPJzdBwa565Zpz0ubtj0pj9OisFT0N11AdrafPjlp6r5Dv705bCvsXjLl6C0LIoVZGdzE1vi6ag== X-Received: by 2002:aa7:956d:0:b029:1f1:5ba6:2a58 with SMTP id x13-20020aa7956d0000b02901f15ba62a58mr2500464pfq.63.1616463763173; Mon, 22 Mar 2021 18:42:43 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:8115:e5cc:747b:64de]) by smtp.gmail.com with ESMTPSA id h13sm590527pjv.52.2021.03.22.18.42.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Mar 2021 18:42:42 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Tue, 23 Mar 2021 10:42:23 +0900 Message-Id: <20210323014226.3211412-6-hiroh@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210323014226.3211412-1-hiroh@chromium.org> References: <20210323014226.3211412-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 5/8] android: CameraDevice: Return const shared_ptr& by camera() X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" CameraDevice::camera() originally returns shared_ptr. It is mandatory to make a copy by calling camera() in this way. There is no need of copying if a caller needs the reference of the camera like const shared_ptr cam = camera(). That is, it is a caller that copying is required. This changes the return type of camera() to const shared_ptr&, so that we are able to reduce one redundant copy in the above case. Signed-off-by: Hirokazu Honda Reviewed-by: Laurent Pinchart --- src/android/camera_device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.31.0.rc2.261.g7f71774620-goog diff --git a/src/android/camera_device.h b/src/android/camera_device.h index 555b33e7..14e26b4d 100644 --- a/src/android/camera_device.h +++ b/src/android/camera_device.h @@ -43,7 +43,7 @@ public: unsigned int id() const { return id_; } camera3_device_t *camera3Device() { return &camera3Device_; } - std::shared_ptr camera() const { return camera_; } + const std::shared_ptr &camera() const { return camera_; } libcamera::CameraConfiguration *cameraConfiguration() const { return config_.get();