From: Automatic source maintenance Date: Tue, 2 Nov 2010 00:12:43 +0000 (-0600) Subject: SourceFormat Enforcement X-Git-Tag: take1~117 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8236d34f5e646d3a34d976e391ed9e93aebc3dd3;p=thirdparty%2Fsquid.git SourceFormat Enforcement --- diff --git a/compat/xalloc.cc b/compat/xalloc.cc index ee04da3697..c1e59773c6 100644 --- a/compat/xalloc.cc +++ b/compat/xalloc.cc @@ -21,7 +21,7 @@ XMS_DBG_INDEX(int sz) if (sz <= XMS_DBG_SPLIT) return (sz + XMS_DBG_GRAIN_SM - 1) / XMS_DBG_GRAIN_SM; - + return (sz + XMS_DBG_GRAIN - 1) / XMS_DBG_GRAIN + XMS_DBG_OFFSET; } @@ -30,16 +30,16 @@ stat_init(void) { for (int i = 0; i <= XMS_DBG_MAXINDEX; i++) malloc_sizes[i] = malloc_histo[i] = 0; - + dbg_stat_init = 1; } - + static int malloc_stat(int sz) { if (!dbg_stat_init) - stat_init(); - + stat_init(); + return malloc_sizes[XMS_DBG_INDEX(sz)] += 1; } @@ -146,16 +146,16 @@ xmalloc(size_t sz) } void * -xrealloc(void *s, size_t sz) +xrealloc(void *s, size_t sz) { PROF_start(xrealloc); #if XMALLOC_TRACE xmalloc_show_trace(s, -1); -#endif - - if (sz < 1) +#endif + + if (sz < 1) sz = 1; - + #if XMALLOC_DEBUG if (s != NULL) check_free(s); @@ -172,15 +172,15 @@ xrealloc(void *s, size_t sz) } else { perror("realloc"); } - + exit(1); } - + #if XMALLOC_DEBUG check_malloc(p, sz); #endif #if XMALLOC_STATISTICS - malloc_stat(sz); + malloc_stat(sz); #endif #if XMALLOC_TRACE xmalloc_show_trace(p, 1); @@ -209,7 +209,7 @@ free_const(const void *s_const) PROF_start(free_const); #if XMALLOC_TRACE - xmalloc_show_trace(s, -1); + xmalloc_show_trace(s, -1); #endif #if XMALLOC_DEBUG diff --git a/compat/xalloc.h b/compat/xalloc.h index 084c522522..fd92601459 100644 --- a/compat/xalloc.h +++ b/compat/xalloc.h @@ -5,66 +5,66 @@ extern "C" { #endif -/** - * xcalloc() - same as calloc(3). Used for portability. - * Never returns NULL; fatal on error. - * - * Define failure_notify to receive error message. - * otherwise perror() is used to display it. - */ -void *xcalloc(size_t n, size_t sz); + /** + * xcalloc() - same as calloc(3). Used for portability. + * Never returns NULL; fatal on error. + * + * Define failure_notify to receive error message. + * otherwise perror() is used to display it. + */ + void *xcalloc(size_t n, size_t sz); -/** - * xmalloc() - same as malloc(3). Used for portability. - * Never returns NULL; fatal on error. - * - * Define failure_notify to receive error message. - * otherwise perror() is used to display it. - */ -void *xmalloc(size_t sz); + /** + * xmalloc() - same as malloc(3). Used for portability. + * Never returns NULL; fatal on error. + * + * Define failure_notify to receive error message. + * otherwise perror() is used to display it. + */ + void *xmalloc(size_t sz); -/** - * xrealloc() - same as realloc(3). Used for portability. - * Never returns NULL; fatal on error. - */ -void *xrealloc(void *s, size_t sz); + /** + * xrealloc() - same as realloc(3). Used for portability. + * Never returns NULL; fatal on error. + */ + void *xrealloc(void *s, size_t sz); -/** - * xfree() - same as free(3). Used for portability. - * Will not call free(3) if s == NULL. - * - * Define failure_notify to receive error message. - * otherwise perror() is used to display it. - */ -void xfree(void *s); + /** + * xfree() - same as free(3). Used for portability. + * Will not call free(3) if s == NULL. + * + * Define failure_notify to receive error message. + * otherwise perror() is used to display it. + */ + void xfree(void *s); -/** - * xxfree() / free_const() - Same as free(3). Used for portability. - * Accepts pointers to dynamically allocated const data. - * - * Define failure_notify to receive error message. - * otherwise perror() is used to display it. - */ -void free_const(const void *s); + /** + * xxfree() / free_const() - Same as free(3). Used for portability. + * Accepts pointers to dynamically allocated const data. + * + * Define failure_notify to receive error message. + * otherwise perror() is used to display it. + */ + void free_const(const void *s); /// Backward compatibility alias for free_const(const void *s) #define xxfree(x) free_const((x)) -/** - * Accepts pointers to dynamically allocated const data. - * Will not call free(3) if the pointer is NULL. - * Sets the pointer to NULL on completion. - * - * Use xfree() if the pointer does not need to be set afterward. - * - * Define failure_notify to receive error message. - * otherwise perror() is used to display it. - */ + /** + * Accepts pointers to dynamically allocated const data. + * Will not call free(3) if the pointer is NULL. + * Sets the pointer to NULL on completion. + * + * Use xfree() if the pointer does not need to be set afterward. + * + * Define failure_notify to receive error message. + * otherwise perror() is used to display it. + */ #define safe_free(x) while (x) { xxfree(x); (x) = NULL; } #if XMALLOC_STATISTICS -void malloc_statistics(void (*func) (int, int, int, void *), void *data); + void malloc_statistics(void (*func) (int, int, int, void *), void *data); #endif #ifdef __cplusplus diff --git a/compat/xstring.h b/compat/xstring.h index 4c8d71ad60..c5248bda8a 100644 --- a/compat/xstring.h +++ b/compat/xstring.h @@ -9,40 +9,40 @@ extern "C" { #endif -/** - * xstrdup() - same as strdup(3). Used for portability. - * Never returns NULL; fatal on error. - * - * Sets errno to EINVAL if a NULL pointer is passed. - * - * Define failure_notify to receive error message. - * otherwise perror() is used to display it. - */ -char *xstrdup(const char *s); + /** + * xstrdup() - same as strdup(3). Used for portability. + * Never returns NULL; fatal on error. + * + * Sets errno to EINVAL if a NULL pointer is passed. + * + * Define failure_notify to receive error message. + * otherwise perror() is used to display it. + */ + char *xstrdup(const char *s); #ifdef strdup #undef strdup #endif #define strdup(X) xstrdup((X)) -/* - * xstrncpy() - similar to strncpy(3) but terminates string - * always with '\0' if (n != 0 and dst != NULL), - * and doesn't do padding - */ -char *xstrncpy(char *dst, const char *src, size_t n); - -/** - * xstrndup() - same as strndup(3). Used for portability. - * Never returns NULL; fatal on error. - * - * Sets errno to EINVAL if a NULL pointer or negative - * length is passed. - * - * Define failure_notify to receive error message. - * otherwise perror() is used to display it. - */ -char *xstrndup(const char *s, size_t n); + /* + * xstrncpy() - similar to strncpy(3) but terminates string + * always with '\0' if (n != 0 and dst != NULL), + * and doesn't do padding + */ + char *xstrncpy(char *dst, const char *src, size_t n); + + /** + * xstrndup() - same as strndup(3). Used for portability. + * Never returns NULL; fatal on error. + * + * Sets errno to EINVAL if a NULL pointer or negative + * length is passed. + * + * Define failure_notify to receive error message. + * otherwise perror() is used to display it. + */ + char *xstrndup(const char *s, size_t n); #ifdef strndup #undef strndup diff --git a/include/base64.h b/include/base64.h index 82766109dd..354a0687fd 100644 --- a/include/base64.h +++ b/include/base64.h @@ -5,9 +5,9 @@ extern "C" { #endif -extern char *base64_decode(const char *coded); -extern const char *base64_encode(const char *decoded); -extern const char *base64_encode_bin(const char *data, int len); + extern char *base64_decode(const char *coded); + extern const char *base64_encode(const char *decoded); + extern const char *base64_encode_bin(const char *data, int len); #ifdef __cplusplus } diff --git a/include/rfc1123.h b/include/rfc1123.h index 04f0b56eef..bfeac4bd8d 100644 --- a/include/rfc1123.h +++ b/include/rfc1123.h @@ -5,9 +5,9 @@ extern "C" { #endif -extern const char *mkhttpdlogtime(const time_t *); -extern const char *mkrfc1123(time_t); -extern time_t parse_rfc1123(const char *str); + extern const char *mkhttpdlogtime(const time_t *); + extern const char *mkrfc1123(time_t); + extern time_t parse_rfc1123(const char *str); #ifdef __cplusplus } diff --git a/include/rfc1738.h b/include/rfc1738.h index 7189bb98af..2d7b9a4b79 100644 --- a/include/rfc1738.h +++ b/include/rfc1738.h @@ -5,41 +5,41 @@ extern "C" { #endif -/* Encoder rfc1738_do_escape flag values. */ + /* Encoder rfc1738_do_escape flag values. */ #define RFC1738_ESCAPE_UNSAFE 0 #define RFC1738_ESCAPE_RESERVED 1 #define RFC1738_ESCAPE_UNESCAPED -1 -/** - * \group rfc1738 RFC 1738 URL-escaping library - * - * Public API is formed of a triplet of encode functions mapping to the rfc1738_do_encode() engine. - * - * ASCII characters are split into three groups: - * \item SAFE Characters which are safe to occur in any URL. For example A,B,C - * \item UNSAFE Characters which are completely usafe to occur in any URL. For example; backspace, tab, space, newline - * \item RESERVED Characters which are reserved for special meaning and may only occur in certain parts of a URL. - * - * Returns a static buffer containing the RFC 1738 compliant, escaped version of the given url. - * - * \param flags RFC1738_ESCAPE_UNSAFE Only encode unsafe characters. Ignore reserved. - * \param flags RFC1738_ESCAPE_RESERVED Encode all unsafe and reserved characters. - * \param flags RFC1738_ESCAPE_UNESCAPED Encode all unsafe characters which have not already been encoded. - */ -extern char *rfc1738_do_escape(const char *url, int flags); - -/* Old API functions */ + /** + * \group rfc1738 RFC 1738 URL-escaping library + * + * Public API is formed of a triplet of encode functions mapping to the rfc1738_do_encode() engine. + * + * ASCII characters are split into three groups: + * \item SAFE Characters which are safe to occur in any URL. For example A,B,C + * \item UNSAFE Characters which are completely usafe to occur in any URL. For example; backspace, tab, space, newline + * \item RESERVED Characters which are reserved for special meaning and may only occur in certain parts of a URL. + * + * Returns a static buffer containing the RFC 1738 compliant, escaped version of the given url. + * + * \param flags RFC1738_ESCAPE_UNSAFE Only encode unsafe characters. Ignore reserved. + * \param flags RFC1738_ESCAPE_RESERVED Encode all unsafe and reserved characters. + * \param flags RFC1738_ESCAPE_UNESCAPED Encode all unsafe characters which have not already been encoded. + */ + extern char *rfc1738_do_escape(const char *url, int flags); + + /* Old API functions */ #define rfc1738_escape(x) rfc1738_do_escape(x, RFC1738_ESCAPE_UNSAFE) #define rfc1738_escape_part(x) rfc1738_do_escape(x, RFC1738_ESCAPE_RESERVED) #define rfc1738_escape_unescaped(x) rfc1738_do_escape(x, RFC1738_ESCAPE_UNESCAPED) -/** - * Unescape a URL string according to RFC 1738 specification. - * String is unescaped in-place - */ -extern void rfc1738_unescape(char *url); + /** + * Unescape a URL string according to RFC 1738 specification. + * String is unescaped in-place + */ + extern void rfc1738_unescape(char *url); #ifdef __cplusplus } diff --git a/include/rfc2617.h b/include/rfc2617.h index fcb79ed37b..dd704faa2e 100644 --- a/include/rfc2617.h +++ b/include/rfc2617.h @@ -56,38 +56,38 @@ extern "C" { #endif #define HASHLEN 16 -typedef char HASH[HASHLEN]; + typedef char HASH[HASHLEN]; #define HASHHEXLEN 32 -typedef char HASHHEX[HASHHEXLEN + 1]; + typedef char HASHHEX[HASHHEXLEN + 1]; -/* calculate H(A1) as per HTTP Digest spec */ -extern void DigestCalcHA1( - const char *pszAlg, - const char *pszUserName, - const char *pszRealm, - const char *pszPassword, - const char *pszNonce, - const char *pszCNonce, - HASH HA1, - HASHHEX SessionKey -); + /* calculate H(A1) as per HTTP Digest spec */ + extern void DigestCalcHA1( + const char *pszAlg, + const char *pszUserName, + const char *pszRealm, + const char *pszPassword, + const char *pszNonce, + const char *pszCNonce, + HASH HA1, + HASHHEX SessionKey + ); -/* calculate request-digest/response-digest as per HTTP Digest spec */ -extern void DigestCalcResponse( - const HASHHEX HA1, /* H(A1) */ - const char *pszNonce, /* nonce from server */ - const char *pszNonceCount, /* 8 hex digits */ - const char *pszCNonce, /* client nonce */ - const char *pszQop, /* qop-value: "", "auth", "auth-int" */ - const char *pszMethod, /* method from the request */ - const char *pszDigestUri, /* requested URL */ - const HASHHEX HEntity, /* H(entity body) if qop="auth-int" */ - HASHHEX Response /* request-digest or response-digest */ -); + /* calculate request-digest/response-digest as per HTTP Digest spec */ + extern void DigestCalcResponse( + const HASHHEX HA1, /* H(A1) */ + const char *pszNonce, /* nonce from server */ + const char *pszNonceCount, /* 8 hex digits */ + const char *pszCNonce, /* client nonce */ + const char *pszQop, /* qop-value: "", "auth", "auth-int" */ + const char *pszMethod, /* method from the request */ + const char *pszDigestUri, /* requested URL */ + const HASHHEX HEntity, /* H(entity body) if qop="auth-int" */ + HASHHEX Response /* request-digest or response-digest */ + ); -extern void CvtHex(const HASH Bin, HASHHEX Hex); + extern void CvtHex(const HASH Bin, HASHHEX Hex); -extern void CvtBin(const HASHHEX Hex, HASH Bin); + extern void CvtBin(const HASHHEX Hex, HASH Bin); #ifdef __cplusplus } diff --git a/lib/profiler/Profiler.h b/lib/profiler/Profiler.h index d59abc3817..8e57feb2c0 100644 --- a/lib/profiler/Profiler.h +++ b/lib/profiler/Profiler.h @@ -20,36 +20,36 @@ extern "C" { #define XP_NOBEST (hrtime_t)-1 -typedef struct _xprof_stats_node xprof_stats_node; - -typedef struct _xprof_stats_data xprof_stats_data; - -struct _xprof_stats_data { - hrtime_t start; - hrtime_t stop; - hrtime_t delta; - hrtime_t best; - hrtime_t worst; - hrtime_t count; - hrtime_t accum; - int64_t summ; -}; - -struct _xprof_stats_node { - const char *name; - xprof_stats_data accu; - xprof_stats_data hist; -}; - -typedef xprof_stats_node TimersArray[1]; - -/* public Data */ -extern TimersArray *xprof_Timers; - -/* Exported functions */ -extern void xprof_start(xprof_type type, const char *timer); -extern void xprof_stop(xprof_type type, const char *timer); -extern void xprof_event(void *data); + typedef struct _xprof_stats_node xprof_stats_node; + + typedef struct _xprof_stats_data xprof_stats_data; + + struct _xprof_stats_data { + hrtime_t start; + hrtime_t stop; + hrtime_t delta; + hrtime_t best; + hrtime_t worst; + hrtime_t count; + hrtime_t accum; + int64_t summ; + }; + + struct _xprof_stats_node { + const char *name; + xprof_stats_data accu; + xprof_stats_data hist; + }; + + typedef xprof_stats_node TimersArray[1]; + + /* public Data */ + extern TimersArray *xprof_Timers; + + /* Exported functions */ + extern void xprof_start(xprof_type type, const char *timer); + extern void xprof_stop(xprof_type type, const char *timer); + extern void xprof_event(void *data); #define PROF_start(type) xprof_start(XPROF_##type, #type) #define PROF_stop(type) xprof_stop(XPROF_##type, #type) diff --git a/src/HttpHeaderTools.cc b/src/HttpHeaderTools.cc index 5ef08389f9..8d7ba32709 100644 --- a/src/HttpHeaderTools.cc +++ b/src/HttpHeaderTools.cc @@ -351,7 +351,7 @@ httpHeaderParseQuotedString(const char *start, const int len, String *val) return 0; } end = pos; - while(end <= (start+len) && *end != '\\' && *end != '\"' && *end > 0x1F && *end != 0x7F) + while (end <= (start+len) && *end != '\\' && *end != '\"' && *end > 0x1F && *end != 0x7F) end++; if (*end <= 0x1F || *end == 0x7F) { debugs(66, 2, "failed to parse a quoted-string header field with CTL octet " << (start-pos) diff --git a/src/time.cc b/src/time.cc index 064e514be3..f1ef387be4 100644 --- a/src/time.cc +++ b/src/time.cc @@ -58,7 +58,7 @@ tvSubMsec(struct timeval t1, struct timeval t2) { return (t2.tv_sec - t1.tv_sec) * 1000 + (t2.tv_usec - t1.tv_usec) / 1000; -} +} TimeEngine::~TimeEngine() {}