[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: timestamps are in seconds, kill redundan
From: |
gnunet |
Subject: |
[gnunet] branch master updated: timestamps are in seconds, kill redundant _ms variant |
Date: |
Fri, 08 Jul 2022 14:37:06 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 78cba4124 timestamps are in seconds, kill redundant _ms variant
78cba4124 is described below
commit 78cba4124a993ba97923ff0543f2a5942f297cdc
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Fri Jul 8 14:37:03 2022 +0200
timestamps are in seconds, kill redundant _ms variant
---
src/json/json_generator.c | 21 -------------------
src/json/json_helper.c | 53 ++++++++---------------------------------------
2 files changed, 9 insertions(+), 65 deletions(-)
diff --git a/src/json/json_generator.c b/src/json/json_generator.c
index 5421b9527..acfbcfe63 100644
--- a/src/json/json_generator.c
+++ b/src/json/json_generator.c
@@ -71,15 +71,6 @@ GNUNET_JSON_from_timestamp (struct GNUNET_TIME_Timestamp
stamp)
json_decref (j);
return NULL;
}
- if (0 !=
- json_object_set_new (j,
- "t_ms",
- json_string ("never")))
- {
- GNUNET_break (0);
- json_decref (j);
- return NULL;
- }
return j;
}
GNUNET_assert (
@@ -98,18 +89,6 @@ GNUNET_JSON_from_timestamp (struct GNUNET_TIME_Timestamp
stamp)
json_decref (j);
return NULL;
}
- if (0 !=
- json_object_set_new (
- j,
- "t_ms",
- json_integer (
- (json_int_t) (stamp.abs_time.abs_value_us
- / GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us))))
- {
- GNUNET_break (0);
- json_decref (j);
- return NULL;
- }
return j;
}
diff --git a/src/json/json_helper.c b/src/json/json_helper.c
index def26afb8..27bb9f41c 100644
--- a/src/json/json_helper.c
+++ b/src/json/json_helper.c
@@ -111,7 +111,7 @@ GNUNET_JSON_spec_fixed (const char *name,
* @param[out] spec where to write the data
* @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
*/
-static int
+static enum GNUNET_GenericReturnValue
parse_variable_data (void *cls,
json_t *root,
struct GNUNET_JSON_Specification *spec)
@@ -190,7 +190,7 @@ GNUNET_JSON_spec_varsize (const char *name,
* @param[out] spec where to write the data
* @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
*/
-static int
+static enum GNUNET_GenericReturnValue
parse_string (void *cls,
json_t *root,
struct GNUNET_JSON_Specification *spec)
@@ -236,7 +236,7 @@ GNUNET_JSON_spec_string (const char *name,
* @param[out] spec where to write the data
* @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
*/
-static int
+static enum GNUNET_GenericReturnValue
parse_object (void *cls,
json_t *root,
struct GNUNET_JSON_Specification *spec)
@@ -299,7 +299,7 @@ GNUNET_JSON_spec_json (const char *name,
* @param[out] spec where to write the data
* @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
*/
-static int
+static enum GNUNET_GenericReturnValue
parse_bool (void *cls,
json_t *root,
struct GNUNET_JSON_Specification *spec)
@@ -347,7 +347,7 @@ GNUNET_JSON_spec_bool (const char *name,
* @param[out] spec where to write the data
* @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
*/
-static int
+static enum GNUNET_GenericReturnValue
parse_u8 (void *cls,
json_t *root,
struct GNUNET_JSON_Specification *spec)
@@ -397,7 +397,7 @@ GNUNET_JSON_spec_uint8 (const char *name,
* @param[out] spec where to write the data
* @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
*/
-static int
+static enum GNUNET_GenericReturnValue
parse_u16 (void *cls,
json_t *root,
struct GNUNET_JSON_Specification *spec)
@@ -447,7 +447,7 @@ GNUNET_JSON_spec_uint16 (const char *name,
* @param[out] spec where to write the data
* @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
*/
-static int
+static enum GNUNET_GenericReturnValue
parse_u32 (void *cls,
json_t *root,
struct GNUNET_JSON_Specification *spec)
@@ -497,7 +497,7 @@ GNUNET_JSON_spec_uint32 (const char *name,
* @param[out] spec where to write the data
* @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
*/
-static int
+static enum GNUNET_GenericReturnValue
parse_u64 (void *cls,
json_t *root,
struct GNUNET_JSON_Specification *spec)
@@ -542,7 +542,7 @@ GNUNET_JSON_spec_uint64 (const char *name,
* @param[out] spec where to write the data
* @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
*/
-static int
+static enum GNUNET_GenericReturnValue
parse_i64 (void *cls,
json_t *root,
struct GNUNET_JSON_Specification *spec)
@@ -596,7 +596,6 @@ parse_timestamp (void *cls,
{
struct GNUNET_TIME_Timestamp *ts = spec->ptr;
json_t *json_t_s;
- json_t *json_t_ms;
unsigned long long int tval;
if (! json_is_object (root))
@@ -636,40 +635,6 @@ parse_timestamp (void *cls,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- json_t_ms = json_object_get (root,
- "t_ms");
- if (json_is_integer (json_t_ms))
- {
- tval = json_integer_value (json_t_ms);
- GNUNET_break_op (0 == tval % 1000);
- tval -= tval % 1000;
- /* Time is in seconds in JSON, but in microseconds in GNUNET_TIME_Absolute
*/
- ts->abs_time.abs_value_us
- = tval * GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us;
- if (ts->abs_time.abs_value_us
- / GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us
- != tval)
- {
- /* Integer overflow */
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- return GNUNET_OK;
- }
- if (json_is_string (json_t_ms))
- {
- const char *val;
-
- val = json_string_value (json_t_ms);
- if ((0 == strcasecmp (val,
- "never")))
- {
- ts->abs_time = GNUNET_TIME_UNIT_FOREVER_ABS;
- return GNUNET_OK;
- }
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: timestamps are in seconds, kill redundant _ms variant,
gnunet <=