diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-03-07 13:11:38 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-03-16 14:38:29 -0400 |
commit | 69b3e11e5994234d985d5711be0b1642bdd38a75 (patch) | |
tree | 953390c7b02af50893af9aa847066d9d31b722f0 /src/or/consdiff.h | |
parent | 3647751c2ac093d3fffb6243813f622348bf756d (diff) | |
download | tor-69b3e11e5994234d985d5711be0b1642bdd38a75.tar.gz tor-69b3e11e5994234d985d5711be0b1642bdd38a75.zip |
Use "const" in consdiff.[ch]
Diffstat (limited to 'src/or/consdiff.h')
-rw-r--r-- | src/or/consdiff.h | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/or/consdiff.h b/src/or/consdiff.h index 1fffaedb00..3316ed6879 100644 --- a/src/or/consdiff.h +++ b/src/or/consdiff.h @@ -11,11 +11,13 @@ typedef struct consensus_digest_t { uint8_t sha3_256[DIGEST256_LEN]; } consensus_digest_t; -smartlist_t *consdiff_gen_diff(smartlist_t *cons1, smartlist_t *cons2, - consensus_digest_t *digests1, consensus_digest_t *digests2); -char *consdiff_apply_diff(smartlist_t *cons1, smartlist_t *diff, - consensus_digest_t *digests1); -int consdiff_get_digests(smartlist_t *diff, +smartlist_t *consdiff_gen_diff(const smartlist_t *cons1, + const smartlist_t *cons2, + const consensus_digest_t *digests1, + const consensus_digest_t *digests2); +char *consdiff_apply_diff(const smartlist_t *cons1, const smartlist_t *diff, + const consensus_digest_t *digests1); +int consdiff_get_digests(const smartlist_t *diff, char *digest1_out, char *digest2_out); @@ -26,29 +28,33 @@ typedef struct smartlist_slice_t { * Smartlist that this slice is made from. * References the whole original smartlist that the slice was made out of. * */ - smartlist_t *list; + const smartlist_t *list; /** Starting position of the slice in the smartlist. */ int offset; /** Length of the slice, i.e. the number of elements it holds. */ int len; } smartlist_slice_t; -STATIC smartlist_t *gen_ed_diff(smartlist_t *cons1, smartlist_t *cons2); -STATIC smartlist_t *apply_ed_diff(smartlist_t *cons1, smartlist_t *diff); +STATIC smartlist_t *gen_ed_diff(const smartlist_t *cons1, + const smartlist_t *cons2); +STATIC smartlist_t *apply_ed_diff(const smartlist_t *cons1, + const smartlist_t *diff); STATIC void calc_changes(smartlist_slice_t *slice1, smartlist_slice_t *slice2, bitarray_t *changed1, bitarray_t *changed2); -STATIC smartlist_slice_t *smartlist_slice(smartlist_t *list, +STATIC smartlist_slice_t *smartlist_slice(const smartlist_t *list, int start, int end); -STATIC int next_router(smartlist_t *cons, int cur); -STATIC int *lcs_lengths(smartlist_slice_t *slice1, smartlist_slice_t *slice2, +STATIC int next_router(const smartlist_t *cons, int cur); +STATIC int *lcs_lengths(const smartlist_slice_t *slice1, + const smartlist_slice_t *slice2, int direction); STATIC void trim_slices(smartlist_slice_t *slice1, smartlist_slice_t *slice2); STATIC int base64cmp(const char *hash1, const char *hash2); STATIC const char *get_id_hash(const char *r_line); STATIC int is_valid_router_entry(const char *line); -STATIC int smartlist_slice_string_pos(smartlist_slice_t *slice, +STATIC int smartlist_slice_string_pos(const smartlist_slice_t *slice, const char *string); STATIC void set_changed(bitarray_t *changed1, bitarray_t *changed2, - smartlist_slice_t *slice1, smartlist_slice_t *slice2); + const smartlist_slice_t *slice1, + const smartlist_slice_t *slice2); STATIC int consensus_compute_digest(const char *cons, consensus_digest_t *digest_out); #endif |