Loading src/common/container.h +20 −2 Original line number Diff line number Diff line Loading @@ -113,7 +113,12 @@ char *smartlist_join_strings2(smartlist_t *sl, const char *join, /** Iterate over the items in a smartlist <b>sl</b>, in order. For each item, * assign it to a new local variable of type <b>type</b> named <b>var</b>, and * execute the statement <b>cmd</b>. Inside the loop, the loop index can * be accessed as <b>var</b>_sl_idx. * be accessed as <b>var</b>_sl_idx and the length of the list can be accessed * as <b>var</b>_sl_len. * * NOTE: Do not change the length of the list while the loop is in progress, * unless you adjust the _sl_len variable correspondingly. See second example * below. * * Example use: * <pre> Loading @@ -123,7 +128,20 @@ char *smartlist_join_strings2(smartlist_t *sl, const char *join, * printf("%d: %s\n", cp_sl_idx, cp); * tor_free(cp); * }); * smarlitst_free(list); * smartlist_free(list); * </pre> * * Example use (advanced): * <pre> * SMARTLIST_FOREACH(list, char *, cp, * { * if (!strcmp(cp, "junk")) { * smartlist_del(list, cp_sl_idx); * tor_free(cp); * --cp_sl_len; // decrement length of list so we don't run off the end * --cp_sl_idx; // decrement idx so we consider the item that moved here * } * }); * </pre> */ #define SMARTLIST_FOREACH(sl, type, var, cmd) \ Loading src/common/crypto.c +1 −2 Original line number Diff line number Diff line Loading @@ -1023,8 +1023,7 @@ crypto_pk_get_fingerprint(crypto_pk_env_t *pk, char *fp_out, int add_space) } base16_encode(hexdigest,sizeof(hexdigest),digest,DIGEST_LEN); if (add_space) { if (tor_strpartition(fp_out, FINGERPRINT_LEN+1, hexdigest, " ", 4, NEVER_TERMINATE)<0) if (tor_strpartition(fp_out, FINGERPRINT_LEN+1, hexdigest, " ", 4)<0) return -1; } else { strncpy(fp_out, hexdigest, HEX_DIGEST_LEN+1); Loading src/common/crypto.h +2 −1 Original line number Diff line number Diff line Loading @@ -167,7 +167,8 @@ void base32_encode(char *dest, size_t destlen, const char *src, size_t srclen); int digest_to_base64(char *d64, const char *digest); int digest_from_base64(char *digest, const char *d64); /** DOCDOC */ /** Length of RFC2440-style S2K specifier: the first 8 bytes are a salt, the * 9th describes how much iteration to do. */ #define S2K_SPECIFIER_LEN 9 void secret_to_key(char *key_out, size_t key_out_len, const char *secret, size_t secret_len, const char *s2k_specifier); Loading src/common/log.h +1 −1 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ /** Bandwidth accounting. */ #define LD_ACCT (1u<<17) /** DOCDOC */ /** Callback type used for add_callback_log. */ typedef void (*log_callback)(int severity, uint32_t domain, const char *msg); int parse_log_level(const char *level); Loading src/common/torgzip.h +7 −3 Original line number Diff line number Diff line Loading @@ -12,7 +12,10 @@ #define __TORGZIP_H #define TORGZIP_H_ID "$Id$" /** DOCDOC */ /** Enumeration of what kind of compression to use. Only ZLIB_METHOD is * guaranteed to be supported by the compress/uncompress functions here; * GZIP_METHOD may be supported if we built against zlib version 1.2 or later * and is_gzip_supported() returns true. */ typedef enum { NO_METHOD=0, GZIP_METHOD=1, ZLIB_METHOD=2, UNKNOWN_METHOD=3 } compress_method_t; Loading @@ -32,7 +35,8 @@ int is_gzip_supported(void); compress_method_t detect_compression_method(const char *in, size_t in_len); /** DOCDOC */ /** Return values from tor_zlib_process; see that function's documentation for * details. */ typedef enum { TOR_ZLIB_OK, TOR_ZLIB_DONE, TOR_ZLIB_BUF_FULL, TOR_ZLIB_ERR } tor_zlib_output_t; Loading Loading
src/common/container.h +20 −2 Original line number Diff line number Diff line Loading @@ -113,7 +113,12 @@ char *smartlist_join_strings2(smartlist_t *sl, const char *join, /** Iterate over the items in a smartlist <b>sl</b>, in order. For each item, * assign it to a new local variable of type <b>type</b> named <b>var</b>, and * execute the statement <b>cmd</b>. Inside the loop, the loop index can * be accessed as <b>var</b>_sl_idx. * be accessed as <b>var</b>_sl_idx and the length of the list can be accessed * as <b>var</b>_sl_len. * * NOTE: Do not change the length of the list while the loop is in progress, * unless you adjust the _sl_len variable correspondingly. See second example * below. * * Example use: * <pre> Loading @@ -123,7 +128,20 @@ char *smartlist_join_strings2(smartlist_t *sl, const char *join, * printf("%d: %s\n", cp_sl_idx, cp); * tor_free(cp); * }); * smarlitst_free(list); * smartlist_free(list); * </pre> * * Example use (advanced): * <pre> * SMARTLIST_FOREACH(list, char *, cp, * { * if (!strcmp(cp, "junk")) { * smartlist_del(list, cp_sl_idx); * tor_free(cp); * --cp_sl_len; // decrement length of list so we don't run off the end * --cp_sl_idx; // decrement idx so we consider the item that moved here * } * }); * </pre> */ #define SMARTLIST_FOREACH(sl, type, var, cmd) \ Loading
src/common/crypto.c +1 −2 Original line number Diff line number Diff line Loading @@ -1023,8 +1023,7 @@ crypto_pk_get_fingerprint(crypto_pk_env_t *pk, char *fp_out, int add_space) } base16_encode(hexdigest,sizeof(hexdigest),digest,DIGEST_LEN); if (add_space) { if (tor_strpartition(fp_out, FINGERPRINT_LEN+1, hexdigest, " ", 4, NEVER_TERMINATE)<0) if (tor_strpartition(fp_out, FINGERPRINT_LEN+1, hexdigest, " ", 4)<0) return -1; } else { strncpy(fp_out, hexdigest, HEX_DIGEST_LEN+1); Loading
src/common/crypto.h +2 −1 Original line number Diff line number Diff line Loading @@ -167,7 +167,8 @@ void base32_encode(char *dest, size_t destlen, const char *src, size_t srclen); int digest_to_base64(char *d64, const char *digest); int digest_from_base64(char *digest, const char *d64); /** DOCDOC */ /** Length of RFC2440-style S2K specifier: the first 8 bytes are a salt, the * 9th describes how much iteration to do. */ #define S2K_SPECIFIER_LEN 9 void secret_to_key(char *key_out, size_t key_out_len, const char *secret, size_t secret_len, const char *s2k_specifier); Loading
src/common/log.h +1 −1 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ /** Bandwidth accounting. */ #define LD_ACCT (1u<<17) /** DOCDOC */ /** Callback type used for add_callback_log. */ typedef void (*log_callback)(int severity, uint32_t domain, const char *msg); int parse_log_level(const char *level); Loading
src/common/torgzip.h +7 −3 Original line number Diff line number Diff line Loading @@ -12,7 +12,10 @@ #define __TORGZIP_H #define TORGZIP_H_ID "$Id$" /** DOCDOC */ /** Enumeration of what kind of compression to use. Only ZLIB_METHOD is * guaranteed to be supported by the compress/uncompress functions here; * GZIP_METHOD may be supported if we built against zlib version 1.2 or later * and is_gzip_supported() returns true. */ typedef enum { NO_METHOD=0, GZIP_METHOD=1, ZLIB_METHOD=2, UNKNOWN_METHOD=3 } compress_method_t; Loading @@ -32,7 +35,8 @@ int is_gzip_supported(void); compress_method_t detect_compression_method(const char *in, size_t in_len); /** DOCDOC */ /** Return values from tor_zlib_process; see that function's documentation for * details. */ typedef enum { TOR_ZLIB_OK, TOR_ZLIB_DONE, TOR_ZLIB_BUF_FULL, TOR_ZLIB_ERR } tor_zlib_output_t; Loading