{"id":10531,"url":"https://patchwork.libcamera.org/api/patches/10531/?format=json","web_url":"https://patchwork.libcamera.org/patch/10531/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20201201174314.12774-2-email@uajain.com>","date":"2020-12-01T17:43:11","name":"[libcamera-devel,v2,1/4] simple-cam: Make return codes consistent for main()","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"024492c6917701bee90eb52f0243e005f496cfb8","submitter":{"id":1,"url":"https://patchwork.libcamera.org/api/people/1/?format=json","name":"Umang Jain","email":"email@uajain.com"},"delegate":{"id":11,"url":"https://patchwork.libcamera.org/api/users/11/?format=json","username":"kbingham","first_name":"Kieran","last_name":"Bingham","email":"kieran.bingham@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/10531/mbox/","series":[{"id":1498,"url":"https://patchwork.libcamera.org/api/series/1498/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1498","date":"2020-12-01T17:43:10","name":"simple-cam: Provide event-loop backed by libevent","version":2,"mbox":"https://patchwork.libcamera.org/series/1498/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10531/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10531/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 CE2DEBE177\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  1 Dec 2020 17:43:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9A54B63502;\n\tTue,  1 Dec 2020 18:43:26 +0100 (CET)","from mail.uajain.com (static.126.159.217.95.clients.your-server.de\n\t[95.217.159.126])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7253663504\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  1 Dec 2020 18:43:24 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=uajain.com header.i=@uajain.com\n\theader.b=\"o/Ed1NHY\"; dkim-atps=neutral","From":"Umang Jain <email@uajain.com>","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=uajain.com; s=mail;\n\tt=1606844603; bh=oRjCMpNIRqSLO/uBfgIa8QnFPiHqODBbal+gfGMUfNA=;\n\th=From:To:Cc:Subject:In-Reply-To:References;\n\tb=o/Ed1NHY8mKEVYLioE3WAvbNmAGyoWBm8oMkVP0bwdSP7LFVPBbVUvC74cAt/yUY9\n\t5qG9Rk5Si/8qWPq3x3iTvkKXHD/Gt6xyJC65yLTDy0AlntlJiIuCZ8XuAMtOsSVmfS\n\tkICUyLy3DZWNVyMfk7bkGTLOhExaXnVLOW6JQO2s+/NHcEa9QRKQ7d254m5yvtOJqS\n\tW9j+vLvXeOI+OsdZ/4qpeemg0Iu6Xv/safl+MC0Z7BC4cvnjCCTJsCnAkd25ptM8jD\n\tOnDieR6rRhlW8dqmQecH5fv8/sKxcYDxvg0g+AQsmf2JkiPHo28EUtFHCeAKrqMlpb\n\tsRMqvw/ufsbvg==","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  1 Dec 2020 23:13:11 +0530","Message-Id":"<20201201174314.12774-2-email@uajain.com>","In-Reply-To":"<20201201174314.12774-1-email@uajain.com>","References":"<20201201174314.12774-1-email@uajain.com>","Mime-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 1/4] simple-cam: Make return codes\n\tconsistent for main()","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":"Use EXIT_FAILURE or EXIT_SUCCESS to indicate program execution\nstatus. These are the return codes that should be used for main()\nas per the C++ standard.\n\nSigned-off-by: Umang Jain <email@uajain.com>\n---\n simple-cam.cpp | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)","diff":"diff --git a/simple-cam.cpp b/simple-cam.cpp\nindex 727bb6d..e88fb85 100644\n--- a/simple-cam.cpp\n+++ b/simple-cam.cpp\n@@ -184,7 +184,7 @@ int main()\n \tint ret = camera->configure(config.get());\n \tif (ret) {\n \t\tstd::cout << \"CONFIGURATION FAILED!\" << std::endl;\n-\t\treturn -1;\n+\t\treturn EXIT_FAILURE;\n \t}\n #endif\n \n@@ -217,7 +217,7 @@ int main()\n \t\tint ret = allocator->allocate(cfg.stream());\n \t\tif (ret < 0) {\n \t\t\tstd::cerr << \"Can't allocate buffers\" << std::endl;\n-\t\t\treturn -ENOMEM;\n+\t\t\treturn EXIT_FAILURE;\n \t\t}\n \n \t\tunsigned int allocated = allocator->buffers(cfg.stream()).size();\n@@ -250,7 +250,7 @@ int main()\n \t\tif (!request)\n \t\t{\n \t\t\tstd::cerr << \"Can't create request\" << std::endl;\n-\t\t\treturn -ENOMEM;\n+\t\t\treturn EXIT_FAILURE;\n \t\t}\n \n \t\tconst std::unique_ptr<FrameBuffer> &buffer = buffers[i];\n@@ -259,7 +259,7 @@ int main()\n \t\t{\n \t\t\tstd::cerr << \"Can't set buffer for request\"\n \t\t\t\t  << std::endl;\n-\t\t\treturn ret;\n+\t\t\treturn EXIT_FAILURE;\n \t\t}\n \n \t\t/*\n@@ -341,5 +341,5 @@ int main()\n \tcamera.reset();\n \tcm->stop();\n \n-\treturn 0;\n+\treturn EXIT_SUCCESS;\n }\n","prefixes":["libcamera-devel","v2","1/4"]}