{"id":16159,"url":"https://patchwork.libcamera.org/api/patches/16159/?format=json","web_url":"https://patchwork.libcamera.org/patch/16159/","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":"<20220604185939.29163-5-laurent.pinchart@ideasonboard.com>","date":"2022-06-04T18:59:29","name":"[libcamera-devel,RFC,v2,04/14] test: yaml-parser: Use write() instead of fwrite()","commit_ref":null,"pull_url":null,"state":"rfc","archived":false,"hash":"a2001f6ae5c65a1eb4e2809d4105e1d279652f81","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16159/mbox/","series":[{"id":3161,"url":"https://patchwork.libcamera.org/api/series/3161/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3161","date":"2022-06-04T18:59:25","name":"Replace boost JSON parser with libyaml in Raspberry Pi IPA","version":2,"mbox":"https://patchwork.libcamera.org/series/3161/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16159/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16159/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 CFC01C3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  4 Jun 2022 19:00:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 600B665640;\n\tSat,  4 Jun 2022 21:00:04 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D952A6563A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  4 Jun 2022 21:00:02 +0200 (CEST)","from pendragon.ideasonboard.com (85-76-79-203-nat.elisa-mobile.fi\n\t[85.76.79.203])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A5BDEE0F;\n\tSat,  4 Jun 2022 21:00:01 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1654369204;\n\tbh=2b6Hode8CuVVoCxJIW23UGQNd3KaWgZiy3XrrRBmJ1Y=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=PstcApy2TYb9MGwM5dY3HCBeOA09uy3MdYoFrDo6RQyae3sZSRImcsQ03fMjg2RYV\n\tn8MgufFPTdXOQ6p4u1wLHoFTj3xL15DyqXNLlYw7CR7bcdCpc3yLVqiJx+CSur036I\n\tWZnurIKtFLi2cmKqUBcnymI5Ijllk7iAMD2ob0yyhD2SgVr6NbP8OXyKlqxcRwXc1o\n\tcJIj9pRTzOlRX7lHKySdEWx/A2cwL180jS7WOzIU4MqsndNZ/PARPuYfKCNjADyjuW\n\t//XT7BGBLDvFIcv53qp7Nk37fWz/Th0hK6p0jF/KUsWwDXM2XJivznQ5zU/Ou56hba\n\tZpkuOJm8LHiyA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1654369202;\n\tbh=2b6Hode8CuVVoCxJIW23UGQNd3KaWgZiy3XrrRBmJ1Y=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=UTipqGIMxtKUI617NRkjuI1j5EQmyQU+Ac9/6c89CSmcU82JRKGoDfsm7kCph5lx6\n\tj1oOQRF9tA0a3eTYmOn7ZJwKjtqeyDwa3nDHcg+1TB0DesCZjYMt1zJdomIjijLObQ\n\tn/AgzRNLUFLv/G93o8YGl5xMUm1yaCU0ys7pxsAI="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"UTipqGIM\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Sat,  4 Jun 2022 21:59:29 +0300","Message-Id":"<20220604185939.29163-5-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.35.1","In-Reply-To":"<20220604185939.29163-1-laurent.pinchart@ideasonboard.com>","References":"<20220604185939.29163-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC PATCH v2 04/14] test: yaml-parser: Use\n\twrite() instead of fwrite()","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"There's no point in wrapping a fd into a FILE to then only call fwrite()\nand fclose(). Use write() and close() directly.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/yaml-parser.cpp | 7 ++++---\n 1 file changed, 4 insertions(+), 3 deletions(-)","diff":"diff --git a/test/yaml-parser.cpp b/test/yaml-parser.cpp\nindex e75f8fe8f642..5ff4c3236dbf 100644\n--- a/test/yaml-parser.cpp\n+++ b/test/yaml-parser.cpp\n@@ -49,10 +49,11 @@ protected:\n \t\tif (fd == -1)\n \t\t\treturn false;\n \n-\t\tFILE *fh = fdopen(fd, \"w\");\n-\t\tfputs(content.c_str(), fh);\n+\t\tint ret = write(fd, content.c_str(), content.size());\n+\t\tclose(fd);\n \n-\t\tfclose(fh);\n+\t\tif (ret != static_cast<int>(content.size()))\n+\t\t\treturn false;\n \n \t\treturn true;\n \t}\n","prefixes":["libcamera-devel","RFC","v2","04/14"]}