git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Prepare for post-2.2.0 (2.2.90).
[sliver-openvswitch.git]
/
lib
/
table.c
diff --git
a/lib/table.c
b/lib/table.c
index
8141677
..
4628170
100644
(file)
--- a/
lib/table.c
+++ b/
lib/table.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 2009, 2010, 2011, 2012
Nicira Networks
.
+ * Copyright (c) 2009, 2010, 2011, 2012
, 2013 Nicira, Inc
.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-18,8
+18,6
@@
#include "table.h"
#include "table.h"
-#include <assert.h>
-
#include "dynamic-string.h"
#include "json.h"
#include "ovsdb-data.h"
#include "dynamic-string.h"
#include "json.h"
#include "ovsdb-data.h"
@@
-143,7
+141,7
@@
table_add_column(struct table *table, const char *heading, ...)
struct column *column;
va_list args;
struct column *column;
va_list args;
- assert(!table->n_rows);
+
ovs_
assert(!table->n_rows);
if (table->n_columns >= table->allocated_columns) {
table->columns = x2nrealloc(table->columns, &table->allocated_columns,
sizeof *table->columns);
if (table->n_columns >= table->allocated_columns) {
table->columns = x2nrealloc(table->columns, &table->allocated_columns,
sizeof *table->columns);
@@
-204,8
+202,8
@@
table_add_cell(struct table *table)
{
size_t x, y;
{
size_t x, y;
- assert(table->n_rows > 0);
- assert(table->current_column < table->n_columns);
+
ovs_
assert(table->n_rows > 0);
+
ovs_
assert(table->current_column < table->n_columns);
x = table->current_column++;
y = table->n_rows - 1;
x = table->current_column++;
y = table->n_rows - 1;
@@
-220,21
+218,19
@@
table_print_table_line__(struct ds *line)
ds_clear(line);
}
ds_clear(line);
}
-static
void
-table_format_timestamp__(
char *s, size_t size
)
+static
char *
+table_format_timestamp__(
void
)
{
{
- time_t now = time_wall();
- strftime(s, size, "%Y-%m-%d %H:%M:%S", localtime(&now));
+ return xastrftime_msec("%Y-%m-%d %H:%M:%S.###", time_wall_msec(), true);
}
static void
table_print_timestamp__(const struct table *table)
{
if (table->timestamp) {
}
static void
table_print_timestamp__(const struct table *table)
{
if (table->timestamp) {
- char s[32];
-
- table_format_timestamp__(s, sizeof s);
+ char *s = table_format_timestamp__();
puts(s);
puts(s);
+ free(s);
}
}
}
}
@@
-501,10
+497,9
@@
table_print_json__(const struct table *table, const struct table_style *style)
json_object_put_string(json, "caption", table->caption);
}
if (table->timestamp) {
json_object_put_string(json, "caption", table->caption);
}
if (table->timestamp) {
- char s[32];
-
- table_format_timestamp__(s, sizeof s);
+ char *s = table_format_timestamp__();
json_object_put_string(json, "time", s);
json_object_put_string(json, "time", s);
+ free(s);
}
headings = json_array_create_empty();
}
headings = json_array_create_empty();