]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
SourceFormat Enforcement
authorAutomatic source maintenance <squidadm@squid-cache.org>
Tue, 2 Nov 2010 00:12:43 +0000 (18:12 -0600)
committerAutomatic source maintenance <squidadm@squid-cache.org>
Tue, 2 Nov 2010 00:12:43 +0000 (18:12 -0600)
compat/xalloc.cc
compat/xalloc.h
compat/xstring.h
include/base64.h
include/rfc1123.h
include/rfc1738.h
include/rfc2617.h
lib/profiler/Profiler.h
src/HttpHeaderTools.cc
src/time.cc

index ee04da3697b26241f79279ea14ef246fff984fd0..c1e59773c617db1b55f936d946c7b6aa3611f0e5 100644 (file)
@@ -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
index 084c5225227a54f18682d3b9604c97a4c1c95c00..fd9260145924436651b69f5a97fae33464d35a0a 100644 (file)
@@ -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
index 4c8d71ad60317ab11b6647593e6b8dc2eb22cce1..c5248bda8a50092cde686189af89fdcbdfb48b90 100644 (file)
@@ -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
index 82766109ddc78cc655e87654a0c1cd7be7fe2b04..354a0687fd705922a5c1ed87011fbf34766103d9 100644 (file)
@@ -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
 }
index 04f0b56eef213869af5396534236de6a325fcf3a..bfeac4bd8d45d5d19a736ae55299790fc5458876 100644 (file)
@@ -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
 }
index 7189bb98afb2f05cf7483f5536add28b060cdb3d..2d7b9a4b7934827e12ccb32f6757f2fd5eaf3636 100644 (file)
@@ -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
 }
index fcb79ed37b087b4342cee78822c95f3861d02310..dd704faa2ef3b99b326e65c165b8f3709a1eb172 100644 (file)
@@ -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
 }
index d59abc3817e0e63c77d0fbed18d14cb8c7cfe26b..8e57feb2c0d52a83d14bfb7bd61e0114702bc4ee 100644 (file)
@@ -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)
index 5ef08389f9991832261ea5b06c24e78992545a39..8d7ba32709e88b2530f04198518e410163f69c3e 100644 (file)
@@ -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)
index 064e514be3dbbd51d7f738e32b9b3eb9f7d53a5a..f1ef387be413f4029e2d4a7c637741607e2bbea0 100644 (file)
@@ -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()
 {}