[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Rename some free() functions that are actually clear().
commit 3ce69a58ce908ea88443c1321a7e4378f059a897
Author: George Kadianakis <desnacked@xxxxxxxxxx>
Date: Thu Aug 3 15:51:24 2017 +0300
Rename some free() functions that are actually clear().
---
src/or/hs_descriptor.c | 2 +-
src/or/hs_descriptor.h | 2 +-
src/or/hs_intropoint.c | 5 +++--
src/or/hs_intropoint.h | 2 +-
src/or/hs_service.c | 14 +++++++-------
5 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/or/hs_descriptor.c b/src/or/hs_descriptor.c
index e18e25b26..700d1b0cf 100644
--- a/src/or/hs_descriptor.c
+++ b/src/or/hs_descriptor.c
@@ -2490,7 +2490,7 @@ hs_desc_link_specifier_new(const extend_info_t *info, uint8_t type)
/* From the given descriptor, remove and free every introduction point. */
void
-hs_descriptor_free_intro_points(hs_descriptor_t *desc)
+hs_descriptor_clear_intro_points(hs_descriptor_t *desc)
{
smartlist_t *ips;
diff --git a/src/or/hs_descriptor.h b/src/or/hs_descriptor.h
index 2f1b0160e..d9c632b58 100644
--- a/src/or/hs_descriptor.h
+++ b/src/or/hs_descriptor.h
@@ -209,7 +209,7 @@ void hs_desc_encrypted_data_free(hs_desc_encrypted_data_t *desc);
void hs_desc_link_specifier_free(hs_desc_link_specifier_t *ls);
hs_desc_link_specifier_t *hs_desc_link_specifier_new(
const extend_info_t *info, uint8_t type);
-void hs_descriptor_free_intro_points(hs_descriptor_t *desc);
+void hs_descriptor_clear_intro_points(hs_descriptor_t *desc);
int hs_desc_encode_descriptor(const hs_descriptor_t *desc,
const ed25519_keypair_t *signing_kp,
diff --git a/src/or/hs_intropoint.c b/src/or/hs_intropoint.c
index 25c43b3ad..a0453841f 100644
--- a/src/or/hs_intropoint.c
+++ b/src/or/hs_intropoint.c
@@ -595,9 +595,10 @@ hs_intro_received_introduce1(or_circuit_t *circ, const uint8_t *request,
return -1;
}
-/* Free the given intropoint object ip. */
+/* Clear memory allocated by the given intropoint object ip (but don't free the
+ * object itself). */
void
-hs_intro_free_content(hs_intropoint_t *ip)
+hs_intropoint_clear(hs_intropoint_t *ip)
{
if (ip == NULL) {
return;
diff --git a/src/or/hs_intropoint.h b/src/or/hs_intropoint.h
index 2e11de1b5..5c77f07ec 100644
--- a/src/or/hs_intropoint.h
+++ b/src/or/hs_intropoint.h
@@ -51,7 +51,7 @@ MOCK_DECL(int, hs_intro_send_intro_established_cell,(or_circuit_t *circ));
int hs_intro_circuit_is_suitable_for_establish_intro(const or_circuit_t *circ);
hs_intropoint_t *hs_intro_new(void);
-void hs_intro_free_content(hs_intropoint_t *ip);
+void hs_intropoint_clear(hs_intropoint_t *ip);
#ifdef HS_INTROPOINT_PRIVATE
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index 430fb36a5..2a3217a5b 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -320,7 +320,7 @@ service_intro_point_free(hs_service_intro_point_t *ip)
memwipe(&ip->enc_key_kp, 0, sizeof(ip->enc_key_kp));
crypto_pk_free(ip->legacy_key);
replaycache_free(ip->replay_cache);
- hs_intro_free_content(&ip->base);
+ hs_intropoint_clear(&ip->base);
tor_free(ip);
}
@@ -1141,7 +1141,7 @@ build_desc_intro_points(const hs_service_t *service,
/* Ease our life. */
encrypted = &desc->desc->encrypted_data;
/* Cleanup intro points, we are about to set them from scratch. */
- hs_descriptor_free_intro_points(desc->desc);
+ hs_descriptor_clear_intro_points(desc->desc);
DIGEST256MAP_FOREACH(desc->intro_points.map, key,
const hs_service_intro_point_t *, ip) {
@@ -2125,7 +2125,7 @@ get_rev_counter_for_service(ed25519_public_key_t *blinded_pubkey)
/** Update the value of the revision counter for <b>hs_desc</b> and save it on
our state file. */
static void
-update_descriptor_revision_counter(hs_descriptor_t *hs_desc)
+increment_descriptor_revision_counter(hs_descriptor_t *hs_desc)
{
/* Find stored rev counter if it exists */
uint64_t rev_counter =
@@ -2212,7 +2212,7 @@ upload_descriptor_to_all(const hs_service_t *service,
}
/* Update the revision counter of this descriptor */
- update_descriptor_revision_counter(desc->desc);
+ increment_descriptor_revision_counter(desc->desc);
smartlist_free(responsible_dirs);
return;
@@ -2517,8 +2517,8 @@ service_handle_introduce2(origin_circuit_t *circ, const uint8_t *payload,
* information when originally tried to be uploaded. This is called when our
* directory information has changed. */
static void
-consider_hsdir_retry(const hs_service_t *service,
- hs_service_descriptor_t *desc)
+consider_hsdir_upload_retry(const hs_service_t *service,
+ hs_service_descriptor_t *desc)
{
smartlist_t *responsible_dirs = NULL;
smartlist_t *still_missing_dirs = NULL;
@@ -2772,7 +2772,7 @@ hs_service_dir_info_changed(void)
/* This cleans up the descriptor missing hsdir information list if a
* successful upload is made or if any of the directory aren't
* responsible anymore for the service descriptor. */
- consider_hsdir_retry(service, desc);
+ consider_hsdir_upload_retry(service, desc);
} FOR_EACH_DESCRIPTOR_END;
} FOR_EACH_SERVICE_END;
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits