Fix MPFR Flog implementation
[sxemacs] / src / ent / ent-float.c
index a934ce5..96a2d9b 100644 (file)
@@ -26,7 +26,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 #include "lisp.h"
 #include "sysproc.h"    /* For qxe_getpid */
 
-#include "ent-float.h"
+#include "ent.h"
 
 \f
 Lisp_Object Vmost_positive_float;
@@ -41,19 +41,15 @@ Fixnum max_float_print_size = 0;
 
 \f
 static Lisp_Object
-mark_float(Lisp_Object obj)
+mark_float(Lisp_Object SXE_UNUSED(obj))
 {
        return Qnil;
-
-       if (obj);
 }
 
 static inline int
-float_equal(Lisp_Object obj1, Lisp_Object obj2, int depth)
+float_equal(Lisp_Object obj1, Lisp_Object obj2, int SXE_UNUSED(depth))
 {
        return (ent_float(obj1) == ent_float(obj2));
-
-       if (depth);
 }
 
 static inline unsigned long
@@ -82,7 +78,7 @@ print_float(Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
 {
        char pigbuf[350];       /* see comments in float_to_string */
 
-       float_to_string(pigbuf, XFLOAT_DATA(obj));
+       float_to_string(pigbuf, XFLOAT_DATA(obj), sizeof(pigbuf));
        write_c_string(pigbuf, printcharfun);
 }
 
@@ -188,15 +184,13 @@ ent_div_FLOAT_T_INT_T(Lisp_Object l, Lisp_Object r)
 }
 
 static inline Lisp_Object
-ent_rem_FLOAT_T(Lisp_Object l, Lisp_Object r)
+ent_rem_FLOAT_T(Lisp_Object SXE_UNUSED(l), Lisp_Object SXE_UNUSED(r))
 {
-       if (l);
        return make_float(0.0);
 }
 static inline Lisp_Object
-ent_rem_FLOAT_T_INT_T(Lisp_Object l, Lisp_Object r)
+ent_rem_FLOAT_T_INT_T(Lisp_Object SXE_UNUSED(l), Lisp_Object SXE_UNUSED(r))
 {
-       if (l);
        return make_float(0.0);
 }
 
@@ -585,12 +579,17 @@ The float closest in value to -infinity.
                                                                       */);
        Vmost_negative_float = make_float(fp);
 
+       {
+               char tmp[] = "1.0";
        /* let's compute the array we need to print such a float */
 #if fpfloat_double_p
-       max_float_print_size = snprintf(NULL, 0, "%f", fp) + 10;
+               max_float_print_size = snprintf(tmp, sizeof(tmp), "%f", fp);
 #elif fpfloat_long_double_p
-       max_float_print_size = snprintf(NULL, 0, "%Lf", fp) + 10;
+               max_float_print_size = snprintf(tmp, sizeof(tmp), "%Lf", fp);
 #endif
+       }
+       assert(max_float_print_size>0);
+       max_float_print_size += 10;
 
        DEFVAR_CONST_INT("max-float-print-size", &max_float_print_size /*
 The maximal string length of a printed float.