# HG changeset patch # User jwe # Date 1035496185 0 # Node ID 0435429c1050f0631865b054243ab7a49d6827a7 # Parent da4c69a811378a41241128607a482948c5819dd5 [project @ 2002-10-24 21:49:45 by jwe] diff -r da4c69a81137 -r 0435429c1050 liboctave/ChangeLog --- a/liboctave/ChangeLog Thu Oct 24 15:24:00 2002 +0000 +++ b/liboctave/ChangeLog Thu Oct 24 21:49:45 2002 +0000 @@ -1,5 +1,8 @@ 2002-10-24 John W. Eaton + * lo-sstream.h: Undef HAVE_SSTREAM if using a version of g++ + earlier than 3.0. + * Makefile.in (LINK_DEPS): Include $(LIBKPATHSEA) here. (liboctave.$(SHLEXT)): Not here. diff -r da4c69a81137 -r 0435429c1050 liboctave/lo-sstream.h --- a/liboctave/lo-sstream.h Thu Oct 24 15:24:00 2002 +0000 +++ b/liboctave/lo-sstream.h Thu Oct 24 21:49:45 2002 +0000 @@ -23,6 +23,10 @@ #if !defined (octave_liboctave_sstream_h) #define octave_liboctave_sstream_h 1 +#if defined (__GNUG__) && __GNUC__ < 3 +#undef HAVE_SSTREAM +#endif + #ifdef HAVE_SSTREAM #include diff -r da4c69a81137 -r 0435429c1050 src/ChangeLog --- a/src/ChangeLog Thu Oct 24 15:24:00 2002 +0000 +++ b/src/ChangeLog Thu Oct 24 21:49:45 2002 +0000 @@ -1,5 +1,12 @@ 2002-10-24 John W. Eaton + * cutils.c (octave_vsnprintf): Buffer and buffer size now static. + * utils.cc (octave_vformat): Don't free buffer returned from + octave_vsnprintf here. + + * ov-usr-fcn.cc (va_arg, va_start, vr_val): Only print warning + once per session. + * ov-mapper.cc (octave_mapper::apply): Don't try real_type case if arg is a string and we have a ch_map_fcn. diff -r da4c69a81137 -r 0435429c1050 src/cutils.c --- a/src/cutils.c Thu Oct 24 15:24:00 2002 +0000 +++ b/src/cutils.c Thu Oct 24 21:49:45 2002 +0000 @@ -119,13 +119,19 @@ return strncasecmp (s1, s2, n); } +// We manage storage. User should not free it, and its contents are +// only valid until next call to vsnprintf. + char * octave_vsnprintf (const char *fmt, va_list args) { #if defined (HAVE_VSNPRINTF) - size_t size = 100; + static size_t size = 100; - char *buf = malloc (size); + static char *buf = 0; + + if (! buf) + buf = malloc (size); while (1) { diff -r da4c69a81137 -r 0435429c1050 src/ov-usr-fcn.cc --- a/src/ov-usr-fcn.cc Thu Oct 24 15:24:00 2002 +0000 +++ b/src/ov-usr-fcn.cc Thu Oct 24 21:49:45 2002 +0000 @@ -603,7 +603,13 @@ has not been declared to take a variable number of parameters.\n\ @end deftypefn") { - ::warning ("va_arg is deprecated; use varargin instead"); + static bool warned = false; + + if (! warned) + { + ::warning ("va_arg is deprecated; use varargin instead"); + warned = true; + } octave_value_list retval; @@ -639,7 +645,13 @@ that has not been declared to take a variable number of parameters.\n\ @end deftypefn") { - ::warning ("va_start is deprecated; use varargin instead"); + static bool warned = false; + + if (! warned) + { + ::warning ("va_start is deprecated; use varargin instead"); + warned = true; + } octave_value_list retval; @@ -677,7 +689,13 @@ been declared to return an unspecified number of output arguments.\n\ @end deftypefn") { - ::warning ("vr_val is deprecated; use varargout instead"); + static bool warned = false; + + if (! warned) + { + ::warning ("vr_val is deprecated; use varargout instead"); + warned = true; + } octave_value_list retval; diff -r da4c69a81137 -r 0435429c1050 src/utils.cc --- a/src/utils.cc Thu Oct 24 15:24:00 2002 +0000 +++ b/src/utils.cc Thu Oct 24 21:49:45 2002 +0000 @@ -717,19 +717,7 @@ #if defined (__GNUG__) && !CXX_ISO_COMPLIANT_LIBRARY - OSSTREAM buf; - - buf.vform (fmt, args); - - buf << OSSTREAM_ENDS; - - std::string s = OSSTREAM_STR (buf); - - OSSTREAM_FREEZE (buf); - - os << s; - - retval = s.length (); + os.vform (fmt, args); #else @@ -740,8 +728,6 @@ os << s; retval = strlen (s); - - free (s); } #endif