#include <string.h>
#include <unistd.h>
#include "coverage.h"
-
-#define THIS_MODULE VLM_util
#include "vlog.h"
+VLOG_DEFINE_THIS_MODULE(util)
+
const char *program_name;
void
-out_of_memory(void)
+out_of_memory(void)
{
ovs_fatal(0, "virtual memory exhausted");
}
void *
-xcalloc(size_t count, size_t size)
+xcalloc(size_t count, size_t size)
{
void *p = count && size ? calloc(count, size) : malloc(1);
COVERAGE_INC(util_xalloc);
}
void *
-xmalloc(size_t size)
+xmalloc(size_t size)
{
void *p = malloc(size ? size : 1);
COVERAGE_INC(util_xalloc);
}
void *
-xrealloc(void *p, size_t size)
+xrealloc(void *p, size_t size)
{
p = realloc(p, size ? size : 1);
COVERAGE_INC(util_xalloc);
}
char *
-xstrdup(const char *s)
+xstrdup(const char *s)
{
return xmemdup0(s, strlen(s));
}
vfprintf(stderr, format, args);
va_end(args);
if (err_no != 0)
- fprintf(stderr, " (%s)", strerror(err_no));
+ fprintf(stderr, " (%s)",
+ err_no == EOF ? "end of file" : strerror(err_no));
putc('\n', stderr);
exit(EXIT_FAILURE);
/* Print the version information for the program. */
void
-ovs_print_version(char *date, char *time,
+ovs_print_version(char *date, char *time,
uint8_t min_ofp, uint8_t max_ofp)
{
printf("%s (Open vSwitch) "VERSION BUILDNR"\n", program_name);
/* Pass a value to this function if it is marked with
- * __attribute__((warn_unused_result)) and you genuinely want to ignore
- * its return value. (Note that every scalar type can be implicitly
+ * __attribute__((warn_unused_result)) and you genuinely want to ignore
+ * its return value. (Note that every scalar type can be implicitly
* converted to bool.) */
void ignore(bool x OVS_UNUSED) { }