commit a901ae1210840291556ea76d2e33a4a3c9ded105 parent 0c4ab7cddfa11b153be0189ca4ede3224806f530 Author: Özgür Kesim <oec-taler@kesim.org> Date: Sun, 14 May 2023 19:51:28 +0200 -pq: slight optimization Diffstat:
| M | src/pq/pq_query_helper.c | | | 47 | +++++++++++++++++++++-------------------------- |
1 file changed, 21 insertions(+), 26 deletions(-)
diff --git a/src/pq/pq_query_helper.c b/src/pq/pq_query_helper.c @@ -860,14 +860,12 @@ qconv_array ( { case array_of_abs_time: { - const struct GNUNET_TIME_Absolute *abs; - - if (meta->continuous) - { - abs = (const struct GNUNET_TIME_Absolute *) in; - in += sz; - } - else + const struct GNUNET_TIME_Absolute *abs = + (const struct GNUNET_TIME_Absolute *) in; + + GNUNET_assert (sizeof(struct GNUNET_TIME_Absolute) == sz); + + if (! meta->continuous) abs = ((const struct GNUNET_TIME_Absolute **) data)[i]; val = abs->abs_value_us; @@ -875,34 +873,28 @@ qconv_array ( } case array_of_rel_time: { - const struct GNUNET_TIME_Relative *rel; - - if (meta->continuous) - { - rel = (const struct GNUNET_TIME_Relative *) in; - in += sz; - } - else + const struct GNUNET_TIME_Relative *rel = + (const struct GNUNET_TIME_Relative *) in; + + GNUNET_assert (sizeof(struct GNUNET_TIME_Relative) == sz); + + if (! meta->continuous) rel = ((const struct GNUNET_TIME_Relative **) data)[i]; val = rel->rel_value_us; - break; } case array_of_timestamp: { - const struct GNUNET_TIME_Timestamp *ts; - - if (meta->continuous) - { - ts = (const struct GNUNET_TIME_Timestamp *) in; - in += sz; - } - else + const struct GNUNET_TIME_Timestamp *ts = + (const struct GNUNET_TIME_Timestamp *) in; + + GNUNET_assert (sizeof(struct GNUNET_TIME_Timestamp) == sz); + + if (! meta->continuous) ts = ((const struct GNUNET_TIME_Timestamp **) data)[i]; val = ts->abs_time.abs_value_us; - break; } default: @@ -916,6 +908,9 @@ qconv_array ( *(uint64_t *) out = GNUNET_htonll (val); + if (meta->continuous) + in += sz; + break; } default: