Skip to contentSkip to conversation

eal: remove rte_snprintf

PATCH In review Thomas Monjalon 2 participants 3 messages Sep 26, 2014 – Sep 29, 2014 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal: remove rte_snprintf

The function rte_snprintf() was deprecated in version 1.7.0 (commit 6f41fe75e2dd).
It's now totally removed.

---
 app/test/Makefile                              |   7 --
 app/test/test_string_fns.c                     | 136 +------------------------
 lib/librte_eal/common/eal_common_string_fns.c  |  28 -----
 lib/librte_eal/common/include/rte_string_fns.h |  24 -----
 lib/librte_eal/common/include/rte_warnings.h   |   4 -
 5 files changed, 1 insertion(+), 198 deletions(-)
app/test/Makefile +0 -7
index 210a7f6..822bbd4 100644
@@ -133,13 +133,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
-# Allow use of deprecated rte_snprintf in test_string_fns.c
-ifeq ($(CC), icc)
-CFLAGS_test_string_fns.o += -Wd1478
-else
-CFLAGS_test_string_fns.o += -Wno-deprecated-declarations
-endif
-
 # Disable warnings of deprecated-declarations in test_kni.c
 ifeq ($(CC), icc)
 CFLAGS_test_kni.o += -wd1478
app/test/test_string_fns.c +1 -135

148 lines not on this page · raw message

lib/librte_eal/common/eal_common_string_fns.c +0 -28
index fb0bbe8..125a3e2 100644
@@ -38,34 +38,6 @@
 
 #include <rte_string_fns.h>
 
-/* safe version os snprintf */
-int
-rte_snprintf(char *buffer, int buflen, const char *format, ...)
-{
-	int len;
-	va_list ap;
-
-	if (buffer == NULL && buflen != 0)
-		goto einval_error;
-	if (format == NULL) {
-		if (buflen > 0)
-			buffer[0] = '\0';
-		goto einval_error;
-	}
-
-	va_start(ap, format);
-	len = vsnprintf(buffer, buflen, format, ap);
-	va_end(ap);
-	if (len >= buflen && buflen > 0)
-		buffer[buflen - 1] = '\0';
-
-	return len;
-
-einval_error:
-	errno = EINVAL;
-	return -1;
-}
-
 /* split string into tokens */
 int
 rte_strsplit(char *string, int stringlen,
lib/librte_eal/common/include/rte_string_fns.h +0 -24
index cf96b2c..cfca2f8 100644
@@ -45,30 +45,6 @@ extern "C" {
 #endif
 
 /**
- * This functio is deprecated and just for backward compatibility.
- * It is just an alternate version of snprintf.
- *
- * @param buffer
- *   The buffer into which the output is to be written
- *
- * @param buflen
- *   The size of the output buffer
- *
- * @param format
- *   The format string to be printed to the buffer
- *
- * @return
- *   The number of characters written to the buffer, or if the string has been
- *   truncated, the number of characters which would have been written had the
- *   buffer been sufficiently big.
- *
- */
-int
-rte_snprintf(char *buffer, int buflen, const char *format, ...)
-	__attribute__((format(printf,3,4)))
-	__attribute__((deprecated));
-
-/**
  * Takes string "string" parameter and splits it at character "delim"
  * up to maxtokens-1 times - to give "maxtokens" resulting tokens. Like
  * strtok or strsep functions, this modifies its input string, by replacing
lib/librte_eal/common/include/rte_warnings.h +0 -4
index 423e6fb..da80877 100644
@@ -54,10 +54,6 @@
 #include <dirent.h>
 #endif
 
-/* rte_snprintf uses snprintf, so include its definition before we poison the
- * functions, otherwise we'll get an error in it. */
-#include <rte_string_fns.h>
-
 /* the following function are deemed not fully secure for use e.g. they
  * do not always null-terminate arguments */
 #pragma GCC poison sprintf strtok snprintf vsnprintf
Signature · 1 line
2.0.4

A message that is not in the archive (sent off-list or not yet received): 1411742384-29216-1-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org

A message that is not in the archive (sent off-list or not yet received): 20140926151448.GC5619-B26myB8xz7F8NnZeBjwnZQMhkBWG/[email protected]