Commit b4d387c2 authored by Nick Mathewson's avatar Nick Mathewson 🏃
Browse files

Make freelist_len in memarea.c static; document a few variables.

svn:r17741
parent 7d79bec5
......@@ -1829,9 +1829,11 @@ tor_get_thread_id(void)
return (unsigned long)GetCurrentThreadId();
}
#elif defined(USE_PTHREADS)
/* DOCDOC attr_reentrant */
/** A mutex attribute that we're going to use to tell pthreads that we want
* "reentrant" mutexes (i.e., once we can re-lock if we're already holding
* them.) */
static pthread_mutexattr_t attr_reentrant;
/* DOCDOC threads_initialized */
/** True iff we've called tor_threads_init() */
static int threads_initialized = 0;
/** Initialize <b>mutex</b> so it can be locked. Every mutex must be set
* up eith tor_mutex_init() or tor_mutex_new(); not both. */
......
......@@ -261,7 +261,7 @@ _crypto_new_pk_env_evp_pkey(EVP_PKEY *pkey)
return _crypto_new_pk_env_rsa(rsa);
}
/* DOCDOC _crypto_pk_env_get_rsa */
/** Helper, used by tor-checkkey.c. Return the RSA from a crypto_pk_env_t. */
RSA *
_crypto_pk_env_get_rsa(crypto_pk_env_t *env)
{
......
......@@ -104,7 +104,8 @@ static tor_mutex_t *log_mutex = NULL;
/** Linked list of logfile_t. */
static logfile_t *logfiles = NULL;
#ifdef HAVE_SYSLOG_H
/* DOCDOC syslog_count */
/** The number of open syslog log handlers that we have. When this reaches 0,
* we can close our connection to the syslog facility. */
static int syslog_count = 0;
#endif
......@@ -118,8 +119,8 @@ static int syslog_count = 0;
#define UNLOCK_LOGS() STMT_NIL
#endif
/* What's the lowest log level anybody cares about? */
/* DOCDOC _log_global_min_severity */
/** What's the lowest log level anybody cares about? Checking this lets us
* bail out early from log_debug if we aren't debugging. */
int _log_global_min_severity = LOG_NOTICE;
static void delete_log(logfile_t *victim);
......
......@@ -61,10 +61,12 @@ struct memarea_t {
memarea_chunk_t *first; /**< Top of the chunk stack: never NULL. */
};
/** How many chunks will we put into the freelist before freeing them? */
#define MAX_FREELIST_LEN 4
/* DOCDOC freelist_len */
int freelist_len=0;
/* DOCDOC freelist */
/** The number of memarea chunks currently in our freelist. */
static int freelist_len=0;
/** A linked list of unused memory area chunks. Used to prevent us from
* spinning in malloc/free loops. */
static memarea_chunk_t *freelist = NULL;
/** Helper: allocate a new memarea chunk of around <b>chunk_size</b> bytes. */
......
......@@ -21,9 +21,6 @@
#define PRETTY_FUNCTION ""
#endif
/* DOCDOC have_failed */
extern int have_failed;
#define test_fail_msg(msg) \
STMT_BEGIN \
have_failed = 1; \
......
......@@ -1054,10 +1054,11 @@ tor_timegm(struct tm *tm)
}
/* strftime is locale-specific, so we need to replace those parts */
/* DOCDOC WEEKDAY_NAMES */
/** A c-locale array of 3-letter names of weekdays, starting with Sun. */
static const char *WEEKDAY_NAMES[] =
{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
/* DOCDOC MONTH_NAMES */
/** A c-locale array of 3-letter names of months, starting with Jan. */
static const char *MONTH_NAMES[] =
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
......@@ -1341,9 +1342,10 @@ update_approx_time(time_t now)
* have up to <b>ftime_slop</b> seconds of inaccuracy; IOW, our window of
* estimate for the current time is now + ftime_skew +/- ftime_slop.
*/
/* DOCDOC ftime_skew */
/** Our current estimate of our skew, such that we think the current time is
* closest to time(NULL)+ftime_skew. */
static int ftime_skew = 0;
/* DOCDOC ftime_slop */
/** Tolerance during time comparisons, in seconds. */
static int ftime_slop = 60;
/** Set the largest amount of sloppiness we'll allow in fuzzy time
* comparisons. */
......
......@@ -51,10 +51,12 @@ const char tor_svn_revision[] = "";
#include <openssl/crypto.h>
#endif
/* DOCDOC have_failed */
/** Set to true if any unit test has failed. Mostly, this is set by the macros
* in test.h */
int have_failed = 0;
/* DOCDOC temp_dir */
/** Temporary directory (set up by setup_directory) under which we store all
* our files during testing. */
static char temp_dir[256];
/** Select and create the temporary directory we'll use to run our unit tests.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment