Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/5478/?format=api
http://patches.dpdk.org/api/patches/5478/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1434552528-3576-6-git-send-email-maciejx.t.gajdzica@intel.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<1434552528-3576-6-git-send-email-maciejx.t.gajdzica@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1434552528-3576-6-git-send-email-maciejx.t.gajdzica@intel.com", "date": "2015-06-17T14:48:47", "name": "[dpdk-dev,v2,5/6] cfgfile: fixed calling free for each section in rte_cfgfile_close", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "93bd49f41286ff2640e2bca14fe3cf6821c351a5", "submitter": { "id": 18, "url": "http://patches.dpdk.org/api/people/18/?format=api", "name": "Maciej Gajdzica", "email": "maciejx.t.gajdzica@intel.com" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1434552528-3576-6-git-send-email-maciejx.t.gajdzica@intel.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/5478/comments/", "check": "pending", "checks": "http://patches.dpdk.org/api/patches/5478/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id CDFF2C4CC;\n\tWed, 17 Jun 2015 17:10:25 +0200 (CEST)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id 22826C4B0\n\tfor <dev@dpdk.org>; Wed, 17 Jun 2015 17:10:23 +0200 (CEST)", "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga101.jf.intel.com with ESMTP; 17 Jun 2015 08:10:05 -0700", "from unknown (HELO stargo) ([10.217.248.233])\n\tby orsmga002.jf.intel.com with SMTP; 17 Jun 2015 08:10:01 -0700", "by stargo (sSMTP sendmail emulation);\n\tWed, 17 Jun 2015 17:08:38 +0200" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.13,633,1427785200\"; d=\"scan'208\";a=\"748397832\"", "From": "Maciej Gajdzica <maciejx.t.gajdzica@intel.com>", "To": "dev@dpdk.org", "Date": "Wed, 17 Jun 2015 16:48:47 +0200", "Message-Id": "<1434552528-3576-6-git-send-email-maciejx.t.gajdzica@intel.com>", "X-Mailer": "git-send-email 1.9.1", "In-Reply-To": "<1434552528-3576-1-git-send-email-maciejx.t.gajdzica@intel.com>", "References": "<1434552528-3576-1-git-send-email-maciejx.t.gajdzica@intel.com>", "Subject": "[dpdk-dev] [PATCH v2 5/6] cfgfile: fixed calling free for each\n\tsection in rte_cfgfile_close", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "From: Pawel Wodkowski <pawelx.wodkowski@intel.com>\n\nSigned-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>\n---\n lib/librte_cfgfile/rte_cfgfile.c | 53 +++++++++++++++++++++-----------------\n 1 file changed, 30 insertions(+), 23 deletions(-)", "diff": "diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c\nindex 4e77ef5..2ce5d70 100644\n--- a/lib/librte_cfgfile/rte_cfgfile.c\n+++ b/lib/librte_cfgfile/rte_cfgfile.c\n@@ -43,13 +43,13 @@\n \n struct rte_cfgfile_section {\n \tchar name[CFG_NAME_LEN];\n-\tint num_entries;\n+\tsize_t num_entries;\n \tstruct rte_cfgfile_entry *entries[0];\n };\n \n struct rte_cfgfile {\n \tint flags;\n-\tint num_sections;\n+\tsize_t num_sections;\n \tstruct rte_cfgfile_section *sections[0];\n };\n \n@@ -60,6 +60,15 @@ struct rte_cfgfile {\n * for new entries do we add in */\n #define CFG_ALLOC_ENTRY_BATCH 16\n \n+/* Helpers */\n+\n+#define _skip_spaceses(str) ({ \\\n+\t__typeof__(str) p = (str); \\\n+\twhile (isspace(*p)) \\\n+\t\tp++; \\\n+\tp; \\\n+})\n+\n static unsigned\n _strip(char *str, unsigned len)\n {\n@@ -424,28 +433,26 @@ rte_cfgfile_load(const char *filename, int flags)\n \treturn cfg;\n }\n \n-\n-int rte_cfgfile_close(struct rte_cfgfile *cfg)\n+int\n+rte_cfgfile_close(struct rte_cfgfile *cfg)\n {\n-\tint i, j;\n+\tstruct rte_cfgfile_section *s;\n+\tsize_t i, j;\n \n \tif (cfg == NULL)\n \t\treturn -1;\n \n \tfor (i = 0; i < cfg->num_sections; i++) {\n-\t\tif (cfg->sections[i] != NULL) {\n-\t\t\tif (cfg->sections[i]->num_entries) {\n-\t\t\t\tfor (j = 0; j < cfg->sections[i]->num_entries;\n-\t\t\t\t\tj++) {\n-\t\t\t\t\tif (cfg->sections[i]->entries[j] !=\n-\t\t\t\t\t\tNULL)\n-\t\t\t\t\t\tfree(cfg->sections[i]->\n-\t\t\t\t\t\t\tentries[j]);\n-\t\t\t\t}\n-\t\t\t}\n-\t\t\tfree(cfg->sections[i]);\n+\t\ts = cfg->sections[i];\n+\t\tfor (j = 0; j < s->num_entries; j++) {\n+\t\t\tfree(cfg->sections[i]->entries[j]->value);\n+\t\t\tfree(cfg->sections[i]->entries[j]);\n \t\t}\n+\t\tfree(cfg->sections[i]->entries);\n+\t\tfree(s);\n \t}\n+\n+\tfree(cfg->sections);\n \tfree(cfg);\n \n \treturn 0;\n@@ -455,7 +462,7 @@ int\n rte_cfgfile_num_sections(struct rte_cfgfile *cfg, const char *sectionname,\n size_t length)\n {\n-\tint i;\n+\tsize_t i;\n \tint num_sections = 0;\n \tfor (i = 0; i < cfg->num_sections; i++) {\n \t\tif (strncmp(cfg->sections[i]->name, sectionname, length) == 0)\n@@ -468,9 +475,9 @@ int\n rte_cfgfile_sections(struct rte_cfgfile *cfg, char *sections[],\n \tint max_sections)\n {\n-\tint i;\n+\tsize_t i;\n \n-\tfor (i = 0; i < cfg->num_sections && i < max_sections; i++)\n+\tfor (i = 0; i < cfg->num_sections && (int)i < max_sections; i++)\n \t\tsnprintf(sections[i], CFG_NAME_LEN, \"%s\",\n \t\tcfg->sections[i]->name);\n \n@@ -480,7 +487,7 @@ rte_cfgfile_sections(struct rte_cfgfile *cfg, char *sections[],\n static const struct rte_cfgfile_section *\n _get_section(struct rte_cfgfile *cfg, const char *sectionname)\n {\n-\tint i;\n+\tsize_t i;\n \tfor (i = 0; i < cfg->num_sections; i++) {\n \t\tif (strncmp(cfg->sections[i]->name, sectionname,\n \t\t\t\tsizeof(cfg->sections[0]->name)) == 0)\n@@ -510,11 +517,11 @@ int\n rte_cfgfile_section_entries(struct rte_cfgfile *cfg, const char *sectionname,\n \t\tstruct rte_cfgfile_entry *entries, int max_entries)\n {\n-\tint i;\n+\tsize_t i;\n \tconst struct rte_cfgfile_section *sect = _get_section(cfg, sectionname);\n \tif (sect == NULL)\n \t\treturn -1;\n-\tfor (i = 0; i < max_entries && i < sect->num_entries; i++)\n+\tfor (i = 0; (int)i < max_entries && i < sect->num_entries; i++)\n \t\tentries[i] = *sect->entries[i];\n \treturn i;\n }\n@@ -523,7 +530,7 @@ const char *\n rte_cfgfile_get_entry(struct rte_cfgfile *cfg, const char *sectionname,\n \t\tconst char *entryname)\n {\n-\tint i;\n+\tsize_t i;\n \tconst struct rte_cfgfile_section *sect = _get_section(cfg, sectionname);\n \tif (sect == NULL)\n \t\treturn NULL;\n", "prefixes": [ "dpdk-dev", "v2", "5/6" ] }{ "id": 5478, "url": "