#include <vppinfra/error.h>
#include <vppinfra/string.h>
#include <vppinfra/os.h> /* os_puts */
+#include <vppinfra/math.h>
typedef struct
{
if (n_left > 0)
{
vec_insert (s, n_left, i0);
- memset (s + i0, fi->pad_char, n_left);
+ clib_memset (s + i0, fi->pad_char, n_left);
l1 = vec_len (s);
}
if (n_right > 0)
{
vec_resize (s, n_right);
- memset (s + l1, fi->pad_char, n_right);
+ clib_memset (s + l1, fi->pad_char, n_right);
}
}
return s;
if (f > g)
vec_add (s, g, f - g);
+#ifdef __COVERITY__
+ if (s == 0)
+ return (u8 *) "liar liar pants on fire s can't be zero!";
+#endif
+
return s;
}
va_start (va, fmt);
s = va_format (s, fmt, &va);
va_end (va);
+#ifdef __COVERITY__
+ if (s == 0)
+ return (u8 *) "liar liar pants on fire s can't be zero!";
+#endif
return s;
}
}
#ifdef CLIB_UNIX
+void
+fformat_append_cr (FILE * ofp, const char *fmt, ...)
+{
+ va_list va;
+
+ va_start (va, fmt);
+ (void) va_fformat (ofp, (char *) fmt, &va);
+ va_end (va);
+ fformat (ofp, "\n");
+}
+
word
fdformat (int fd, char *fmt, ...)
{
sign = 1;
}
+ /* Check for not-a-number. */
+ if (isnan (x))
+ return format (s, "%cNaN", sign ? '-' : '+');
+
/* Check for infinity. */
- if (x == x / 2)
+ if (isinf (x))
return format (s, "%cinfinity", sign ? '-' : '+');
x = normalize (x, &expon, &prec);