Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/606/?format=api
https://patches.dpdk.org/api/patches/606/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1411742384-29216-1-git-send-email-thomas.monjalon@6wind.com/", "project": { "id": 1, "url": "https://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": "<1411742384-29216-1-git-send-email-thomas.monjalon@6wind.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1411742384-29216-1-git-send-email-thomas.monjalon@6wind.com", "date": "2014-09-26T14:39:44", "name": "[dpdk-dev] eal: remove rte_snprintf", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "137901d0830b6e9d13ce30b22055b1a3293756d3", "submitter": { "id": 1, "url": "https://patches.dpdk.org/api/people/1/?format=api", "name": "Thomas Monjalon", "email": "thomas.monjalon@6wind.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1411742384-29216-1-git-send-email-thomas.monjalon@6wind.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/606/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/606/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 4C4517E44;\n\tFri, 26 Sep 2014 16:33:37 +0200 (CEST)", "from mail-wi0-f169.google.com (mail-wi0-f169.google.com\n\t[209.85.212.169]) by dpdk.org (Postfix) with ESMTP id 9E58C7E3B\n\tfor <dev@dpdk.org>; Fri, 26 Sep 2014 16:33:36 +0200 (CEST)", "by mail-wi0-f169.google.com with SMTP id hi2so1146303wib.2\n\tfor <dev@dpdk.org>; Fri, 26 Sep 2014 07:39:59 -0700 (PDT)", "from localhost.localdomain (136-92-190-109.dsl.ovh.fr.\n\t[109.190.92.136]) by mx.google.com with ESMTPSA id\n\tiy10sm2449126wic.5.2014.09.26.07.39.57 for <dev@dpdk.org>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tFri, 26 Sep 2014 07:39:58 -0700 (PDT)" ], "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:subject:date:message-id;\n\tbh=AK3KdvtKJ2xuvd8pxByfTi1UYP6FJEbbBzGHCdRbYR0=;\n\tb=dzGrNjBc37GUuwP+mkwkXlzLdyZdQML3at5pIqMbSVovLbqwtlQ29y4TZuhtTKeIlB\n\tzsIeOJiFzivdFDr7i1/rwEBfiLWPpgdYMjCEBnULQZrLhFQVyybNMvVPR6DlzPOgHz9d\n\tNsjokVk1HAMrduOM2TG/Vbg0ByKJZGRvNDFTg9Ee9GeOr6jBimCl3fO2Kh/vJ2XF6E1C\n\toXwQhijlVoDJn6/tXzePijioon+fMV6Je6M9B60ed0jC5PSEpHMLjlpq3MTlD2bD6fto\n\t5kehND6ga9rTx1HaV5t4Tolld3zlgPw/3bVYLyqgY1DQIe1ZdZhWOhl66LYdP726ejJX\n\tx4gg==", "X-Gm-Message-State": "ALoCoQkL7dzvM34z04U9j/Fst6rmdZQ15KMJd7y0Jj9cLSAr2Nkjk/lWzBq7vMdc41pJy4RZvWq5", "X-Received": "by 10.180.38.114 with SMTP id f18mr27299194wik.24.1411742399156; \n\tFri, 26 Sep 2014 07:39:59 -0700 (PDT)", "From": "Thomas Monjalon <thomas.monjalon@6wind.com>", "To": "dev@dpdk.org", "Date": "Fri, 26 Sep 2014 16:39:44 +0200", "Message-Id": "<1411742384-29216-1-git-send-email-thomas.monjalon@6wind.com>", "X-Mailer": "git-send-email 2.0.4", "Subject": "[dpdk-dev] [PATCH] eal: remove rte_snprintf", "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": "The function rte_snprintf() was deprecated in version 1.7.0\n(commit 6f41fe75e2dd).\nIt's now totally removed.\n\nSigned-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>\n---\n app/test/Makefile | 7 --\n app/test/test_string_fns.c | 136 +------------------------\n lib/librte_eal/common/eal_common_string_fns.c | 28 -----\n lib/librte_eal/common/include/rte_string_fns.h | 24 -----\n lib/librte_eal/common/include/rte_warnings.h | 4 -\n 5 files changed, 1 insertion(+), 198 deletions(-)", "diff": "diff --git a/app/test/Makefile b/app/test/Makefile\nindex 210a7f6..822bbd4 100644\n--- a/app/test/Makefile\n+++ b/app/test/Makefile\n@@ -133,13 +133,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c\n CFLAGS += -O3\n CFLAGS += $(WERROR_FLAGS)\n \n-# Allow use of deprecated rte_snprintf in test_string_fns.c\n-ifeq ($(CC), icc)\n-CFLAGS_test_string_fns.o += -Wd1478\n-else\n-CFLAGS_test_string_fns.o += -Wno-deprecated-declarations\n-endif\n-\n # Disable warnings of deprecated-declarations in test_kni.c\n ifeq ($(CC), icc)\n CFLAGS_test_kni.o += -wd1478\ndiff --git a/app/test/test_string_fns.c b/app/test/test_string_fns.c\nindex 29bfe5b..39e6a9d 100644\n--- a/app/test/test_string_fns.c\n+++ b/app/test/test_string_fns.c\n@@ -49,139 +49,6 @@\n #define DATA_BYTE 'a'\n \n static int\n-test_rte_snprintf(void)\n-{\n-\t/* =================================================\n-\t * First test with a string that will fit in buffer\n-\t * =================================================*/\n-\tdo {\n-\t\tint retval;\n-\t\tconst char source[] = \"This is a string that will fit in buffer\";\n-\t\tchar buf[sizeof(source)+2]; /* make buffer big enough to fit string */\n-\n-\t\t/* initialise buffer with characters so it can contain no nulls */\n-\t\tmemset(buf, DATA_BYTE, sizeof(buf));\n-\n-\t\t/* run rte_snprintf and check results */\n-\t\tretval = rte_snprintf(buf, sizeof(buf), \"%s\", source);\n-\t\tif (retval != sizeof(source) - 1) {\n-\t\t\tLOG(\"Error, retval = %d, expected = %u\\n\",\n-\t\t\t\t\tretval, (unsigned)sizeof(source));\n-\t\t\treturn -1;\n-\t\t}\n-\t\tif (buf[retval] != '\\0') {\n-\t\t\tLOG(\"Error, resultant is not null-terminated\\n\");\n-\t\t\treturn -1;\n-\t\t}\n-\t\tif (memcmp(source, buf, sizeof(source)-1) != 0){\n-\t\t\tLOG(\"Error, corrupt data in buffer\\n\");\n-\t\t\treturn -1;\n-\t\t}\n-\t} while (0);\n-\n-\tdo {\n-\t\t/* =================================================\n-\t\t * Test with a string that will get truncated\n-\t\t * =================================================*/\n-\t\tint retval;\n-\t\tconst char source[] = \"This is a long string that won't fit in buffer\";\n-\t\tchar buf[sizeof(source)/2]; /* make buffer half the size */\n-\n-\t\t/* initialise buffer with characters so it can contain no nulls */\n-\t\tmemset(buf, DATA_BYTE, sizeof(buf));\n-\n-\t\t/* run rte_snprintf and check results */\n-\t\tretval = rte_snprintf(buf, sizeof(buf), \"%s\", source);\n-\t\tif (retval != sizeof(source) - 1) {\n-\t\t\tLOG(\"Error, retval = %d, expected = %u\\n\",\n-\t\t\t\t\tretval, (unsigned)sizeof(source));\n-\t\t\treturn -1;\n-\t\t}\n-\t\tif (buf[sizeof(buf)-1] != '\\0') {\n-\t\t\tLOG(\"Error, buffer is not null-terminated\\n\");\n-\t\t\treturn -1;\n-\t\t}\n-\t\tif (memcmp(source, buf, sizeof(buf)-1) != 0){\n-\t\t\tLOG(\"Error, corrupt data in buffer\\n\");\n-\t\t\treturn -1;\n-\t\t}\n-\t} while (0);\n-\n-\tdo {\n-\t\t/* ===========================================================\n-\t\t * Test using zero-size buf to check how long a buffer we need\n-\t\t * ===========================================================*/\n-\t\tint retval;\n-\t\tconst char source[] = \"This is a string\";\n-\t\tchar buf[10];\n-\n-\t\t/* call with a zero-sized non-NULL buffer, should tell how big a buffer\n-\t\t * we need */\n-\t\tretval = rte_snprintf(buf, 0, \"%s\", source);\n-\t\tif (retval != sizeof(source) - 1) {\n-\t\t\tLOG(\"Call with 0-length buffer does not return correct size.\"\n-\t\t\t\t\t\"Expected: %zu, got: %d\\n\", sizeof(source), retval);\n-\t\t\treturn -1;\n-\t\t}\n-\n-\t\t/* call with a zero-sized NULL buffer, should tell how big a buffer\n-\t\t * we need */\n-\t\tretval = rte_snprintf(NULL, 0, \"%s\", source);\n-\t\tif (retval != sizeof(source) - 1) {\n-\t\t\tLOG(\"Call with 0-length buffer does not return correct size.\"\n-\t\t\t\t\t\"Expected: %zu, got: %d\\n\", sizeof(source), retval);\n-\t\t\treturn -1;\n-\t\t}\n-\n-\t} while (0);\n-\n-\tdo {\n-\t\t/* =================================================\n-\t\t * Test with invalid parameter values\n-\t\t * =================================================*/\n-\t\tconst char source[] = \"This is a string\";\n-\t\tchar buf[10];\n-\n-\t\t/* call with buffer value set to NULL is EINVAL */\n-\t\tif (rte_snprintf(NULL, sizeof(buf), \"%s\\n\", source) != -1 ||\n-\t\t\t\terrno != EINVAL) {\n-\t\t\tLOG(\"Failed to get suitable error when passing NULL buffer\\n\");\n-\t\t\treturn -1;\n-\t\t}\n-\n-\t\tmemset(buf, DATA_BYTE, sizeof(buf));\n-\t\t/* call with a NULL format and zero-size should return error\n-\t\t * without affecting the buffer */\n-\t\tif (rte_snprintf(buf, 0, NULL) != -1 ||\n-\t\t\t\terrno != EINVAL) {\n-\t\t\tLOG(\"Failed to get suitable error when passing NULL buffer\\n\");\n-\t\t\treturn -1;\n-\t\t}\n-\t\tif (buf[0] != DATA_BYTE) {\n-\t\t\tLOG(\"Error, zero-length buffer modified after call with NULL\"\n-\t\t\t\t\t\" format string\\n\");\n-\t\t\treturn -1;\n-\t\t}\n-\n-\t\t/* call with a NULL format should return error but also null-terminate\n-\t\t * the buffer */\n-\t\tif (rte_snprintf(buf, sizeof(buf), NULL) != -1 ||\n-\t\t\t\terrno != EINVAL) {\n-\t\t\tLOG(\"Failed to get suitable error when passing NULL buffer\\n\");\n-\t\t\treturn -1;\n-\t\t}\n-\t\tif (buf[0] != '\\0') {\n-\t\t\tLOG(\"Error, buffer not null-terminated after call with NULL\"\n-\t\t\t\t\t\" format string\\n\");\n-\t\t\treturn -1;\n-\t\t}\n-\t} while (0);\n-\n-\tLOG(\"%s - PASSED\\n\", __func__);\n-\treturn 0;\n-}\n-\n-static int\n test_rte_strsplit(void)\n {\n \tint i;\n@@ -294,8 +161,7 @@ test_rte_strsplit(void)\n static int\n test_string_fns(void)\n {\n-\tif (test_rte_snprintf() < 0 ||\n-\t\t\ttest_rte_strsplit() < 0)\n+\tif (test_rte_strsplit() < 0)\n \t\treturn -1;\n \treturn 0;\n }\ndiff --git a/lib/librte_eal/common/eal_common_string_fns.c b/lib/librte_eal/common/eal_common_string_fns.c\nindex fb0bbe8..125a3e2 100644\n--- a/lib/librte_eal/common/eal_common_string_fns.c\n+++ b/lib/librte_eal/common/eal_common_string_fns.c\n@@ -38,34 +38,6 @@\n \n #include <rte_string_fns.h>\n \n-/* safe version os snprintf */\n-int\n-rte_snprintf(char *buffer, int buflen, const char *format, ...)\n-{\n-\tint len;\n-\tva_list ap;\n-\n-\tif (buffer == NULL && buflen != 0)\n-\t\tgoto einval_error;\n-\tif (format == NULL) {\n-\t\tif (buflen > 0)\n-\t\t\tbuffer[0] = '\\0';\n-\t\tgoto einval_error;\n-\t}\n-\n-\tva_start(ap, format);\n-\tlen = vsnprintf(buffer, buflen, format, ap);\n-\tva_end(ap);\n-\tif (len >= buflen && buflen > 0)\n-\t\tbuffer[buflen - 1] = '\\0';\n-\n-\treturn len;\n-\n-einval_error:\n-\terrno = EINVAL;\n-\treturn -1;\n-}\n-\n /* split string into tokens */\n int\n rte_strsplit(char *string, int stringlen,\ndiff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h\nindex cf96b2c..cfca2f8 100644\n--- a/lib/librte_eal/common/include/rte_string_fns.h\n+++ b/lib/librte_eal/common/include/rte_string_fns.h\n@@ -45,30 +45,6 @@ extern \"C\" {\n #endif\n \n /**\n- * This functio is deprecated and just for backward compatibility.\n- * It is just an alternate version of snprintf.\n- *\n- * @param buffer\n- * The buffer into which the output is to be written\n- *\n- * @param buflen\n- * The size of the output buffer\n- *\n- * @param format\n- * The format string to be printed to the buffer\n- *\n- * @return\n- * The number of characters written to the buffer, or if the string has been\n- * truncated, the number of characters which would have been written had the\n- * buffer been sufficiently big.\n- *\n- */\n-int\n-rte_snprintf(char *buffer, int buflen, const char *format, ...)\n-\t__attribute__((format(printf,3,4)))\n-\t__attribute__((deprecated));\n-\n-/**\n * Takes string \"string\" parameter and splits it at character \"delim\"\n * up to maxtokens-1 times - to give \"maxtokens\" resulting tokens. Like\n * strtok or strsep functions, this modifies its input string, by replacing\ndiff --git a/lib/librte_eal/common/include/rte_warnings.h b/lib/librte_eal/common/include/rte_warnings.h\nindex 423e6fb..da80877 100644\n--- a/lib/librte_eal/common/include/rte_warnings.h\n+++ b/lib/librte_eal/common/include/rte_warnings.h\n@@ -54,10 +54,6 @@\n #include <dirent.h>\n #endif\n \n-/* rte_snprintf uses snprintf, so include its definition before we poison the\n- * functions, otherwise we'll get an error in it. */\n-#include <rte_string_fns.h>\n-\n /* the following function are deemed not fully secure for use e.g. they\n * do not always null-terminate arguments */\n #pragma GCC poison sprintf strtok snprintf vsnprintf\n", "prefixes": [ "dpdk-dev" ] }{ "id": 606, "url": "