gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] 03/04: -pq: slight optimization


From: gnunet
Subject: [gnunet] 03/04: -pq: slight optimization
Date: Fri, 02 Jun 2023 16:19:11 +0200

This is an automated email from the git hooks/post-receive script.

oec pushed a commit to branch master
in repository gnunet.

commit a901ae1210840291556ea76d2e33a4a3c9ded105
Author: Özgür Kesim <oec-taler@kesim.org>
AuthorDate: Sun May 14 19:51:28 2023 +0200

    -pq: slight optimization
---
 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
index 1a31333d9..0d9371bd5 100644
--- 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:

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]