]> git.lyx.org Git - features.git/commitdiff
remove fmt.C
authorJohn Levon <levon@movementarian.org>
Tue, 20 Aug 2002 16:43:51 +0000 (16:43 +0000)
committerJohn Levon <levon@movementarian.org>
Tue, 20 Aug 2002 16:43:51 +0000 (16:43 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5037 a592a061-630c-0410-9148-cb99ea01b6c8

src/support/ChangeLog
src/support/Makefile.am
src/support/fmt.C [deleted file]

index 8f1fd1733a707f4c3659c226ecbc2080e5c56ba4..bac8b9e771539ed9dbf34284c9e00228c38eed85 100644 (file)
@@ -1,3 +1,8 @@
+2002-08-20  John Levon  <levon@movementarian.org>
+
+       * Makefile.am:
+       * fmt.C: remove
 2002-08-14  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * textutils.h: formatting.
index 0f975f6bdb751219df84de49c54c915ff6d67bce..b392fe740274fd96017da677678fd7e94ed74693 100644 (file)
@@ -30,7 +30,6 @@ libsupport_la_SOURCES = \
        copy.C \
        filetools.C \
        filetools.h \
-       fmt.C \
        forkedcall.C \
        forkedcall.h \
        forkedcontr.C \
diff --git a/src/support/fmt.C b/src/support/fmt.C
deleted file mode 100644 (file)
index 1e61e3b..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <config.h>
-#include <cstdio>
-#include <cstdarg>
-
-#ifndef HAVE_DECL_VSNPRINTF
-#include "support/snprintf.h"
-#endif
-
-#include "LString.h"
-
-#ifndef CXX_GLOBAL_CSTD
-using std::va_list;
-#endif
-
-/* This output manipulator gives the option to use Old style format
-   specifications in ostreams. Note that this is done at the expense
-   of typesafety, so if possible this manipulator should be avoided.
-   When is it allowed to use this manipulator? I wrote it to be used
-   i18n strings and gettext, and it should only(?) be used in that
-   context.
-
-   Ad. the implementation. I have only tested this on egcs-2.91.66 with
-   glibc 2.1.2. So further testing is needed. The loop in fmt(...) will
-   usually spin one or two times, but might spin more times with older
-   glibc libraries, since the returned -1 when size is too small. Newer
-   glibc returns the needed size.
-   One problem can be that vsnprintf is not implemented on all archs,
-   but AFAIK it is part of the new ANSI C standard.
-
-   Lgb
-*/
-
-string fmt(char const * fmtstr ...)
-{
-       int size = 80;
-       char * str = new char[size];
-       va_list ap;
-       while (true) {
-               va_start(ap, fmtstr);
-               int const r = vsnprintf(str, size, fmtstr, ap);
-               va_end(ap);
-               if (r == -1) { // size is too small
-                       delete [] str;
-                       size *= 2; // seems quite safe to double.
-                       str = new char[size];
-               } else if (r >= size) { // r gives the needed size
-                       delete [] str;
-                       size += r;
-                       str = new char[size];
-               } else {
-                       break;
-               }
-       }
-       string res(str);
-       delete [] str;
-       return res;
-}