]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Remove unused dyn_sprintf
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Fri, 5 Aug 2011 22:49:30 +0000 (15:49 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Fri, 5 Aug 2011 22:49:30 +0000 (15:49 -0700)
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
src/Makefile.am
src/common/config.cc
src/common/dyn_snprintf.c [deleted file]
src/common/dyn_snprintf.h [deleted file]

index aa56950a0570b3dc5de1f10aebabf340ef1f3c70..e45c4b4d1d2792771c7c4309e44dfa33f42682c8 100644 (file)
@@ -746,7 +746,6 @@ libcommon_files = \
        common/environment.cc\
        common/sctp_crc32.c\
        common/assert.cc \
-       common/dyn_snprintf.c \
         common/run_cmd.cc \
        common/WorkQueue.cc \
        common/ConfUtils.cc \
@@ -962,7 +961,6 @@ noinst_HEADERS = \
         common/signal.h\
         global/signal_handler.h\
         common/simple_spin.h\
-        common/dyn_snprintf.h\
         common/run_cmd.h\
        common/safe_io.h\
         common/config.h\
index 46532912e987303879b03472a5d7a688fb430314..9dc56268bcf70d943ac7f05082ace562b67277e7 100644 (file)
@@ -17,7 +17,6 @@
 #include "common/ceph_argparse.h"
 #include "common/common_init.h"
 #include "common/config.h"
-#include "common/dyn_snprintf.h"
 #include "common/static_assert.h"
 #include "common/strtol.h"
 #include "common/version.h"
diff --git a/src/common/dyn_snprintf.c b/src/common/dyn_snprintf.c
deleted file mode 100644 (file)
index be03ae5..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define  MAXARGS     32
-
-
-#define CALL_SNPRINTF(buf, size, format, args) snprintf(buf, size, format, args[0], args[1], args[2], args[3], \
-                               args[4], args[5], args[6], args[7],     \
-                               args[8], args[9], args[10], args[11],   \
-                               args[12], args[13], args[14], args[15], \
-                               args[16], args[17], args[18], args[19], \
-                               args[20], args[21], args[22], args[23], \
-                               args[24], args[25], args[26], args[27], \
-                               args[28], args[29], args[30], args[31])
-
-int dyn_snprintf(char **pbuf, size_t *pmax_size, int nargs, const char *format, ...)
-{
-       int ret;
-       va_list vl;
-       char *old_buf = *pbuf;
-       char *args[MAXARGS];
-       char *arg;
-       char *tmp_src = NULL;
-       int i;
-
-       if (nargs > MAXARGS)
-               return -1;
-
-       va_start(vl, format);
-       arg = va_arg(vl, char *);
-       for (i = 0; i<nargs; i++) {
-               if (arg == old_buf) {
-                       if (!tmp_src) {
-                               tmp_src = strdup(old_buf);
-                       }
-                       arg = tmp_src;
-               }
-               args[i] = arg;
-               arg = va_arg(vl, char *);
-       }
-       va_end(vl);
-       ret = CALL_SNPRINTF(*pbuf, *pmax_size, format, args);
-
-       if (ret >= (int)*pmax_size) {
-               *pmax_size = ret * 2;
-               *pbuf = (char *)realloc(*pbuf, *pmax_size);
-               ret = CALL_SNPRINTF(*pbuf, *pmax_size, format, args);
-       }
-
-       return ret;
-}
-
diff --git a/src/common/dyn_snprintf.h b/src/common/dyn_snprintf.h
deleted file mode 100644 (file)
index 09eb1a2..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef CEPH_DYN_SNPRINTF_H
-#define CEPH_DYN_SNPRINTF_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int dyn_snprintf(char **pbuf, size_t *pmax_size, int nargs, const char *format, ...);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif