X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Futil.c;h=e8f3adb78a22b23094e4d26561bacbb38c948fcf;hb=0cc96e48ab2fc573c3b7b69fe5a034bb29dde578;hp=19f13dddc1f3f902b9964354e49381cd2221b8ef;hpb=a0bc29a541fc7dc6e20137d5558e2094d614e6ab;p=openvswitch diff --git a/lib/util.c b/lib/util.c index 19f13ddd..e8f3adb7 100644 --- a/lib/util.c +++ b/lib/util.c @@ -23,20 +23,20 @@ #include #include #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); @@ -53,7 +53,7 @@ xzalloc(size_t size) } void * -xmalloc(size_t size) +xmalloc(size_t size) { void *p = malloc(size ? size : 1); COVERAGE_INC(util_xalloc); @@ -64,7 +64,7 @@ xmalloc(size_t size) } void * -xrealloc(void *p, size_t size) +xrealloc(void *p, size_t size) { p = realloc(p, size ? size : 1); COVERAGE_INC(util_xalloc); @@ -92,7 +92,7 @@ xmemdup0(const char *p_, size_t length) } char * -xstrdup(const char *s) +xstrdup(const char *s) { return xmemdup0(s, strlen(s)); } @@ -156,7 +156,8 @@ ovs_fatal(int err_no, const char *format, ...) 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); @@ -191,7 +192,7 @@ void set_program_name(const char *argv0) /* 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); @@ -447,7 +448,7 @@ abs_file_name(const char *dir, const char *file_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) { }