aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2023-05-14 19:51:28 +0200
committerÖzgür Kesim <oec-taler@kesim.org>2023-05-22 08:48:48 +0200
commit5ebd19e60b820bb96b4451c366c2f152ab30ff67 (patch)
treedd9807f43f5378ede76169414297a93d292faae5
parent811c040a28b4bbc9d1bdba3fd8458c2b1033983d (diff)
downloadgnunet-5ebd19e60b820bb96b4451c366c2f152ab30ff67.tar.gz
gnunet-5ebd19e60b820bb96b4451c366c2f152ab30ff67.zip
-pq: slight optimization
-rw-r--r--src/pq/pq_query_helper.c47
1 files 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 (
860 { 860 {
861 case array_of_abs_time: 861 case array_of_abs_time:
862 { 862 {
863 const struct GNUNET_TIME_Absolute *abs; 863 const struct GNUNET_TIME_Absolute *abs =
864 864 (const struct GNUNET_TIME_Absolute *) in;
865 if (meta->continuous) 865
866 { 866 GNUNET_assert (sizeof(struct GNUNET_TIME_Absolute) == sz);
867 abs = (const struct GNUNET_TIME_Absolute *) in; 867
868 in += sz; 868 if (! meta->continuous)
869 }
870 else
871 abs = ((const struct GNUNET_TIME_Absolute **) data)[i]; 869 abs = ((const struct GNUNET_TIME_Absolute **) data)[i];
872 870
873 val = abs->abs_value_us; 871 val = abs->abs_value_us;
@@ -875,34 +873,28 @@ qconv_array (
875 } 873 }
876 case array_of_rel_time: 874 case array_of_rel_time:
877 { 875 {
878 const struct GNUNET_TIME_Relative *rel; 876 const struct GNUNET_TIME_Relative *rel =
879 877 (const struct GNUNET_TIME_Relative *) in;
880 if (meta->continuous) 878
881 { 879 GNUNET_assert (sizeof(struct GNUNET_TIME_Relative) == sz);
882 rel = (const struct GNUNET_TIME_Relative *) in; 880
883 in += sz; 881 if (! meta->continuous)
884 }
885 else
886 rel = ((const struct GNUNET_TIME_Relative **) data)[i]; 882 rel = ((const struct GNUNET_TIME_Relative **) data)[i];
887 883
888 val = rel->rel_value_us; 884 val = rel->rel_value_us;
889
890 break; 885 break;
891 } 886 }
892 case array_of_timestamp: 887 case array_of_timestamp:
893 { 888 {
894 const struct GNUNET_TIME_Timestamp *ts; 889 const struct GNUNET_TIME_Timestamp *ts =
895 890 (const struct GNUNET_TIME_Timestamp *) in;
896 if (meta->continuous) 891
897 { 892 GNUNET_assert (sizeof(struct GNUNET_TIME_Timestamp) == sz);
898 ts = (const struct GNUNET_TIME_Timestamp *) in; 893
899 in += sz; 894 if (! meta->continuous)
900 }
901 else
902 ts = ((const struct GNUNET_TIME_Timestamp **) data)[i]; 895 ts = ((const struct GNUNET_TIME_Timestamp **) data)[i];
903 896
904 val = ts->abs_time.abs_value_us; 897 val = ts->abs_time.abs_value_us;
905
906 break; 898 break;
907 } 899 }
908 default: 900 default:
@@ -916,6 +908,9 @@ qconv_array (
916 908
917 *(uint64_t *) out = GNUNET_htonll (val); 909 *(uint64_t *) out = GNUNET_htonll (val);
918 910
911 if (meta->continuous)
912 in += sz;
913
919 break; 914 break;
920 } 915 }
921 default: 916 default: