diff options
author | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2018-06-24 18:05:56 +0200 |
---|---|---|
committer | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2018-06-24 18:05:56 +0200 |
commit | 1981ffec4ad18287efe8ab693390e1d498de05bf (patch) | |
tree | 92b2107a9b00278536e2116fd1390c0d0aa4cfb4 /src/gnsrecord | |
parent | d43ee059a914b91e3c14eb6cf841e70d65bbe1f8 (diff) | |
download | gnunet-1981ffec4ad18287efe8ab693390e1d498de05bf.tar.gz gnunet-1981ffec4ad18287efe8ab693390e1d498de05bf.zip |
remove unnecessary networkrecord padding
Diffstat (limited to 'src/gnsrecord')
-rw-r--r-- | src/gnsrecord/gnsrecord_serialization.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/src/gnsrecord/gnsrecord_serialization.c b/src/gnsrecord/gnsrecord_serialization.c index 82b09c24e..a1cfbe984 100644 --- a/src/gnsrecord/gnsrecord_serialization.c +++ b/src/gnsrecord/gnsrecord_serialization.c | |||
@@ -89,7 +89,6 @@ GNUNET_GNSRECORD_records_get_size (unsigned int rd_count, | |||
89 | const struct GNUNET_GNSRECORD_Data *rd) | 89 | const struct GNUNET_GNSRECORD_Data *rd) |
90 | { | 90 | { |
91 | size_t ret; | 91 | size_t ret; |
92 | size_t no_padding; | ||
93 | 92 | ||
94 | ret = sizeof (struct NetworkRecord) * rd_count; | 93 | ret = sizeof (struct NetworkRecord) * rd_count; |
95 | for (unsigned int i=0;i<rd_count;i++) | 94 | for (unsigned int i=0;i<rd_count;i++) |
@@ -129,7 +128,6 @@ GNUNET_GNSRECORD_records_get_size (unsigned int rd_count, | |||
129 | * power of 2 for padding | 128 | * power of 2 for padding |
130 | * https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 | 129 | * https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 |
131 | */ | 130 | */ |
132 | no_padding = ret; | ||
133 | ret--; | 131 | ret--; |
134 | ret |= ret >> 1; | 132 | ret |= ret >> 1; |
135 | ret |= ret >> 2; | 133 | ret |= ret >> 2; |
@@ -137,9 +135,6 @@ GNUNET_GNSRECORD_records_get_size (unsigned int rd_count, | |||
137 | ret |= ret >> 8; | 135 | ret |= ret >> 8; |
138 | ret |= ret >> 16; | 136 | ret |= ret >> 16; |
139 | ret++; | 137 | ret++; |
140 | //If padding record does not fit, pad again. | ||
141 | if ((ret - no_padding) < sizeof (struct NetworkRecord)) | ||
142 | ret = ret << 1; | ||
143 | return (ssize_t) ret; | 138 | return (ssize_t) ret; |
144 | } | 139 | } |
145 | 140 | ||