[{"id":733,"web_url":"https://patchwork.libcamera.org/comment/733/","msgid":"<20190201090222.GM19527@bigcity.dyn.berto.se>","date":"2019-02-01T09:02:22","subject":"Re: [libcamera-devel] [PATCH v2 5/8] cam: options: Store options in\n\ta list instead of a vector","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your work.\n\nOn 2019-02-01 01:47:18 +0200, Laurent Pinchart wrote:\n> When option are added to the parser, they are stored in the\n> OptionsParser::options_ vector, and a pointer to the option referencing\n> the vector entry is indexed in the OptionsParser::optionsMap_ map. When\n> the next option is added the vector may be resized, which invalidates\n> the pointers stored in the map.\n> \n> Fix this by storing the options in an std::list<> instead of\n> std::vector<>.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/cam/options.h | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/cam/options.h b/src/cam/options.h\n> index 2272385a0b83..b9b7bd258c03 100644\n> --- a/src/cam/options.h\n> +++ b/src/cam/options.h\n> @@ -8,8 +8,8 @@\n>  #define __CAM_OPTIONS_H__\n>  \n>  #include <ctype.h>\n> +#include <list>\n>  #include <map>\n> -#include <vector>\n>  \n>  enum OptionArgument {\n>  \tArgumentNone,\n> @@ -57,7 +57,7 @@ public:\n>  \tvoid usage();\n>  \n>  private:\n> -\tstd::vector<Option> options_;\n> +\tstd::list<Option> options_;\n>  \tstd::map<unsigned int, Option *> optionsMap_;\n>  };\n>  \n> -- \n> Regards,\n> \n> Laurent Pinchart\n>","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x142.google.com (mail-lf1-x142.google.com\n\t[IPv6:2a00:1450:4864:20::142])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 70C1A60DB5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  1 Feb 2019 10:02:24 +0100 (CET)","by mail-lf1-x142.google.com with SMTP id f5so4437693lfc.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 01 Feb 2019 01:02:24 -0800 (PST)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\tg11sm420551lfg.31.2019.02.01.01.02.22\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tFri, 01 Feb 2019 01:02:23 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=nkn05mf3qh95yGOTanBgIAj64mk9qWnZAA9ShGD2gzw=;\n\tb=X+hx6D9RyhzUgFL/xjm+w0jLHP17c5e815+kDAJgRDa93B9TsvJ6nHr8bLq8wjs7L+\n\tDxqgdmnpDwMLt6q+a9hDqtruP6/ZB219R0nt/TAkcjlbDAZYEpHrrF/wlYoNEzJyDJXV\n\t5XHDB0QkJd5r7QwksTIcNAIxNPBa8ECTx5WXqUVODlxl7K1sAbmMq+WYMnRo/YrkmCXB\n\t7iHH6M7Sr/T61zKEUvzGtcEc34OXlHjgAOr3NwWvO2Z6UjSPTNMEYZjnHcMdf2NSb5aW\n\tY39W0fWL4/pz5a0RKwvZ182nYQ2t4USjLPuXOnWDNxYXeSjhqJbYNrs/Fd6yK3mU2rkf\n\t2XFA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=nkn05mf3qh95yGOTanBgIAj64mk9qWnZAA9ShGD2gzw=;\n\tb=Sz6OhtU3ZgICcJjTx+m3S0XnNiL+p5sPzwkuVemI6eUJnGlheSYH8BRzZrDatc19sP\n\tZdKmt1AaPJ0Y9VS8j4ZEkchDDB74w7OBgLHjvIHtgprLMkXBLyN7B28T2J0KOol4/eCe\n\t+8ZZphKv1xc15w0k4hgJdFwxx2ybdl2CdOhSC02G9UGnFMVT3/8VLLRMZcwSCFWAn3uh\n\tBUQGIehor63yOChe5uqI0EDe+kswSBxFlfZXkaVuTgtkuDPvxIITmAHxg6pevlEtlwle\n\tENoQvghzBw/zjaQxdFRtUYGM5/PdmjZaGKWoHnoouJF69IkZW0qFuLkv41PE/5vyRGj1\n\tiZXg==","X-Gm-Message-State":"AJcUukerdtJDlE6wztOoNNyAI4MVS3bA1ueF6Ff0ULyd3u7rfAigPxHO\n\trZKLAVJLmiB/AC5aE/oPIzvEaA==","X-Google-Smtp-Source":"ALg8bN6xJzGdjxXLqonH3fev2C2/w8gdKC52MsJ6XGrNw5xzG+XDbucJj0qMbYLgVfzQlIC09hu/Xg==","X-Received":"by 2002:a19:9508:: with SMTP id\n\tx8mr29583203lfd.112.1549011743744; \n\tFri, 01 Feb 2019 01:02:23 -0800 (PST)","Date":"Fri, 1 Feb 2019 10:02:22 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190201090222.GM19527@bigcity.dyn.berto.se>","References":"<20190131234721.22606-1-laurent.pinchart@ideasonboard.com>\n\t<20190131234721.22606-6-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190131234721.22606-6-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 5/8] cam: options: Store options in\n\ta list instead of a vector","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Fri, 01 Feb 2019 09:02:24 -0000"}}]