{"id":11680,"url":"https://patchwork.libcamera.org/api/1.1/patches/11680/?format=json","web_url":"https://patchwork.libcamera.org/patch/11680/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210324070757.3530377-6-hiroh@chromium.org>","date":"2021-03-24T07:07:54","name":"[libcamera-devel,v2,5/8] android: CameraDevice: Return const shared_ptr& by camera()","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"a1f119e37fc5fae7afe9e7ff8c7c326f123b6bf9","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/1.1/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11680/mbox/","series":[{"id":1825,"url":"https://patchwork.libcamera.org/api/1.1/series/1825/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1825","date":"2021-03-24T07:07:51","name":"Improve pointer types in android HAL adaptation layer","version":2,"mbox":"https://patchwork.libcamera.org/series/1825/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11680/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11680/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 337BDC32E7\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 24 Mar 2021 07:08:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D68F668D75;\n\tWed, 24 Mar 2021 08:08:19 +0100 (CET)","from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com\n\t[IPv6:2607:f8b0:4864:20::1032])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4C27768D68\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Mar 2021 08:08:17 +0100 (CET)","by mail-pj1-x1032.google.com with SMTP id\n\tk23-20020a17090a5917b02901043e35ad4aso650751pji.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Mar 2021 00:08:16 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:7c07:24cd:c637:7fab])\n\tby smtp.gmail.com with ESMTPSA id\n\te63sm1246860pfe.208.2021.03.24.00.08.10\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 24 Mar 2021 00:08:11 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"hLIbjgdX\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=ZP/YkVyFa4d07fX875hWeHTHDNA4NCoVHKsu7ucwRFE=;\n\tb=hLIbjgdX4DES4nihhPuE9CdDvuAkN7wCesLTq/vYREGU/A3ygRZ5pJXL1Y7S60NW7t\n\t5toJrtlGm+c8kiPojmzlhA0UI9Lu3BgWYjw7wz7UwyZDhU+4CvrAJl+rHvIjsCkAswfv\n\tu0cRPrDNyvjxzE3EdUTbRRhtqVdsS/wCmUE1Q=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=ZP/YkVyFa4d07fX875hWeHTHDNA4NCoVHKsu7ucwRFE=;\n\tb=JEj5psqdaBZc0fbRspNkK1zpiCJh/htOlpXPtz8Rj/nUiL8GS5RbinIfPpRJtM2Dfa\n\ty24kdkp/yz2ys+8lB6Bps24ZY7FYAqd0A+rD4OjS9hPJHkjehaymfSBgvpXXcYbgszXX\n\tKajO03aJydZYSw01wpdYqP7tq52g7bN034QNXLJXgxT0x/v+8SQInODJCt/3ssOQv2ti\n\tXiqPh/doeUysTvxim9qxXmdgMz/8P0cDunP5Wnl89evTOFFexhwgw6FLVKmSzF42WG2Y\n\tKF9D4gCP3IgmIZmZ9hBRweyoJ7ntk80Hq1tL2RxlpYd/QXZSsUBdHcUGxUnaPpcgZbUC\n\teYPA==","X-Gm-Message-State":"AOAM533EDt+T//Ot652UnpzO5AG9UNVEHBAKnNOIveQs1PC4pTgPNb+X\n\tDEFk4eqIbUhTjwpXIw02bT3t0D6mwZYzqg==","X-Google-Smtp-Source":"ABdhPJxABgD4qHoB6erqlCG9+HtNnMyRWOVp8/SmwOFhGX0dhkfFwnlrj+4UW5/VCKsANU18e810vw==","X-Received":"by 2002:a17:902:d694:b029:e6:bc94:4931 with SMTP id\n\tv20-20020a170902d694b02900e6bc944931mr2261653ply.6.1616569692271; \n\tWed, 24 Mar 2021 00:08:12 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 24 Mar 2021 16:07:54 +0900","Message-Id":"<20210324070757.3530377-6-hiroh@chromium.org>","X-Mailer":"git-send-email 2.31.0.291.g576ba9dcdaf-goog","In-Reply-To":"<20210324070757.3530377-1-hiroh@chromium.org>","References":"<20210324070757.3530377-1-hiroh@chromium.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 5/8] android: CameraDevice: Return\n\tconst shared_ptr& by camera()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"CameraDevice::camera() originally returns shared_ptr. It is\nmandatory to make a copy by calling camera() in this way. There\nis no need of copying if a caller needs the reference of the\ncamera like const shared_ptr<Camera> cam = camera(). That is, it\nis a caller that copying is required. This changes the return\ntype of camera() to const shared_ptr&, so that we are able to\nreduce one redundant copy in the above case.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/android/camera_device.h | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\n--\n2.31.0.291.g576ba9dcdaf-goog","diff":"diff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex 555b33e7..14e26b4d 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -43,7 +43,7 @@ public:\n\n \tunsigned int id() const { return id_; }\n \tcamera3_device_t *camera3Device() { return &camera3Device_; }\n-\tstd::shared_ptr<libcamera::Camera> camera() const { return camera_; }\n+\tconst std::shared_ptr<libcamera::Camera> &camera() const { return camera_; }\n \tlibcamera::CameraConfiguration *cameraConfiguration() const\n \t{\n \t\treturn config_.get();\n","prefixes":["libcamera-devel","v2","5/8"]}