Compare commits

..

3 Commits

Author SHA1 Message Date
Haochen Tong 47cc458e97 analyze: fix table time output 2020-03-09 14:58:25 +01:00
Denis Pronin 36e0d89a88 Support compiling with clang and gnu11 standard
Signed-off-by: Denis Pronin <dannftk@yandex.ru>
2020-03-09 14:55:21 +01:00
Florian Klink f14266c843 meson.build: drop unused SYSTEMD_SLEEP_BINARY_PATH
seems usage was dropped in ddcbc87378.
2020-03-09 14:52:30 +01:00
3 changed files with 34 additions and 22 deletions

View File

@ -214,7 +214,6 @@ conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlib
conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs')) conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs'))
conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs')) conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs'))
conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown')) conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl')) conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent')) conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge')) conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))

View File

@ -1114,7 +1114,7 @@ static int analyze_blame(int argc, char *argv[], void *userdata) {
continue; continue;
r = table_add_many(table, r = table_add_many(table,
TABLE_TIMESPAN_MSEC, &u->time, TABLE_TIMESPAN_MSEC, u->time,
TABLE_STRING, u->name); TABLE_STRING, u->name);
if (r < 0) if (r < 0)
return table_log_add_error(r); return table_log_add_error(r);
@ -1862,9 +1862,9 @@ static int dump_timespan(int argc, char *argv[], void *userdata) {
return table_log_add_error(r); return table_log_add_error(r);
r = table_add_many(table, r = table_add_many(table,
TABLE_UINT64, &output_usecs, TABLE_UINT64, output_usecs,
TABLE_STRING, "Human:", TABLE_STRING, "Human:",
TABLE_TIMESPAN, &output_usecs, TABLE_TIMESPAN, output_usecs,
TABLE_SET_COLOR, ansi_highlight()); TABLE_SET_COLOR, ansi_highlight());
if (r < 0) if (r < 0)
return table_log_add_error(r); return table_log_add_error(r);
@ -1917,7 +1917,7 @@ static int test_timestamp_one(const char *p) {
TABLE_STRING, "Original form:", TABLE_STRING, "Original form:",
TABLE_STRING, p, TABLE_STRING, p,
TABLE_STRING, "Normalized form:", TABLE_STRING, "Normalized form:",
TABLE_TIMESTAMP, &usec, TABLE_TIMESTAMP, usec,
TABLE_SET_COLOR, ansi_highlight_blue()); TABLE_SET_COLOR, ansi_highlight_blue());
if (r < 0) if (r < 0)
return table_log_add_error(r); return table_log_add_error(r);
@ -1925,7 +1925,7 @@ static int test_timestamp_one(const char *p) {
if (!in_utc_timezone()) { if (!in_utc_timezone()) {
r = table_add_many(table, r = table_add_many(table,
TABLE_STRING, "(in UTC):", TABLE_STRING, "(in UTC):",
TABLE_TIMESTAMP_UTC, &usec); TABLE_TIMESTAMP_UTC, usec);
if (r < 0) if (r < 0)
return table_log_add_error(r); return table_log_add_error(r);
} }
@ -1946,7 +1946,7 @@ static int test_timestamp_one(const char *p) {
r = table_add_many(table, r = table_add_many(table,
TABLE_STRING, "From now:", TABLE_STRING, "From now:",
TABLE_TIMESTAMP_RELATIVE, &usec); TABLE_TIMESTAMP_RELATIVE, usec);
if (r < 0) if (r < 0)
return table_log_add_error(r); return table_log_add_error(r);
@ -2042,7 +2042,7 @@ static int test_calendar_one(usec_t n, const char *p) {
if (i == 0) { if (i == 0) {
r = table_add_many(table, r = table_add_many(table,
TABLE_STRING, "Next elapse:", TABLE_STRING, "Next elapse:",
TABLE_TIMESTAMP, &next, TABLE_TIMESTAMP, next,
TABLE_SET_COLOR, ansi_highlight_blue()); TABLE_SET_COLOR, ansi_highlight_blue());
if (r < 0) if (r < 0)
return table_log_add_error(r); return table_log_add_error(r);
@ -2059,7 +2059,7 @@ static int test_calendar_one(usec_t n, const char *p) {
return table_log_add_error(r); return table_log_add_error(r);
r = table_add_many(table, r = table_add_many(table,
TABLE_TIMESTAMP, &next, TABLE_TIMESTAMP, next,
TABLE_SET_COLOR, ansi_highlight_blue()); TABLE_SET_COLOR, ansi_highlight_blue());
if (r < 0) if (r < 0)
return table_log_add_error(r); return table_log_add_error(r);
@ -2068,14 +2068,14 @@ static int test_calendar_one(usec_t n, const char *p) {
if (!in_utc_timezone()) { if (!in_utc_timezone()) {
r = table_add_many(table, r = table_add_many(table,
TABLE_STRING, "(in UTC):", TABLE_STRING, "(in UTC):",
TABLE_TIMESTAMP_UTC, &next); TABLE_TIMESTAMP_UTC, next);
if (r < 0) if (r < 0)
return table_log_add_error(r); return table_log_add_error(r);
} }
r = table_add_many(table, r = table_add_many(table,
TABLE_STRING, "From now:", TABLE_STRING, "From now:",
TABLE_TIMESTAMP_RELATIVE, &next); TABLE_TIMESTAMP_RELATIVE, next);
if (r < 0) if (r < 0)
return table_log_add_error(r); return table_log_add_error(r);

View File

@ -26,21 +26,34 @@ assert_cc(sizeof(JsonValue) == 16U);
/* We use fake JsonVariant objects for some special values, in order to avoid memory allocations for them. Note that /* We use fake JsonVariant objects for some special values, in order to avoid memory allocations for them. Note that
* effectively this means that there are multiple ways to encode the same objects: via these magic values or as * effectively this means that there are multiple ways to encode the same objects: via these magic values or as
* properly allocated JsonVariant. We convert between both on-the-fly as necessary. */ * properly allocated JsonVariant. We convert between both on-the-fly as necessary. */
#define JSON_VARIANT_MAGIC_TRUE ((JsonVariant*) 1) enum
#define JSON_VARIANT_MAGIC_FALSE ((JsonVariant*) 2) {
#define JSON_VARIANT_MAGIC_NULL ((JsonVariant*) 3) _JSON_VARIANT_MAGIC_TRUE = 1,
#define JSON_VARIANT_MAGIC_ZERO_INTEGER ((JsonVariant*) 4) #define JSON_VARIANT_MAGIC_TRUE ((JsonVariant*) _JSON_VARIANT_MAGIC_TRUE)
#define JSON_VARIANT_MAGIC_ZERO_UNSIGNED ((JsonVariant*) 5) _JSON_VARIANT_MAGIC_FALSE,
#define JSON_VARIANT_MAGIC_ZERO_REAL ((JsonVariant*) 6) #define JSON_VARIANT_MAGIC_FALSE ((JsonVariant*) _JSON_VARIANT_MAGIC_FALSE)
#define JSON_VARIANT_MAGIC_EMPTY_STRING ((JsonVariant*) 7) _JSON_VARIANT_MAGIC_NULL,
#define JSON_VARIANT_MAGIC_EMPTY_ARRAY ((JsonVariant*) 8) #define JSON_VARIANT_MAGIC_NULL ((JsonVariant*) _JSON_VARIANT_MAGIC_NULL)
#define JSON_VARIANT_MAGIC_EMPTY_OBJECT ((JsonVariant*) 9) _JSON_VARIANT_MAGIC_ZERO_INTEGER,
#define _JSON_VARIANT_MAGIC_MAX ((JsonVariant*) 10) #define JSON_VARIANT_MAGIC_ZERO_INTEGER ((JsonVariant*) _JSON_VARIANT_MAGIC_ZERO_INTEGER)
_JSON_VARIANT_MAGIC_ZERO_UNSIGNED,
#define JSON_VARIANT_MAGIC_ZERO_UNSIGNED ((JsonVariant*) _JSON_VARIANT_MAGIC_ZERO_UNSIGNED)
_JSON_VARIANT_MAGIC_ZERO_REAL,
#define JSON_VARIANT_MAGIC_ZERO_REAL ((JsonVariant*) _JSON_VARIANT_MAGIC_ZERO_REAL)
_JSON_VARIANT_MAGIC_EMPTY_STRING,
#define JSON_VARIANT_MAGIC_EMPTY_STRING ((JsonVariant*) _JSON_VARIANT_MAGIC_EMPTY_STRING)
_JSON_VARIANT_MAGIC_EMPTY_ARRAY,
#define JSON_VARIANT_MAGIC_EMPTY_ARRAY ((JsonVariant*) _JSON_VARIANT_MAGIC_EMPTY_ARRAY)
_JSON_VARIANT_MAGIC_EMPTY_OBJECT,
#define JSON_VARIANT_MAGIC_EMPTY_OBJECT ((JsonVariant*) _JSON_VARIANT_MAGIC_EMPTY_OBJECT)
__JSON_VARIANT_MAGIC_MAX
#define _JSON_VARIANT_MAGIC_MAX ((JsonVariant*) __JSON_VARIANT_MAGIC_MAX)
};
/* This is only safe as long as we don't define more than 4K magic pointers, i.e. the page size of the simplest /* This is only safe as long as we don't define more than 4K magic pointers, i.e. the page size of the simplest
* architectures we support. That's because we rely on the fact that malloc() will never allocate from the first memory * architectures we support. That's because we rely on the fact that malloc() will never allocate from the first memory
* page, as it is a faulting page for catching NULL pointer dereferences. */ * page, as it is a faulting page for catching NULL pointer dereferences. */
assert_cc((uintptr_t) _JSON_VARIANT_MAGIC_MAX < 4096U); assert_cc((unsigned) __JSON_VARIANT_MAGIC_MAX < 4096U);
enum { /* JSON tokens */ enum { /* JSON tokens */
JSON_TOKEN_END, JSON_TOKEN_END,