refactor: add tr_rand_obj() (#4238)

* refactor: add tr_rand_obj()

There are a lot of places in the codebase where we need to populate
an integral type or a fixed-size array with random data. To do this,
we instantiate a local on the stack, fill it with tr_rand_buffer(),
and then use it.

This PR creates a helper function to make this a one-liner.
This commit is contained in:
Charles Kerr
2022-11-25 15:04:37 -06:00
committed by GitHub
parent 342484d14a
commit 8a35aa0903
19 changed files with 47 additions and 67 deletions

View File

@@ -32,7 +32,7 @@
#include "transmission.h"
#include "crypto-utils.h" /* tr_rand_buffer(), tr_ssha1_matches() */
#include "crypto-utils.h" /* tr_ssha1_matches() */
#include "error.h"
#include "log.h"
#include "net.h"