trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [06/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source
Date Mon, 23 Mar 2015 20:32:39 GMT
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_res_mkquery.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_res_mkquery.cc b/lib/ts/ink_res_mkquery.cc
index b992eb5..1101628 100644
--- a/lib/ts/ink_res_mkquery.cc
+++ b/lib/ts/ink_res_mkquery.cc
@@ -65,7 +65,6 @@
  */
 
 
-
 #include "ink_config.h"
 #include "ink_defs.h"
 
@@ -90,95 +89,91 @@
  * Form all types of queries.
  * Returns the size of the result or -1.
  */
-int
-ink_res_mkquery(ink_res_state statp,
-	     int op,			/*!< opcode of query  */
-	     const char *dname,		/*!< domain name  */
-	     int _class, int type,	/*!< _class and type of query  */
-	     const u_char *data,	/*!< resource record data  */
-	     int datalen,		/*!< length of data  */
-             const u_char */* newrr_in  ATS_UNUSED */,	/*!< new rr for modify or append  */
-	     u_char *buf,		/*!< buffer to put query  */
-	     int buflen)		/*!< size of buffer  */
+int ink_res_mkquery(ink_res_state statp, int op,               /*!< opcode of query  */
+                    const char *dname,                         /*!< domain name  */
+                    int _class, int type,                      /*!< _class and type of query  */
+                    const u_char *data,                        /*!< resource record data  */
+                    int datalen,                               /*!< length of data  */
+                    const u_char * /* newrr_in  ATS_UNUSED */, /*!< new rr for modify or append  */
+                    u_char *buf,                               /*!< buffer to put query  */
+                    int buflen)                                /*!< size of buffer  */
 {
-	HEADER *hp;
-	u_char *cp, *ep;
-	int n;
-	u_char *dnptrs[20], **dpp, **lastdnptr;
-
-	/*
-	 * Initialize header fields.
-	 */
-	if ((buf == NULL) || (buflen < HFIXEDSZ))
-		return (-1);
-	memset(buf, 0, HFIXEDSZ);
-	hp = (HEADER *) buf;
-	hp->id = htons(++statp->id);
-	hp->opcode = op;
-	hp->rd = (statp->options & INK_RES_RECURSE) != 0U;
-	hp->rcode = NOERROR;
-	cp = buf + HFIXEDSZ;
-	ep = buf + buflen;
-	dpp = dnptrs;
-	*dpp++ = buf;
-	*dpp++ = NULL;
-	lastdnptr = dnptrs + sizeof dnptrs / sizeof dnptrs[0];
-	/*
-	 * perform opcode specific processing
-	 */
-	switch (op) {
-	case QUERY:	/*FALLTHROUGH*/
-	case NS_NOTIFY_OP:
-		if (ep - cp < QFIXEDSZ)
-			return (-1);
-		if ((n = dn_comp(dname, cp, ep - cp - QFIXEDSZ, dnptrs,
-		    lastdnptr)) < 0)
-			return (-1);
-		cp += n;
-		NS_PUT16(type, cp);
-		NS_PUT16(_class, cp);
-		hp->qdcount = htons(1);
-		if (op == QUERY || data == NULL)
-			break;
-		/*
-		 * Make an additional record for completion domain.
-		 */
-		if ((ep - cp) < RRFIXEDSZ)
-			return (-1);
-		n = dn_comp((const char *)data, cp, ep - cp - RRFIXEDSZ,
-			    dnptrs, lastdnptr);
-		if (n < 0)
-			return (-1);
-		cp += n;
-		NS_PUT16(T_NULL, cp);
-		NS_PUT16(_class, cp);
-		NS_PUT32(0, cp);
-		NS_PUT16(0, cp);
-		hp->arcount = htons(1);
-		break;
-
-	case IQUERY:
-		/*
-		 * Initialize answer section
-		 */
-		if (ep - cp < 1 + RRFIXEDSZ + datalen)
-			return (-1);
-		*cp++ = '\0';	/*%< no domain name */
-		NS_PUT16(type, cp);
-		NS_PUT16(_class, cp);
-		NS_PUT32(0, cp);
-		NS_PUT16(datalen, cp);
-		if (datalen) {
-			memcpy(cp, data, datalen);
-			cp += datalen;
-		}
-		hp->ancount = htons(1);
-		break;
-
-	default:
-		return (-1);
-	}
-	return (cp - buf);
+  HEADER *hp;
+  u_char *cp, *ep;
+  int n;
+  u_char *dnptrs[20], **dpp, **lastdnptr;
+
+  /*
+   * Initialize header fields.
+   */
+  if ((buf == NULL) || (buflen < HFIXEDSZ))
+    return (-1);
+  memset(buf, 0, HFIXEDSZ);
+  hp = (HEADER *)buf;
+  hp->id = htons(++statp->id);
+  hp->opcode = op;
+  hp->rd = (statp->options & INK_RES_RECURSE) != 0U;
+  hp->rcode = NOERROR;
+  cp = buf + HFIXEDSZ;
+  ep = buf + buflen;
+  dpp = dnptrs;
+  *dpp++ = buf;
+  *dpp++ = NULL;
+  lastdnptr = dnptrs + sizeof dnptrs / sizeof dnptrs[0];
+  /*
+   * perform opcode specific processing
+   */
+  switch (op) {
+  case QUERY: /*FALLTHROUGH*/
+  case NS_NOTIFY_OP:
+    if (ep - cp < QFIXEDSZ)
+      return (-1);
+    if ((n = dn_comp(dname, cp, ep - cp - QFIXEDSZ, dnptrs, lastdnptr)) < 0)
+      return (-1);
+    cp += n;
+    NS_PUT16(type, cp);
+    NS_PUT16(_class, cp);
+    hp->qdcount = htons(1);
+    if (op == QUERY || data == NULL)
+      break;
+    /*
+     * Make an additional record for completion domain.
+     */
+    if ((ep - cp) < RRFIXEDSZ)
+      return (-1);
+    n = dn_comp((const char *)data, cp, ep - cp - RRFIXEDSZ, dnptrs, lastdnptr);
+    if (n < 0)
+      return (-1);
+    cp += n;
+    NS_PUT16(T_NULL, cp);
+    NS_PUT16(_class, cp);
+    NS_PUT32(0, cp);
+    NS_PUT16(0, cp);
+    hp->arcount = htons(1);
+    break;
+
+  case IQUERY:
+    /*
+     * Initialize answer section
+     */
+    if (ep - cp < 1 + RRFIXEDSZ + datalen)
+      return (-1);
+    *cp++ = '\0'; /*%< no domain name */
+    NS_PUT16(type, cp);
+    NS_PUT16(_class, cp);
+    NS_PUT32(0, cp);
+    NS_PUT16(datalen, cp);
+    if (datalen) {
+      memcpy(cp, data, datalen);
+      cp += datalen;
+    }
+    hp->ancount = htons(1);
+    break;
+
+  default:
+    return (-1);
+  }
+  return (cp - buf);
 }
 
 /* Public. */
@@ -191,80 +186,80 @@ ink_res_mkquery(ink_res_state statp,
  *\li	boolean.
  */
 static int
-printable(int ch) {
-	return (ch > 0x20 && ch < 0x7f);
+printable(int ch)
+{
+  return (ch > 0x20 && ch < 0x7f);
 }
 
-static const char	digits[] = "0123456789";
+static const char digits[] = "0123456789";
 
 static int
 labellen(const u_char *lp)
 {
-	int bitlen;
-	u_char l = *lp;
-
-	if ((l & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
-		/* should be avoided by the caller */
-		return(-1);
-	}
-
-	if ((l & NS_CMPRSFLGS) == INK_NS_TYPE_ELT) {
-		if (l == INK_DNS_LABELTYPE_BITSTRING) {
-			if ((bitlen = *(lp + 1)) == 0)
-				bitlen = 256;
-			return((bitlen + 7 ) / 8 + 1);
-		}
-		return(-1);	/*%< unknwon ELT */
-	}
-	return(l);
+  int bitlen;
+  u_char l = *lp;
+
+  if ((l & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
+    /* should be avoided by the caller */
+    return (-1);
+  }
+
+  if ((l & NS_CMPRSFLGS) == INK_NS_TYPE_ELT) {
+    if (l == INK_DNS_LABELTYPE_BITSTRING) {
+      if ((bitlen = *(lp + 1)) == 0)
+        bitlen = 256;
+      return ((bitlen + 7) / 8 + 1);
+    }
+    return (-1); /*%< unknwon ELT */
+  }
+  return (l);
 }
 
 static int
 decode_bitstring(const unsigned char **cpp, char *dn, const char *eom)
 {
-	const unsigned char *cp = *cpp;
-	char *beg = dn, tc;
-	int b, blen, plen, i;
-
-	if ((blen = (*cp & 0xff)) == 0)
-		blen = 256;
-	plen = (blen + 3) / 4;
-	plen += sizeof("\\[x/]") + (blen > 99 ? 3 : (blen > 9) ? 2 : 1);
-	if (dn + plen >= eom)
-		return(-1);
-
-	cp++;
-	i = SPRINTF((dn, "\\[x"));
-	if (i < 0)
-		return (-1);
-	dn += i;
-	for (b = blen; b > 7; b -= 8, cp++) {
-		i = SPRINTF((dn, "%02x", *cp & 0xff));
-		if (i < 0)
-			return (-1);
-		dn += i;
-	}
-	if (b > 4) {
-		tc = *cp++;
-		i = SPRINTF((dn, "%02x", tc & (0xff << (8 - b))));
-		if (i < 0)
-			return (-1);
-		dn += i;
-	} else if (b > 0) {
-		tc = *cp++;
-		i = SPRINTF((dn, "%1x",
-			       ((tc >> 4) & 0x0f) & (0x0f << (4 - b))));
-		if (i < 0)
-			return (-1);
-		dn += i;
-	}
-	i = SPRINTF((dn, "/%d]", blen));
-	if (i < 0)
-		return (-1);
-	dn += i;
-
-	*cpp = cp;
-	return(dn - beg);
+  const unsigned char *cp = *cpp;
+  char *beg = dn, tc;
+  int b, blen, plen, i;
+
+  if ((blen = (*cp & 0xff)) == 0)
+    blen = 256;
+  plen = (blen + 3) / 4;
+  plen += sizeof("\\[x/]") + (blen > 99 ? 3 : (blen > 9) ? 2 : 1);
+  if (dn + plen >= eom)
+    return (-1);
+
+  cp++;
+  i = SPRINTF((dn, "\\[x"));
+  if (i < 0)
+    return (-1);
+  dn += i;
+  for (b = blen; b > 7; b -= 8, cp++) {
+    i = SPRINTF((dn, "%02x", *cp & 0xff));
+    if (i < 0)
+      return (-1);
+    dn += i;
+  }
+  if (b > 4) {
+    tc = *cp++;
+    i = SPRINTF((dn, "%02x", tc & (0xff << (8 - b))));
+    if (i < 0)
+      return (-1);
+    dn += i;
+  } else if (b > 0) {
+    tc = *cp++;
+    i = SPRINTF((dn, "%1x", ((tc >> 4) & 0x0f) & (0x0f << (4 - b))));
+    if (i < 0)
+      return (-1);
+    dn += i;
+  }
+  i = SPRINTF((dn, "/%d]", blen));
+  if (i < 0)
+    return (-1);
+  dn += i;
+
+  *cpp = cp;
+  return (dn - beg);
 }
 
 /*%
@@ -275,21 +270,22 @@ decode_bitstring(const unsigned char **cpp, char *dn, const char *eom)
  *\li	boolean.
  */
 static int
-special(int ch) {
-	switch (ch) {
-	case 0x22: /*%< '"' */
-	case 0x2E: /*%< '.' */
-	case 0x3B: /*%< ';' */
-	case 0x5C: /*%< '\\' */
-	case 0x28: /*%< '(' */
-	case 0x29: /*%< ')' */
-	/* Special modifiers in zone files. */
-	case 0x40: /*%< '@' */
-	case 0x24: /*%< '$' */
-		return (1);
-	default:
-		return (0);
-	}
+special(int ch)
+{
+  switch (ch) {
+  case 0x22: /*%< '"' */
+  case 0x2E: /*%< '.' */
+  case 0x3B: /*%< ';' */
+  case 0x5C: /*%< '\\' */
+  case 0x28: /*%< '(' */
+  case 0x29: /*%< ')' */
+  /* Special modifiers in zone files. */
+  case 0x40: /*%< '@' */
+  case 0x24: /*%< '$' */
+    return (1);
+  default:
+    return (0);
+  }
 }
 
 /*%
@@ -305,93 +301,92 @@ special(int ch) {
 int
 ink_ns_name_ntop(const u_char *src, char *dst, size_t dstsiz)
 {
-	const u_char *cp;
-	char *dn, *eom;
-	u_char c;
-	unsigned n;
-	int l;
-
-	cp = src;
-	dn = dst;
-	eom = dst + dstsiz;
-
-	while ((n = *cp++) != 0) {
-		if ((n & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
-			/* Some kind of compression pointer. */
-			errno = EMSGSIZE;
-			return (-1);
-		}
-		if (dn != dst) {
-			if (dn >= eom) {
-				errno = EMSGSIZE;
-				return (-1);
-			}
-			*dn++ = '.';
-		}
-		if ((l = labellen(cp - 1)) < 0) {
-			errno = EMSGSIZE; /*%< XXX */
-			return(-1);
-		}
-		if (dn + l >= eom) {
-			errno = EMSGSIZE;
-			return (-1);
-		}
-		if ((n & NS_CMPRSFLGS) == INK_NS_TYPE_ELT) {
-			int m;
-
-			if (n != INK_DNS_LABELTYPE_BITSTRING) {
-				/* XXX: labellen should reject this case */
-				errno = EINVAL;
-				return(-1);
-			}
-			if ((m = decode_bitstring(&cp, dn, eom)) < 0)
-			{
-				errno = EMSGSIZE;
-				return(-1);
-			}
-			dn += m;
-			continue;
-		}
-		for ((void)NULL; l > 0; l--) {
-			c = *cp++;
-			if (special(c)) {
-				if (dn + 1 >= eom) {
-					errno = EMSGSIZE;
-					return (-1);
-				}
-				*dn++ = '\\';
-				*dn++ = (char)c;
-			} else if (!printable(c)) {
-				if (dn + 3 >= eom) {
-					errno = EMSGSIZE;
-					return (-1);
-				}
-				*dn++ = '\\';
-				*dn++ = digits[c / 100];
-				*dn++ = digits[(c % 100) / 10];
-				*dn++ = digits[c % 10];
-			} else {
-				if (dn >= eom) {
-					errno = EMSGSIZE;
-					return (-1);
-				}
-				*dn++ = (char)c;
-			}
-		}
-	}
-	if (dn == dst) {
-		if (dn >= eom) {
-			errno = EMSGSIZE;
-			return (-1);
-		}
-		*dn++ = '.';
-	}
-	if (dn >= eom) {
-		errno = EMSGSIZE;
-		return (-1);
-	}
-	*dn++ = '\0';
-	return (dn - dst);
+  const u_char *cp;
+  char *dn, *eom;
+  u_char c;
+  unsigned n;
+  int l;
+
+  cp = src;
+  dn = dst;
+  eom = dst + dstsiz;
+
+  while ((n = *cp++) != 0) {
+    if ((n & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
+      /* Some kind of compression pointer. */
+      errno = EMSGSIZE;
+      return (-1);
+    }
+    if (dn != dst) {
+      if (dn >= eom) {
+        errno = EMSGSIZE;
+        return (-1);
+      }
+      *dn++ = '.';
+    }
+    if ((l = labellen(cp - 1)) < 0) {
+      errno = EMSGSIZE; /*%< XXX */
+      return (-1);
+    }
+    if (dn + l >= eom) {
+      errno = EMSGSIZE;
+      return (-1);
+    }
+    if ((n & NS_CMPRSFLGS) == INK_NS_TYPE_ELT) {
+      int m;
+
+      if (n != INK_DNS_LABELTYPE_BITSTRING) {
+        /* XXX: labellen should reject this case */
+        errno = EINVAL;
+        return (-1);
+      }
+      if ((m = decode_bitstring(&cp, dn, eom)) < 0) {
+        errno = EMSGSIZE;
+        return (-1);
+      }
+      dn += m;
+      continue;
+    }
+    for ((void)NULL; l > 0; l--) {
+      c = *cp++;
+      if (special(c)) {
+        if (dn + 1 >= eom) {
+          errno = EMSGSIZE;
+          return (-1);
+        }
+        *dn++ = '\\';
+        *dn++ = (char)c;
+      } else if (!printable(c)) {
+        if (dn + 3 >= eom) {
+          errno = EMSGSIZE;
+          return (-1);
+        }
+        *dn++ = '\\';
+        *dn++ = digits[c / 100];
+        *dn++ = digits[(c % 100) / 10];
+        *dn++ = digits[c % 10];
+      } else {
+        if (dn >= eom) {
+          errno = EMSGSIZE;
+          return (-1);
+        }
+        *dn++ = (char)c;
+      }
+    }
+  }
+  if (dn == dst) {
+    if (dn >= eom) {
+      errno = EMSGSIZE;
+      return (-1);
+    }
+    *dn++ = '.';
+  }
+  if (dn >= eom) {
+    errno = EMSGSIZE;
+    return (-1);
+  }
+  *dn++ = '\0';
+  return (dn - dst);
 }
 
 /*%
@@ -412,93 +407,92 @@ int
 ns_name_ntop(const u_char *src, char *dst, size_t dstsiz)
 #endif
 {
-	const u_char *cp;
-	char *dn, *eom;
-	u_char c;
-	unsigned n;
-	int l;
-
-	cp = src;
-	dn = dst;
-	eom = dst + dstsiz;
-
-	while ((n = *cp++) != 0) {
-		if ((n & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
-			/* Some kind of compression pointer. */
-			errno = EMSGSIZE;
-			return (-1);
-		}
-		if (dn != dst) {
-			if (dn >= eom) {
-				errno = EMSGSIZE;
-				return (-1);
-			}
-			*dn++ = '.';
-		}
-		if ((l = labellen(cp - 1)) < 0) {
-			errno = EMSGSIZE; /*%< XXX */
-			return(-1);
-		}
-		if (dn + l >= eom) {
-			errno = EMSGSIZE;
-			return (-1);
-		}
-		if ((n & NS_CMPRSFLGS) == INK_NS_TYPE_ELT) {
-			int m;
-
-			if (n != INK_DNS_LABELTYPE_BITSTRING) {
-				/* XXX: labellen should reject this case */
-				errno = EINVAL;
-				return(-1);
-			}
-			if ((m = decode_bitstring(&cp, dn, eom)) < 0)
-			{
-				errno = EMSGSIZE;
-				return(-1);
-			}
-			dn += m;
-			continue;
-		}
-		for ((void)NULL; l > 0; l--) {
-			c = *cp++;
-			if (special(c)) {
-				if (dn + 1 >= eom) {
-					errno = EMSGSIZE;
-					return (-1);
-				}
-				*dn++ = '\\';
-				*dn++ = (char)c;
-			} else if (!printable(c)) {
-				if (dn + 3 >= eom) {
-					errno = EMSGSIZE;
-					return (-1);
-				}
-				*dn++ = '\\';
-				*dn++ = digits[c / 100];
-				*dn++ = digits[(c % 100) / 10];
-				*dn++ = digits[c % 10];
-			} else {
-				if (dn >= eom) {
-					errno = EMSGSIZE;
-					return (-1);
-				}
-				*dn++ = (char)c;
-			}
-		}
-	}
-	if (dn == dst) {
-		if (dn >= eom) {
-			errno = EMSGSIZE;
-			return (-1);
-		}
-		*dn++ = '.';
-	}
-	if (dn >= eom) {
-		errno = EMSGSIZE;
-		return (-1);
-	}
-	*dn++ = '\0';
-	return (dn - dst);
+  const u_char *cp;
+  char *dn, *eom;
+  u_char c;
+  unsigned n;
+  int l;
+
+  cp = src;
+  dn = dst;
+  eom = dst + dstsiz;
+
+  while ((n = *cp++) != 0) {
+    if ((n & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
+      /* Some kind of compression pointer. */
+      errno = EMSGSIZE;
+      return (-1);
+    }
+    if (dn != dst) {
+      if (dn >= eom) {
+        errno = EMSGSIZE;
+        return (-1);
+      }
+      *dn++ = '.';
+    }
+    if ((l = labellen(cp - 1)) < 0) {
+      errno = EMSGSIZE; /*%< XXX */
+      return (-1);
+    }
+    if (dn + l >= eom) {
+      errno = EMSGSIZE;
+      return (-1);
+    }
+    if ((n & NS_CMPRSFLGS) == INK_NS_TYPE_ELT) {
+      int m;
+
+      if (n != INK_DNS_LABELTYPE_BITSTRING) {
+        /* XXX: labellen should reject this case */
+        errno = EINVAL;
+        return (-1);
+      }
+      if ((m = decode_bitstring(&cp, dn, eom)) < 0) {
+        errno = EMSGSIZE;
+        return (-1);
+      }
+      dn += m;
+      continue;
+    }
+    for ((void)NULL; l > 0; l--) {
+      c = *cp++;
+      if (special(c)) {
+        if (dn + 1 >= eom) {
+          errno = EMSGSIZE;
+          return (-1);
+        }
+        *dn++ = '\\';
+        *dn++ = (char)c;
+      } else if (!printable(c)) {
+        if (dn + 3 >= eom) {
+          errno = EMSGSIZE;
+          return (-1);
+        }
+        *dn++ = '\\';
+        *dn++ = digits[c / 100];
+        *dn++ = digits[(c % 100) / 10];
+        *dn++ = digits[c % 10];
+      } else {
+        if (dn >= eom) {
+          errno = EMSGSIZE;
+          return (-1);
+        }
+        *dn++ = (char)c;
+      }
+    }
+  }
+  if (dn == dst) {
+    if (dn >= eom) {
+      errno = EMSGSIZE;
+      return (-1);
+    }
+    *dn++ = '.';
+  }
+  if (dn >= eom) {
+    errno = EMSGSIZE;
+    return (-1);
+  }
+  *dn++ = '\0';
+  return (dn - dst);
 }
 
 HostResStyle
@@ -507,26 +501,33 @@ ats_host_res_from(int family, HostResPreferenceOrder order)
   bool v4 = false, v6 = false;
   HostResPreference client = AF_INET6 == family ? HOST_RES_PREFER_IPV6 : HOST_RES_PREFER_IPV4;
 
-  for ( int i = 0 ; i < N_HOST_RES_PREFERENCE_ORDER ; ++i ) {
+  for (int i = 0; i < N_HOST_RES_PREFERENCE_ORDER; ++i) {
     HostResPreference p = order[i];
-    if (HOST_RES_PREFER_CLIENT == p) p = client; // CLIENT -> actual value
+    if (HOST_RES_PREFER_CLIENT == p)
+      p = client; // CLIENT -> actual value
     if (HOST_RES_PREFER_IPV4 == p) {
-      if (v6) return HOST_RES_IPV6;
-      else v4 = true;
+      if (v6)
+        return HOST_RES_IPV6;
+      else
+        v4 = true;
     } else if (HOST_RES_PREFER_IPV6 == p) {
-      if (v4) return HOST_RES_IPV4;
-      else v6 = true;
+      if (v4)
+        return HOST_RES_IPV4;
+      else
+        v6 = true;
     } else {
       break;
     }
   }
-  if (v4) return HOST_RES_IPV4_ONLY;
-  else if (v6) return HOST_RES_IPV6_ONLY;
+  if (v4)
+    return HOST_RES_IPV4_ONLY;
+  else if (v6)
+    return HOST_RES_IPV6_ONLY;
   return HOST_RES_NONE;
 }
 
 HostResStyle
-ats_host_res_match(sockaddr const* addr)
+ats_host_res_match(sockaddr const *addr)
 {
   HostResStyle zret = HOST_RES_NONE;
   if (ats_is_ip6(addr))

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_resolver.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_resolver.h b/lib/ts/ink_resolver.h
index a561797..00bf5b2 100644
--- a/lib/ts/ink_resolver.h
+++ b/lib/ts/ink_resolver.h
@@ -67,7 +67,7 @@
 */
 
 #ifndef _ink_resolver_h_
-#define	_ink_resolver_h_
+#define _ink_resolver_h_
 
 #include "ink_platform.h"
 #include <ts/ink_inet.h>
@@ -75,86 +75,85 @@
 #include <arpa/nameser.h>
 
 #if defined(openbsd)
-#define NS_INT16SZ          INT16SZ
-#define NS_INT32SZ          INT32SZ
-#define NS_CMPRSFLGS        INDIR_MASK
-#define NS_GET16            GETSHORT
-#define NS_GET32            GETLONG
-#define NS_PUT16            PUTSHORT
-#define NS_PUT32            PUTLONG
+#define NS_INT16SZ INT16SZ
+#define NS_INT32SZ INT32SZ
+#define NS_CMPRSFLGS INDIR_MASK
+#define NS_GET16 GETSHORT
+#define NS_GET32 GETLONG
+#define NS_PUT16 PUTSHORT
+#define NS_PUT32 PUTLONG
 #endif
 
-#define INK_RES_F_VC        0x00000001      /*%< socket is TCP */
-#define INK_RES_F_CONN      0x00000002      /*%< socket is connected */
-#define INK_RES_F_EDNS0ERR  0x00000004      /*%< EDNS0 caused errors */
-#define INK_RES_F__UNUSED   0x00000008      /*%< (unused) */
-#define INK_RES_F_LASTMASK  0x000000F0      /*%< ordinal server of last res_nsend */
-#define INK_RES_F_LASTSHIFT 4               /*%< bit position of LASTMASK "flag" */
+#define INK_RES_F_VC 0x00000001       /*%< socket is TCP */
+#define INK_RES_F_CONN 0x00000002     /*%< socket is connected */
+#define INK_RES_F_EDNS0ERR 0x00000004 /*%< EDNS0 caused errors */
+#define INK_RES_F__UNUSED 0x00000008  /*%< (unused) */
+#define INK_RES_F_LASTMASK 0x000000F0 /*%< ordinal server of last res_nsend */
+#define INK_RES_F_LASTSHIFT 4         /*%< bit position of LASTMASK "flag" */
 #define INK_RES_GETLAST(res) (((res)._flags & INK_RES_F_LASTMASK) >> INK_RES_F_LASTSHIFT)
 
 /* res_findzonecut2() options */
-#define INK_RES_EXHAUSTIVE  0x00000001      /*%< always do all queries */
-#define INK_RES_IPV4ONLY    0x00000002      /*%< IPv4 only */
-#define INK_RES_IPV6ONLY    0x00000004      /*%< IPv6 only */
+#define INK_RES_EXHAUSTIVE 0x00000001 /*%< always do all queries */
+#define INK_RES_IPV4ONLY 0x00000002   /*%< IPv4 only */
+#define INK_RES_IPV6ONLY 0x00000004   /*%< IPv6 only */
 
 /*%
  *  * Resolver options (keep these in synch with res_debug.c, please)
  [amc] Most of these are never used. AFAICT it's RECURSE and DEBUG only.
  *   */
-#define INK_RES_INIT        0x00000001      /*%< address initialized */
-#define INK_RES_DEBUG       0x00000002      /*%< print debug messages */
-#define INK_RES_AAONLY      0x00000004      /*%< authoritative answers only (!IMPL)*/
-#define INK_RES_USEVC       0x00000008      /*%< use virtual circuit */
-#define INK_RES_PRIMARY     0x00000010      /*%< query primary server only (!IMPL) */
-#define INK_RES_IGNTC       0x00000020      /*%< ignore trucation errors */
-#define INK_RES_RECURSE     0x00000040      /*%< recursion desired */
-#define INK_RES_DEFNAMES    0x00000080      /*%< use default domain name */
-#define INK_RES_STAYOPEN    0x00000100      /*%< Keep TCP socket open */
-#define INK_RES_DNSRCH      0x00000200      /*%< search up local domain tree */
-#define INK_RES_INSECURE1   0x00000400      /*%< type 1 security disabled */
-#define INK_RES_INSECURE2   0x00000800      /*%< type 2 security disabled */
-#define INK_RES_NOALIASES   0x00001000      /*%< shuts off HOSTALIASES feature */
-#define INK_RES_USE_INET6   0x00002000      /*%< use/map IPv6 in gethostbyname() */
-#define INK_RES_ROTATE      0x00004000      /*%< rotate ns list after each query */
-#define INK_RES_NOCHECKNAME 0x00008000      /*%< do not check names for sanity. */
-#define INK_RES_KEEPTSIG    0x00010000      /*%< do not strip TSIG records */
-#define INK_RES_BLAST       0x00020000      /*%< blast all recursive servers */
-#define INK_RES_NSID        0x00040000      /*%< request name server ID */
-#define INK_RES_NOTLDQUERY  0x00100000      /*%< don't unqualified name as a tld */
-#define INK_RES_USE_DNSSEC  0x00200000      /*%< use DNSSEC using OK bit in OPT */
-/* #define INK_RES_DEBUG2   0x00400000 */   /* nslookup internal */
+#define INK_RES_INIT 0x00000001           /*%< address initialized */
+#define INK_RES_DEBUG 0x00000002          /*%< print debug messages */
+#define INK_RES_AAONLY 0x00000004         /*%< authoritative answers only (!IMPL)*/
+#define INK_RES_USEVC 0x00000008          /*%< use virtual circuit */
+#define INK_RES_PRIMARY 0x00000010        /*%< query primary server only (!IMPL) */
+#define INK_RES_IGNTC 0x00000020          /*%< ignore trucation errors */
+#define INK_RES_RECURSE 0x00000040        /*%< recursion desired */
+#define INK_RES_DEFNAMES 0x00000080       /*%< use default domain name */
+#define INK_RES_STAYOPEN 0x00000100       /*%< Keep TCP socket open */
+#define INK_RES_DNSRCH 0x00000200         /*%< search up local domain tree */
+#define INK_RES_INSECURE1 0x00000400      /*%< type 1 security disabled */
+#define INK_RES_INSECURE2 0x00000800      /*%< type 2 security disabled */
+#define INK_RES_NOALIASES 0x00001000      /*%< shuts off HOSTALIASES feature */
+#define INK_RES_USE_INET6 0x00002000      /*%< use/map IPv6 in gethostbyname() */
+#define INK_RES_ROTATE 0x00004000         /*%< rotate ns list after each query */
+#define INK_RES_NOCHECKNAME 0x00008000    /*%< do not check names for sanity. */
+#define INK_RES_KEEPTSIG 0x00010000       /*%< do not strip TSIG records */
+#define INK_RES_BLAST 0x00020000          /*%< blast all recursive servers */
+#define INK_RES_NSID 0x00040000           /*%< request name server ID */
+#define INK_RES_NOTLDQUERY 0x00100000     /*%< don't unqualified name as a tld */
+#define INK_RES_USE_DNSSEC 0x00200000     /*%< use DNSSEC using OK bit in OPT */
+/* #define INK_RES_DEBUG2   0x00400000 */ /* nslookup internal */
 /* KAME extensions: use higher bit to avoid conflict with ISC use */
-#define INK_RES_USE_DNAME   0x10000000      /*%< use DNAME */
-#define INK_RES_USE_EDNS0   0x40000000      /*%< use EDNS0 if configured */
-
-#define INK_RES_DEFAULT     (INK_RES_RECURSE | INK_RES_DEFNAMES | \
-                         INK_RES_DNSRCH)
-
-#define INK_MAXNS                   32      /*%< max # name servers we'll track */
-#define INK_MAXDFLSRCH              3       /*%< # default domain levels to try */
-#define INK_MAXDNSRCH               6       /*%< max # domains in search path */
-#define INK_LOCALDOMAINPARTS        2       /*%< min levels in name that is "local" */
-#define INK_RES_TIMEOUT             5       /*%< min. seconds between retries */
-#define INK_RES_TIMEOUT             5       /*%< min. seconds between retries */
-#define INK_RES_MAXNDOTS            15      /*%< should reflect bit field size */
-#define INK_RES_MAXRETRANS          30      /*%< only for resolv.conf/RES_OPTIONS */
-#define INK_RES_MAXRETRY            5       /*%< only for resolv.conf/RES_OPTIONS */
-#define INK_RES_DFLRETRY            2       /*%< Default #/tries. */
-#define INK_RES_MAXTIME             65535   /*%< Infinity, in milliseconds. */
-
-#define INK_NS_TYPE_ELT  0x40 /*%< EDNS0 extended label type */
+#define INK_RES_USE_DNAME 0x10000000 /*%< use DNAME */
+#define INK_RES_USE_EDNS0 0x40000000 /*%< use EDNS0 if configured */
+
+#define INK_RES_DEFAULT (INK_RES_RECURSE | INK_RES_DEFNAMES | INK_RES_DNSRCH)
+
+#define INK_MAXNS 32           /*%< max # name servers we'll track */
+#define INK_MAXDFLSRCH 3       /*%< # default domain levels to try */
+#define INK_MAXDNSRCH 6        /*%< max # domains in search path */
+#define INK_LOCALDOMAINPARTS 2 /*%< min levels in name that is "local" */
+#define INK_RES_TIMEOUT 5      /*%< min. seconds between retries */
+#define INK_RES_TIMEOUT 5      /*%< min. seconds between retries */
+#define INK_RES_MAXNDOTS 15    /*%< should reflect bit field size */
+#define INK_RES_MAXRETRANS 30  /*%< only for resolv.conf/RES_OPTIONS */
+#define INK_RES_MAXRETRY 5     /*%< only for resolv.conf/RES_OPTIONS */
+#define INK_RES_DFLRETRY 2     /*%< Default #/tries. */
+#define INK_RES_MAXTIME 65535  /*%< Infinity, in milliseconds. */
+
+#define INK_NS_TYPE_ELT 0x40 /*%< EDNS0 extended label type */
 #define INK_DNS_LABELTYPE_BITSTRING 0x41
 
 /// IP family preference for DNS resolution.
 /// Used for configuration.
 enum HostResPreference {
   HOST_RES_PREFER_NONE = 0, ///< Invalid / init value.
-  HOST_RES_PREFER_CLIENT, ///< Prefer family of client connection.
-  HOST_RES_PREFER_IPV4, ///< Prefer IPv4.
-  HOST_RES_PREFER_IPV6  ///< Prefer IPv6
+  HOST_RES_PREFER_CLIENT,   ///< Prefer family of client connection.
+  HOST_RES_PREFER_IPV4,     ///< Prefer IPv4.
+  HOST_RES_PREFER_IPV6      ///< Prefer IPv6
 };
 /// # of preference values.
-static int const N_HOST_RES_PREFERENCE = HOST_RES_PREFER_IPV6+1;
+static int const N_HOST_RES_PREFERENCE = HOST_RES_PREFER_IPV6 + 1;
 /// # of entries in a preference ordering.
 static int const N_HOST_RES_PREFERENCE_ORDER = 3;
 /// Storage for preference ordering.
@@ -164,126 +163,113 @@ extern HostResPreferenceOrder const HOST_RES_DEFAULT_PREFERENCE_ORDER;
 /// Global (configurable) default.
 extern HostResPreferenceOrder host_res_default_preference_order;
 /// String versions of @c FamilyPreference
-extern char const* const HOST_RES_PREFERENCE_STRING[N_HOST_RES_PREFERENCE];
+extern char const *const HOST_RES_PREFERENCE_STRING[N_HOST_RES_PREFERENCE];
 
 /// IP family to use in a DNS query for a host address.
 /// Used during DNS query operations.
-enum HostResStyle{
-  HOST_RES_NONE = 0, ///< No preference / unspecified / init value.
-  HOST_RES_IPV4, ///< Use IPv4 if possible.
+enum HostResStyle {
+  HOST_RES_NONE = 0,  ///< No preference / unspecified / init value.
+  HOST_RES_IPV4,      ///< Use IPv4 if possible.
   HOST_RES_IPV4_ONLY, ///< Resolve on IPv4 addresses.
-  HOST_RES_IPV6, ///< Use IPv6 if possible.
-  HOST_RES_IPV6_ONLY ///< Resolve only IPv6 addresses.
+  HOST_RES_IPV6,      ///< Use IPv6 if possible.
+  HOST_RES_IPV6_ONLY  ///< Resolve only IPv6 addresses.
 };
 
 /// Strings for host resolution styles
-extern char const* const HOST_RES_STYLE_STRING[];
+extern char const *const HOST_RES_STYLE_STRING[];
 
 /// Caclulate the effective resolution preferences.
-extern HostResStyle
-ats_host_res_from(
-		   int family, ///< Connection family
-		   HostResPreferenceOrder ///< Preference ordering.
-		   );
+extern HostResStyle ats_host_res_from(int family,            ///< Connection family
+                                      HostResPreferenceOrder ///< Preference ordering.
+                                      );
 /// Calculate the host resolution style to force a family match to @a addr.
-extern HostResStyle
-ats_host_res_match(sockaddr const* addr);
+extern HostResStyle ats_host_res_match(sockaddr const *addr);
 
 /** Parse a host resolution configuration string.
  */
-extern void
-parse_host_res_preference(
-			 char const* value, ///< [in] Configuration string.
-			  HostResPreferenceOrder order /// [out] Order to update.
-			  );
+extern void parse_host_res_preference(char const *value,           ///< [in] Configuration string.
+                                      HostResPreferenceOrder order /// [out] Order to update.
+                                      );
 
 #ifndef NS_GET16
-#define NS_GET16(s, cp) do { \
-        const u_char *t_cp = (const u_char *)(cp); \
-        (s) = ((uint16_t)t_cp[0] << 8) \
-            | ((uint16_t)t_cp[1]) \
-            ; \
-        (cp) += NS_INT16SZ; \
-} while (0)
+#define NS_GET16(s, cp)                                   \
+  do {                                                    \
+    const u_char *t_cp = (const u_char *)(cp);            \
+    (s) = ((uint16_t)t_cp[0] << 8) | ((uint16_t)t_cp[1]); \
+    (cp) += NS_INT16SZ;                                   \
+  } while (0)
 #endif
 
 #ifndef NS_GET32
-#define NS_GET32(l, cp) do { \
-        const u_char *t_cp = (const u_char *)(cp); \
-        (l) = ((uint32_t)t_cp[0] << 24) \
-            | ((uint32_t)t_cp[1] << 16) \
-            | ((uint32_t)t_cp[2] << 8) \
-            | ((uint32_t)t_cp[3]) \
-            ; \
-        (cp) += NS_INT32SZ; \
-} while (0)
+#define NS_GET32(l, cp)                                                                                           \
+  do {                                                                                                            \
+    const u_char *t_cp = (const u_char *)(cp);                                                                    \
+    (l) = ((uint32_t)t_cp[0] << 24) | ((uint32_t)t_cp[1] << 16) | ((uint32_t)t_cp[2] << 8) | ((uint32_t)t_cp[3]); \
+    (cp) += NS_INT32SZ;                                                                                           \
+  } while (0)
 #endif
 
 #ifndef NS_PUT16
-#define NS_PUT16(s, cp) do { \
-        uint16_t t_s = (uint16_t)(s); \
-        u_char *t_cp = (u_char *)(cp); \
-        *t_cp++ = t_s >> 8; \
-        *t_cp   = t_s; \
-        (cp) += NS_INT16SZ; \
-} while (0)
+#define NS_PUT16(s, cp)            \
+  do {                             \
+    uint16_t t_s = (uint16_t)(s);  \
+    u_char *t_cp = (u_char *)(cp); \
+    *t_cp++ = t_s >> 8;            \
+    *t_cp = t_s;                   \
+    (cp) += NS_INT16SZ;            \
+  } while (0)
 #endif
 
 #ifndef NS_PUT32
-#define NS_PUT32(l, cp) do { \
-        uint32_t t_l = (uint32_t)(l); \
-        u_char *t_cp = (u_char *)(cp); \
-        *t_cp++ = t_l >> 24; \
-        *t_cp++ = t_l >> 16; \
-        *t_cp++ = t_l >> 8; \
-        *t_cp   = t_l; \
-        (cp) += NS_INT32SZ; \
-} while (0)
+#define NS_PUT32(l, cp)            \
+  do {                             \
+    uint32_t t_l = (uint32_t)(l);  \
+    u_char *t_cp = (u_char *)(cp); \
+    *t_cp++ = t_l >> 24;           \
+    *t_cp++ = t_l >> 16;           \
+    *t_cp++ = t_l >> 8;            \
+    *t_cp = t_l;                   \
+    (cp) += NS_INT32SZ;            \
+  } while (0)
 #endif
 
 // Do we really need these to be C compatible? - AMC
 struct ts_imp_res_state {
-  int     retrans;                /*%< retransmission time interval */
-  int     retry;                  /*%< number of times to retransmit */
+  int retrans; /*%< retransmission time interval */
+  int retry;   /*%< number of times to retransmit */
 #ifdef sun
-  unsigned   options;                /*%< option flags - see below. */
+  unsigned options; /*%< option flags - see below. */
 #else
-  u_long  options;                /*%< option flags - see below. */
+  u_long options; /*%< option flags - see below. */
 #endif
-  int     nscount;                /*%< number of name servers */
-  IpEndpoint nsaddr_list[INK_MAXNS];    /*%< address of name server */
-  u_short id;                     /*%< current message id */
-  char    *dnsrch[MAXDNSRCH+1];   /*%< components of domain to search */
-  char    defdname[256];          /*%< default domain (deprecated) */
+  int nscount;                       /*%< number of name servers */
+  IpEndpoint nsaddr_list[INK_MAXNS]; /*%< address of name server */
+  u_short id;                        /*%< current message id */
+  char *dnsrch[MAXDNSRCH + 1];       /*%< components of domain to search */
+  char defdname[256];                /*%< default domain (deprecated) */
 #ifdef sun
-  unsigned   pfcode;                 /*%< RES_PRF_ flags - see below. */
+  unsigned pfcode; /*%< RES_PRF_ flags - see below. */
 #else
-  u_long  pfcode;                 /*%< RES_PRF_ flags - see below. */
+  u_long pfcode;  /*%< RES_PRF_ flags - see below. */
 #endif
-  unsigned ndots:4;               /*%< threshold for initial abs. query */
-  unsigned nsort:4;               /*%< number of elements in sort_list[] */
-  char    unused[3];
-  res_send_qhook qhook;           /*%< query hook */
-  res_send_rhook rhook;           /*%< response hook */
-  int     res_h_errno;            /*%< last one set for this context */
-  int     _vcsock;                /*%< PRIVATE: for res_send VC i/o */
-  unsigned   _flags;                 /*%< PRIVATE: see below */
-  unsigned   _pad;                   /*%< make _u 64 bit aligned */
-  uint16_t              _nstimes[INK_MAXNS]; /*%< ms. */
+  unsigned ndots : 4; /*%< threshold for initial abs. query */
+  unsigned nsort : 4; /*%< number of elements in sort_list[] */
+  char unused[3];
+  res_send_qhook qhook;         /*%< query hook */
+  res_send_rhook rhook;         /*%< response hook */
+  int res_h_errno;              /*%< last one set for this context */
+  int _vcsock;                  /*%< PRIVATE: for res_send VC i/o */
+  unsigned _flags;              /*%< PRIVATE: see below */
+  unsigned _pad;                /*%< make _u 64 bit aligned */
+  uint16_t _nstimes[INK_MAXNS]; /*%< ms. */
 };
 typedef ts_imp_res_state *ink_res_state;
 
-int ink_res_init(
-  ink_res_state,
-  IpEndpoint const* pHostList,
-  size_t pHostListSize,
-  const char *pDefDomain = NULL,
-  const char *pSearchList = NULL,
-  const char *pResolvConf = NULL
-);
+int ink_res_init(ink_res_state, IpEndpoint const *pHostList, size_t pHostListSize, const char *pDefDomain = NULL,
+                 const char *pSearchList = NULL, const char *pResolvConf = NULL);
 
-int ink_res_mkquery(ink_res_state, int, const char *, int, int,
-                    const unsigned char *, int, const unsigned char *, unsigned char *, int);
+int ink_res_mkquery(ink_res_state, int, const char *, int, int, const unsigned char *, int, const unsigned char *, unsigned char *,
+                    int);
 
 int ink_ns_name_ntop(const u_char *src, char *dst, size_t dstsiz);
 
@@ -294,12 +280,9 @@ void ts_host_res_global_init();
 /** Generate a string representation of a host resolution preference ordering.
     @return The length of the string.
  */
-int
-ts_host_res_order_to_string(
-			    HostResPreferenceOrder const& order, ///< order to print
-			    char* out, ///< Target buffer for string.
-			    int size ///< Size of buffer.
-			    );
-
-#endif   /* _ink_resolver_h_ */
+int ts_host_res_order_to_string(HostResPreferenceOrder const &order, ///< order to print
+                                char *out,                           ///< Target buffer for string.
+                                int size                             ///< Size of buffer.
+                                );
 
+#endif /* _ink_resolver_h_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_resource.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_resource.cc b/lib/ts/ink_resource.cc
index f0fc983..cbb4b58 100644
--- a/lib/ts/ink_resource.cc
+++ b/lib/ts/ink_resource.cc
@@ -27,7 +27,7 @@
 
 volatile int res_track_memory = 0; // Disabled by default
 
-std::map<const char*, Resource*> ResourceTracker::_resourceMap;
+std::map<const char *, Resource *> ResourceTracker::_resourceMap;
 ink_mutex ResourceTracker::resourceLock = PTHREAD_MUTEX_INITIALIZER;
 
 /**
@@ -36,16 +36,23 @@ ink_mutex ResourceTracker::resourceLock = PTHREAD_MUTEX_INITIALIZER;
 class Resource
 {
 public:
-  Resource(): _incrementCount(0), _decrementCount(0), _value(0) {}
+  Resource() : _incrementCount(0), _decrementCount(0), _value(0) {}
   void increment(const int64_t size);
-  int64_t getValue() const { return _value; }
+  int64_t
+  getValue() const
+  {
+    return _value;
+  }
+
 private:
   int64_t _incrementCount;
   int64_t _decrementCount;
   int64_t _value;
 };
 
-void Resource::increment(const int64_t size) {
+void
+Resource::increment(const int64_t size)
+{
   ink_atomic_increment(&_value, size);
   if (size >= 0) {
     ink_atomic_increment(&_incrementCount, 1);
@@ -55,17 +62,18 @@ void Resource::increment(const int64_t size) {
 }
 
 void
-ResourceTracker::increment(const char *name, const int64_t size) {
+ResourceTracker::increment(const char *name, const int64_t size)
+{
   Resource &resource = lookup(name);
   resource.increment(size);
 }
 
-Resource&
+Resource &
 ResourceTracker::lookup(const char *name)
 {
   Resource *resource = NULL;
   ink_mutex_acquire(&resourceLock);
-  std::map<const char*, Resource*>::iterator it = _resourceMap.find(name);
+  std::map<const char *, Resource *>::iterator it = _resourceMap.find(name);
   if (it != _resourceMap.end()) {
     resource = it->second;
   } else {
@@ -79,7 +87,8 @@ ResourceTracker::lookup(const char *name)
 }
 
 void
-ResourceTracker::dump(FILE *fd) {
+ResourceTracker::dump(FILE *fd)
+{
   if (!res_track_memory) {
     return;
   }
@@ -89,8 +98,7 @@ ResourceTracker::dump(FILE *fd) {
   if (!_resourceMap.empty()) {
     fprintf(fd, "%50s | %20s\n", "Location", "Size In-use");
     fprintf(fd, "---------------------------------------------------+------------------------\n");
-    for (std::map<const char*, Resource*>::const_iterator it = _resourceMap.begin();
-        it != _resourceMap.end(); ++it) {
+    for (std::map<const char *, Resource *>::const_iterator it = _resourceMap.begin(); it != _resourceMap.end(); ++it) {
       const Resource &resource = *it->second;
       fprintf(fd, "%50s | %20" PRId64 "\n", it->first, resource.getValue());
       total += resource.getValue();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_resource.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_resource.h b/lib/ts/ink_resource.h
index 7be1447..02e36e0 100644
--- a/lib/ts/ink_resource.h
+++ b/lib/ts/ink_resource.h
@@ -27,11 +27,11 @@
 #include "ink_mutex.h"
 #include <map>
 
-extern volatile int res_track_memory;   /* set this to zero to disable resource tracking */
+extern volatile int res_track_memory; /* set this to zero to disable resource tracking */
 
-#define __RES_PATH(x)   #x
-#define _RES_PATH(x)    __RES_PATH (x)
-#define RES_PATH(x)     x __FILE__ ":" _RES_PATH (__LINE__)
+#define __RES_PATH(x) #x
+#define _RES_PATH(x) __RES_PATH(x)
+#define RES_PATH(x) x __FILE__ ":" _RES_PATH(__LINE__)
 
 class Resource;
 
@@ -42,12 +42,13 @@ class Resource;
 class ResourceTracker
 {
 public:
-  ResourceTracker() {};
-  static void increment(const char* name, const int64_t size);
+  ResourceTracker(){};
+  static void increment(const char *name, const int64_t size);
   static void dump(FILE *fd);
+
 private:
-  static Resource& lookup(const char* name);
-  static std::map<const char*, Resource*> _resourceMap;
+  static Resource &lookup(const char *name);
+  static std::map<const char *, Resource *> _resourceMap;
   static ink_mutex resourceLock;
 };
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_rwlock.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_rwlock.cc b/lib/ts/ink_rwlock.cc
index bcbc70a..a28f8ee 100644
--- a/lib/ts/ink_rwlock.cc
+++ b/lib/ts/ink_rwlock.cc
@@ -30,7 +30,7 @@
 // Note: This should be called only once.
 //-------------------------------------------------------------------------
 int
-ink_rwlock_init(ink_rwlock * rw)
+ink_rwlock_init(ink_rwlock *rw)
 {
   int result;
 
@@ -48,8 +48,7 @@ ink_rwlock_init(ink_rwlock * rw)
   return 0;
 
 Lerror:
-  return result;              /* an errno value */
-
+  return result; /* an errno value */
 }
 
 //-------------------------------------------------------------------------
@@ -57,7 +56,7 @@ Lerror:
 //-------------------------------------------------------------------------
 
 int
-ink_rwlock_destroy(ink_rwlock * rw)
+ink_rwlock_destroy(ink_rwlock *rw)
 {
   if (rw->rw_magic != RW_MAGIC)
     return EINVAL;
@@ -77,7 +76,7 @@ ink_rwlock_destroy(ink_rwlock * rw)
 //-------------------------------------------------------------------------
 
 int
-ink_rwlock_rdlock(ink_rwlock * rw)
+ink_rwlock_rdlock(ink_rwlock *rw)
 {
   int result;
 
@@ -93,7 +92,7 @@ ink_rwlock_rdlock(ink_rwlock * rw)
     ink_cond_wait(&rw->rw_condreaders, &rw->rw_mutex);
     rw->rw_nwaitreaders--;
   }
-  rw->rw_refcount++;            /* another reader has a read lock */
+  rw->rw_refcount++; /* another reader has a read lock */
 
   ink_mutex_release(&rw->rw_mutex);
 
@@ -105,7 +104,7 @@ ink_rwlock_rdlock(ink_rwlock * rw)
 //-------------------------------------------------------------------------
 
 int
-ink_rwlock_wrlock(ink_rwlock * rw)
+ink_rwlock_wrlock(ink_rwlock *rw)
 {
   int result;
 
@@ -132,7 +131,7 @@ ink_rwlock_wrlock(ink_rwlock * rw)
 //-------------------------------------------------------------------------
 
 int
-ink_rwlock_unlock(ink_rwlock * rw)
+ink_rwlock_unlock(ink_rwlock *rw)
 {
   int result;
 
@@ -143,9 +142,9 @@ ink_rwlock_unlock(ink_rwlock * rw)
     return result;
 
   if (rw->rw_refcount > 0)
-    rw->rw_refcount--;          /* releasing a reader */
+    rw->rw_refcount--; /* releasing a reader */
   else if (rw->rw_refcount == -1)
-    rw->rw_refcount = 0;        /* releasing a reader */
+    rw->rw_refcount = 0; /* releasing a reader */
   else
     ink_release_assert("invalid rw_refcount!");
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_rwlock.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_rwlock.h b/lib/ts/ink_rwlock.h
index 06a732e..01e87be 100644
--- a/lib/ts/ink_rwlock.h
+++ b/lib/ts/ink_rwlock.h
@@ -35,21 +35,20 @@
 
 #define RW_MAGIC 0x19283746
 
-struct ink_rwlock
-{
-  ink_mutex rw_mutex;           /* basic lock on this struct */
-  ink_cond rw_condreaders;      /* for reader threads waiting */
-  ink_cond rw_condwriters;      /* for writer threads waiting */
-  int rw_magic;                 /* for error checking */
-  int rw_nwaitreaders;          /* the number waiting */
-  int rw_nwaitwriters;          /* the number waiting */
+struct ink_rwlock {
+  ink_mutex rw_mutex;      /* basic lock on this struct */
+  ink_cond rw_condreaders; /* for reader threads waiting */
+  ink_cond rw_condwriters; /* for writer threads waiting */
+  int rw_magic;            /* for error checking */
+  int rw_nwaitreaders;     /* the number waiting */
+  int rw_nwaitwriters;     /* the number waiting */
   int rw_refcount;
 };
 
-int ink_rwlock_init(ink_rwlock * rw);
-int ink_rwlock_destroy(ink_rwlock * rw);
-int ink_rwlock_rdlock(ink_rwlock * rw);
-int ink_rwlock_wrlock(ink_rwlock * rw);
-int ink_rwlock_unlock(ink_rwlock * rw);
+int ink_rwlock_init(ink_rwlock *rw);
+int ink_rwlock_destroy(ink_rwlock *rw);
+int ink_rwlock_rdlock(ink_rwlock *rw);
+int ink_rwlock_wrlock(ink_rwlock *rw);
+int ink_rwlock_unlock(ink_rwlock *rw);
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_sock.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_sock.cc b/lib/ts/ink_sock.cc
index f1e699f..3c72103 100644
--- a/lib/ts/ink_sock.cc
+++ b/lib/ts/ink_sock.cc
@@ -37,11 +37,11 @@
 
 
 #ifdef CHECK_PLAUSIBILITY_OF_SOCKADDR
-#define CHECK_PLAUSIBLE_SOCKADDR(_n,_f,_l) check_plausible_sockaddr(_n,_f,_n)
+#define CHECK_PLAUSIBLE_SOCKADDR(_n, _f, _l) check_plausible_sockaddr(_n, _f, _n)
 inline void
-check_valid_sockaddr(sockaddr * sa, char *file, int line)
+check_valid_sockaddr(sockaddr *sa, char *file, int line)
 {
-  sockaddr_in *si = (sockaddr_in *) sa;
+  sockaddr_in *si = (sockaddr_in *)sa;
   unsigned short port = ntohs(si->sin_port);
   unsigned short addr = ntohl(si->sin_addr.s_addr);
 
@@ -52,7 +52,7 @@ check_valid_sockaddr(sockaddr * sa, char *file, int line)
   }
 }
 #else
-#define CHECK_PLAUSIBLE_SOCKADDR(_n,_f,_l)
+#define CHECK_PLAUSIBLE_SOCKADDR(_n, _f, _l)
 #endif
 
 int
@@ -70,7 +70,7 @@ safe_getsockopt(int s, int level, int optname, char *optval, int *optlevel)
 {
   int r;
   do {
-    r = getsockopt(s, level, optname, optval, (socklen_t *) optlevel);
+    r = getsockopt(s, level, optname, optval, (socklen_t *)optlevel);
   } while (r < 0 && (errno == EAGAIN || errno == EINTR));
   return r;
 }
@@ -162,7 +162,7 @@ safe_ioctl(int fd, int request, char *arg)
 }
 
 int
-safe_bind(int s, struct sockaddr const* name, int namelen)
+safe_bind(int s, struct sockaddr const *name, int namelen)
 {
   int r;
   CHECK_PLAUSIBLE_SOCKADDR(name, __FILE__, __LINE__);
@@ -187,7 +187,7 @@ safe_getsockname(int s, struct sockaddr *name, int *namelen)
 {
   int r;
   do {
-    r = getsockname(s, name, (socklen_t *) namelen);
+    r = getsockname(s, name, (socklen_t *)namelen);
   } while (r < 0 && (errno == EAGAIN || errno == EINTR));
   return r;
 }
@@ -197,7 +197,7 @@ safe_getpeername(int s, struct sockaddr *name, int *namelen)
 {
   int r;
   do {
-    r = getpeername(s, name, (socklen_t*)namelen);
+    r = getpeername(s, name, (socklen_t *)namelen);
   } while (r < 0 && (errno == EAGAIN || errno == EINTR));
   return r;
 }
@@ -222,7 +222,7 @@ fd_read_line(int fd, char *s, int len)
 {
   char c;
   int numread = 0, r;
-  //char *buf = s;
+  // char *buf = s;
   do {
     do
       r = read(fd, &c, 1);
@@ -254,17 +254,17 @@ close_socket(int s)
 int
 write_socket(int s, const char *buffer, int length)
 {
-  return write(s, (const void *) buffer, length);
+  return write(s, (const void *)buffer, length);
 }
 
 int
 read_socket(int s, char *buffer, int length)
 {
-  return read(s, (void *) buffer, length);
+  return read(s, (void *)buffer, length);
 }
 
 int
-bind_unix_domain_socket(const char * path, mode_t mode)
+bind_unix_domain_socket(const char *path, mode_t mode)
 {
   int sockfd;
   struct sockaddr_un sockaddr;
@@ -310,4 +310,3 @@ fail:
   errno = errsav;
   return -1;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_sock.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_sock.h b/lib/ts/ink_sock.h
index 859d0b8..629ded3 100644
--- a/lib/ts/ink_sock.h
+++ b/lib/ts/ink_sock.h
@@ -27,7 +27,7 @@
 
 
 ***************************************************************************/
-#if !defined (_ink_sock_h_)
+#if !defined(_ink_sock_h_)
 #define _ink_sock_h_
 
 #include "ink_platform.h"
@@ -37,7 +37,7 @@
 
 int safe_setsockopt(int s, int level, int optname, char *optval, int optlevel);
 int safe_getsockopt(int s, int level, int optname, char *optval, int *optlevel);
-int safe_bind(int s, struct sockaddr const* name, int namelen);
+int safe_bind(int s, struct sockaddr const *name, int namelen);
 int safe_listen(int s, int backlog);
 int safe_getsockname(int s, struct sockaddr *name, int *namelen);
 int safe_getpeername(int s, struct sockaddr *name, int *namelen);
@@ -63,6 +63,6 @@ int read_socket(int s, char *buffer, int length);
 
 inkcoreapi uint32_t ink_inet_addr(const char *s);
 
-int bind_unix_domain_socket(const char * path, mode_t mode);
+int bind_unix_domain_socket(const char *path, mode_t mode);
 
 #endif /* _ink_sock_h_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_sprintf.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_sprintf.cc b/lib/ts/ink_sprintf.cc
index 8c053ee..26a0716 100644
--- a/lib/ts/ink_sprintf.cc
+++ b/lib/ts/ink_sprintf.cc
@@ -80,63 +80,63 @@ ink_bvsprintf(char *buffer, const char *format, va_list ap)
     // handle non-% characters //
     /////////////////////////////
 
-    if (buffer)                 // if have output buffer
+    if (buffer) // if have output buffer
       while (*s && (*s != '%')) {
         *d++ = *s++;
-      }                         //   really copy, else
+      } //   really copy, else
     else
       while (*s && (*s != '%')) {
         d++;
         s++;
-      }                         //   pass over string
+      } //   pass over string
 
     ///////////////////////////
     // handle NUL characters //
     ///////////////////////////
 
     if (*s == NUL)
-      break;                    // end of string
+      break; // end of string
 
     /////////////////////////
     // handle % characters //
     /////////////////////////
 
-    ++s;                        // consume % character
+    ++s; // consume % character
 
-    switch (*s)                 // dispatch on flag
+    switch (*s) // dispatch on flag
     {
-    case 's':                  // %s pattern
-      ++s;                      // consume 's'
-      s_val = va_arg(ap_local, char *);       // grab string argument
-      p = s_val;                // temporary pointer
-      if (buffer)               // if have output buffer
+    case 's':                           // %s pattern
+      ++s;                              // consume 's'
+      s_val = va_arg(ap_local, char *); // grab string argument
+      p = s_val;                        // temporary pointer
+      if (buffer)                       // if have output buffer
         while (*p) {
           *d++ = *p++;
-        }                       //   copy value
-      else                      // else
+        }  //   copy value
+      else // else
         while (*p) {
           d++;
           p++;
-        }                       //   pass over value
+        } //   pass over value
       break;
-    case 'd':                  // %d pattern
-      ++s;                      // consume 'd'
-      d_val = va_arg(ap_local, int);  // grab integer argument
-      snprintf(d_buffer, sizeof(d_buffer), "%d", d_val);        // stringify integer
-      p = d_buffer;             // temporary pointer
-      if (buffer)               // if have output buffer
+    case 'd':                                            // %d pattern
+      ++s;                                               // consume 'd'
+      d_val = va_arg(ap_local, int);                     // grab integer argument
+      snprintf(d_buffer, sizeof(d_buffer), "%d", d_val); // stringify integer
+      p = d_buffer;                                      // temporary pointer
+      if (buffer)                                        // if have output buffer
         while (*p) {
           *d++ = *p++;
-        }                       //   copy value
-      else                      // else
+        }  //   copy value
+      else // else
         while (*p) {
           d++;
           p++;
-        }                       //   pass over value
+        } //   pass over value
       break;
-    default:                   // something else
+    default: // something else
       if (buffer)
-        *d = *s;                // copy unknown character
+        *d = *s; // copy unknown character
       ++d;
       ++s;
       break;
@@ -148,5 +148,5 @@ ink_bvsprintf(char *buffer, const char *format, va_list ap)
   ++d;
 
   va_end(ap_local);
-  return (int) (d - buffer);
+  return (int)(d - buffer);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_sprintf.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_sprintf.h b/lib/ts/ink_sprintf.h
index 67da29f..7686d0c 100644
--- a/lib/ts/ink_sprintf.h
+++ b/lib/ts/ink_sprintf.h
@@ -32,17 +32,14 @@
   ****************************************************************************/
 
 #ifndef _ink_sprintf_h_
-#define	_ink_sprintf_h_
+#define _ink_sprintf_h_
 
 #include <stdio.h>
 #include <stdarg.h>
 #include "ink_apidefs.h"
 #include "ink_defs.h"
 
-int
-ink_bsprintf(char *buffer, const char *format, ...)
-TS_PRINTFLIKE(2, 3);
-int
-ink_bvsprintf(char *buffer, const char *format, va_list ap);
+int ink_bsprintf(char *buffer, const char *format, ...) TS_PRINTFLIKE(2, 3);
+int ink_bvsprintf(char *buffer, const char *format, va_list ap);
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_stack_trace.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_stack_trace.cc b/lib/ts/ink_stack_trace.cc
index 17f9ddc..b38b8e1 100644
--- a/lib/ts/ink_stack_trace.cc
+++ b/lib/ts/ink_stack_trace.cc
@@ -35,7 +35,7 @@
 
 #if TS_HAS_BACKTRACE
 
-#include <execinfo.h>           /* for backtrace_symbols, etc. */
+#include <execinfo.h> /* for backtrace_symbols, etc. */
 #include <signal.h>
 
 void
@@ -63,14 +63,14 @@ ink_stack_trace_dump()
   }
 }
 
-#else  /* !TS_HAS_BACKTRACE */
+#else /* !TS_HAS_BACKTRACE */
 
 void
 ink_stack_trace_dump()
 {
   const char msg[] = "ink_stack_trace_dump not implemented on this operating system\n";
   if (write(STDERR_FILENO, msg, sizeof(msg) - 1) == -1)
-      return;
+    return;
 }
 
-#endif  /* TS_HAS_BACKTRACE */
+#endif /* TS_HAS_BACKTRACE */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_stack_trace.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_stack_trace.h b/lib/ts/ink_stack_trace.h
index 7490cb8..a2e5904 100644
--- a/lib/ts/ink_stack_trace.h
+++ b/lib/ts/ink_stack_trace.h
@@ -25,16 +25,15 @@
 #define ink_stack_trace_h
 
 // The max number of levels in the stack trace
-#define INK_STACK_TRACE_MAX_LEVELS		100
+#define INK_STACK_TRACE_MAX_LEVELS 100
 
 #ifdef __cplusplus
-extern "C"
-{
+extern "C" {
 #endif
 /* dumps the current back trace to stderr */
-  void ink_stack_trace_dump();
+void ink_stack_trace_dump();
 #ifdef __cplusplus
 }
 #endif
 
-#endif                          /* ink_stack_trace_h */
+#endif /* ink_stack_trace_h */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_string++.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_string++.cc b/lib/ts/ink_string++.cc
index dcc1799..dacc870 100644
--- a/lib/ts/ink_string++.cc
+++ b/lib/ts/ink_string++.cc
@@ -42,7 +42,7 @@
   -------------------------------------------------------------------------*/
 
 void
-StrList::dump(FILE * fp)
+StrList::dump(FILE *fp)
 {
   Str *str;
 
@@ -64,23 +64,23 @@ StrList::_new_cell(const char *s, int len_not_counting_nul)
   if (cells_allocated < STRLIST_BASE_CELLS) {
     cell = &(base_cells[cells_allocated]);
   } else {
-    p = (char *) alloc(sizeof(Str) + 7);
+    p = (char *)alloc(sizeof(Str) + 7);
     if (p == NULL)
-      return (NULL);            // FIX: scale heap
-    p = (char *) ((((uintptr_t)p) + 7) & ~7);       // round up to multiple of 8
-    cell = (Str *) p;
+      return (NULL);                         // FIX: scale heap
+    p = (char *)((((uintptr_t)p) + 7) & ~7); // round up to multiple of 8
+    cell = (Str *)p;
   }
   ++cells_allocated;
 
   // are we supposed to copy the string?
   if (copy_when_adding_string) {
-    char *buf = (char *) alloc(l + 1);
+    char *buf = (char *)alloc(l + 1);
     if (buf == NULL)
-      return (NULL);            // FIX: need to grow heap!
+      return (NULL); // FIX: need to grow heap!
     memcpy(buf, s, l);
     buf[l] = '\0';
 
-    cell->str = (const char *) buf;
+    cell->str = (const char *)buf;
   } else {
     cell->str = s;
   }
@@ -114,7 +114,7 @@ StrList::overflow_heap_clean()
 }
 
 
-#define INIT_OVERFLOW_ALIGNMENT      8
+#define INIT_OVERFLOW_ALIGNMENT 8
 // XXX: This is basically INK_ALIGN_DEFAULT
 const int overflow_head_hdr_size = INK_ALIGN(sizeof(StrListOverflow), INIT_OVERFLOW_ALIGNMENT);
 
@@ -140,9 +140,8 @@ StrListOverflow::clean()
 }
 
 void *
-StrListOverflow::alloc(int size, StrListOverflow ** new_heap_ptr)
+StrListOverflow::alloc(int size, StrListOverflow **new_heap_ptr)
 {
-
   if (size > (heap_size - heap_used)) {
     int new_heap_size = heap_size * 2;
 
@@ -156,11 +155,11 @@ StrListOverflow::alloc(int size, StrListOverflow ** new_heap_ptr)
     return next->alloc(size, new_heap_ptr);
   }
 
-  char *start = ((char *) this) + overflow_head_hdr_size;
+  char *start = ((char *)this) + overflow_head_hdr_size;
   char *rval = start + heap_used;
   heap_used += size;
   ink_assert(heap_used <= heap_size);
-  return (void *) rval;
+  return (void *)rval;
 }
 
 StrListOverflow *

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_string++.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_string++.h b/lib/ts/ink_string++.h
index 768303e..338b13a 100644
--- a/lib/ts/ink_string++.h
+++ b/lib/ts/ink_string++.h
@@ -30,7 +30,7 @@
 
  ****************************************************************************/
 
-#if !defined (_ink_string_pp_h_)
+#if !defined(_ink_string_pp_h_)
 #define _ink_string_pp_h_
 #include <stdio.h>
 #include <strings.h>
@@ -61,7 +61,7 @@ _strlen(const char *src)
   const char *old_src = src;
   while (*src)
     src++;
-  return (int) (src - old_src);
+  return (int)(src - old_src);
 }
 
 /***********************************************************************
@@ -70,16 +70,13 @@ _strlen(const char *src)
  *                                                                     *
  ***********************************************************************/
 
-struct Str
-{
-  const char *str;              // string pointer
-  size_t len;                   // length of string (not counting NUL)
-  struct Str *next;             // next in list
-  struct Str *prev;             // prev in list
+struct Str {
+  const char *str;  // string pointer
+  size_t len;       // length of string (not counting NUL)
+  struct Str *next; // next in list
+  struct Str *prev; // prev in list
 
-    Str():str(NULL), len(0), next(NULL), prev(NULL)
-  {
-  }
+  Str() : str(NULL), len(0), next(NULL), prev(NULL) {}
   Str(char *s)
   {
     str = s;
@@ -95,7 +92,8 @@ struct Str
     prev = NULL;
   }
 
-  void clean()
+  void
+  clean()
   {
     str = NULL;
     len = 0;
@@ -103,8 +101,10 @@ struct Str
     prev = NULL;
   }
 
-  void dump(FILE * fp = stderr) {
-    fprintf(fp, "Str [\"%.*s\", len %d]\n", (int) len, str, (int) len);
+  void
+  dump(FILE *fp = stderr)
+  {
+    fprintf(fp, "Str [\"%.*s\", len %d]\n", (int)len, str, (int)len);
   }
 };
 
@@ -114,33 +114,32 @@ struct Str
  *                                                                     *
  ***********************************************************************/
 
-#define	STRLIST_BASE_HEAP_SIZE		128
-#define	STRLIST_OVERFLOW_HEAP_SIZE	1024
-#define	STRLIST_BASE_CELLS		5
+#define STRLIST_BASE_HEAP_SIZE 128
+#define STRLIST_OVERFLOW_HEAP_SIZE 1024
+#define STRLIST_BASE_CELLS 5
 
 struct StrListOverflow;
 
-struct StrList
-{
+struct StrList {
 public:
   int count;
   Str *head;
   Str *tail;
 
 public:
-    StrList(bool do_copy_when_adding_string = true);
-   ~StrList();
+  StrList(bool do_copy_when_adding_string = true);
+  ~StrList();
 
   Str *get_idx(int i);
-  void append(Str * str);
-  void prepend(Str * str);
-  void add_after(Str * prev, Str * str);
-  void detach(Str * str);
+  void append(Str *str);
+  void prepend(Str *str);
+  void add_after(Str *prev, Str *str);
+  void detach(Str *str);
 
   Str *new_cell(const char *s, int len_not_counting_nul);
   Str *append_string(const char *s, int len_not_counting_nul);
 
-  void dump(FILE * fp = stderr);
+  void dump(FILE *fp = stderr);
 
 private:
   void init();
@@ -162,15 +161,14 @@ private:
   bool copy_when_adding_string;
 };
 
-struct StrListOverflow
-{
+struct StrListOverflow {
   StrListOverflow *next;
   int heap_size;
   int heap_used;
 
   void init();
   void clean();
-  void *alloc(int size, StrListOverflow ** new_heap_ptr);
+  void *alloc(int size, StrListOverflow **new_heap_ptr);
   static StrListOverflow *create_heap(int user_size);
 };
 
@@ -194,17 +192,14 @@ StrList::clean()
   init();
 }
 
-inline
-StrList::StrList(bool do_copy_when_adding_string)
+inline StrList::StrList(bool do_copy_when_adding_string)
 {
   memset(base_heap, 0, sizeof(base_heap));
   copy_when_adding_string = do_copy_when_adding_string;
   init();
 }
 
-inline
-StrList::~
-StrList()
+inline StrList::~StrList()
 {
   clean();
 }
@@ -217,7 +212,7 @@ StrList::base_heap_alloc(int size)
   if (size <= (base_heap_size - base_heap_used)) {
     p = &(base_heap[base_heap_used]);
     base_heap_used += size;
-    return ((void *) p);
+    return ((void *)p);
   } else
     return (NULL);
 }
@@ -253,12 +248,13 @@ StrList::get_idx(int i)
 {
   Str *s;
 
-  for (s = head; ((s != NULL) && i); s = s->next, i--);
+  for (s = head; ((s != NULL) && i); s = s->next, i--)
+    ;
   return ((i == 0) ? s : NULL);
 }
 
 inline void
-StrList::append(Str * str)
+StrList::append(Str *str)
 {
   // do nothing if str is NULL to avoid pointer chasing below
   if (str == NULL)
@@ -276,7 +272,7 @@ StrList::append(Str * str)
 }
 
 inline void
-StrList::prepend(Str * str)
+StrList::prepend(Str *str)
 {
   if (str == NULL)
     return;
@@ -293,7 +289,7 @@ StrList::prepend(Str * str)
 }
 
 inline void
-StrList::add_after(Str * prev, Str * str)
+StrList::add_after(Str *prev, Str *str)
 {
   if (str == NULL || prev == NULL)
     return;
@@ -306,7 +302,7 @@ StrList::add_after(Str * prev, Str * str)
 }
 
 inline void
-StrList::detach(Str * str)
+StrList::detach(Str *str)
 {
   if (str == NULL)
     return;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_string.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_string.cc b/lib/ts/ink_string.cc
index c079b5e..f8178e1 100644
--- a/lib/ts/ink_string.cc
+++ b/lib/ts/ink_string.cc
@@ -21,7 +21,7 @@
   limitations under the License.
  */
 
-#include "libts.h"   /* MAGIC_EDITING_TAG */
+#include "libts.h" /* MAGIC_EDITING_TAG */
 
 #include <assert.h>
 #include <stdarg.h>
@@ -36,7 +36,7 @@ char *
 ink_memcpy_until_char(char *dst, char *src, unsigned int n, unsigned char c)
 {
   unsigned int i = 0;
-  for (; ((i < n) && (((unsigned char) src[i]) != c)); i++)
+  for (; ((i < n) && (((unsigned char)src[i]) != c)); i++)
     dst[i] = src[i];
   return &src[i];
 }
@@ -72,7 +72,7 @@ ink_string_concatenate_strings(char *dest, ...)
   *d++ = '\0';
   va_end(ap);
   return (dest);
-}                               /* End ink_string_concatenate_strings */
+} /* End ink_string_concatenate_strings */
 
 
 /*---------------------------------------------------------------------------*
@@ -109,7 +109,7 @@ ink_string_concatenate_strings_n(char *dest, int n, ...)
     *d = '\0';
   va_end(ap);
   return (dest);
-}                               /* End ink_string_concatenate_strings_n */
+} /* End ink_string_concatenate_strings_n */
 
 
 /*---------------------------------------------------------------------------*
@@ -138,7 +138,8 @@ ink_string_append(char *dest, char *src, int n)
 
   /* Scan For End Of Dest */
 
-  for (d = dest; (d <= last_valid_char) && (*d != '\0'); d++);
+  for (d = dest; (d <= last_valid_char) && (*d != '\0'); d++)
+    ;
 
   /* If At End Of String, NUL Terminate & Exit */
 
@@ -161,7 +162,7 @@ ink_string_append(char *dest, char *src, int n)
     *d = '\0';
 
   return (dest);
-}                               /* End ink_string_append */
+} /* End ink_string_append */
 
 
 #if !HAVE_STRLCPY
@@ -183,12 +184,12 @@ ink_strlcpy(char *dst, const char *src, size_t siz)
   /* Not enough room in dst, add NUL and traverse rest of src */
   if (n == 0) {
     if (siz != 0)
-      *d = '\0';      /* NUL-terminate dst */
+      *d = '\0'; /* NUL-terminate dst */
     while (*s++)
       ;
   }
 
-  return (s - src - 1);   /* count does not include NUL */
+  return (s - src - 1); /* count does not include NUL */
 }
 #endif
 
@@ -218,7 +219,6 @@ ink_strlcat(char *dst, const char *src, size_t siz)
   }
   *d = '\0';
 
-  return (dlen + (s - src));  /* count does not include NUL */
+  return (dlen + (s - src)); /* count does not include NUL */
 }
 #endif
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_string.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_string.h b/lib/ts/ink_string.h
index a822cc5..74d4ea4 100644
--- a/lib/ts/ink_string.h
+++ b/lib/ts/ink_string.h
@@ -60,7 +60,7 @@ inkcoreapi char *ink_string_append(char *dest, char *src, int n);
  * Returns strlen(src); if retval >= siz, truncation occurred.
  */
 #if HAVE_STRLCPY
-#define  ink_strlcpy strlcpy
+#define ink_strlcpy strlcpy
 #else
 size_t ink_strlcpy(char *dst, const char *str, size_t siz);
 #endif
@@ -72,7 +72,7 @@ size_t ink_strlcpy(char *dst, const char *str, size_t siz);
  * If retval >= siz, truncation occurred.
  */
 #if HAVE_STRLCAT
-#define  ink_strlcat strlcat
+#define ink_strlcat strlcat
 #else
 size_t ink_strlcat(char *dst, const char *str, size_t siz);
 #endif
@@ -146,14 +146,12 @@ ptr_len_casecmp(const char *p1, int l1, const char *p2, int l2)
 inline const char *
 ptr_len_str(const char *p1, int l1, const char *str)
 {
-
   if (str && str[0]) {
     int str_index = 0;
     const char *match_start = NULL;
 
     while (l1 > 0) {
       if (*p1 == str[str_index]) {
-
         // If this is the start of a match,
         //    record it;
         if (str_index == 0) {
@@ -185,8 +183,6 @@ ptr_len_str(const char *p1, int l1, const char *str)
 inline int
 ptr_len_ncmp(const char *p1, int l1, const char *str, int n)
 {
-
-
   while (l1 > 0 && n > 0) {
     if (*str == '\0') {
       return 1;
@@ -229,8 +225,6 @@ ptr_len_ncmp(const char *p1, int l1, const char *str, int n)
 inline int
 ptr_len_ncasecmp(const char *p1, int l1, const char *str, int n)
 {
-
-
   while (l1 > 0 && n > 0) {
     if (*str == '\0') {
       return 1;
@@ -272,7 +266,6 @@ ptr_len_ncasecmp(const char *p1, int l1, const char *str, int n)
 inline int
 ptr_len_casecmp(const char *p1, int l1, const char *str)
 {
-
   while (l1 > 0) {
     if (*str == '\0') {
       return 1;
@@ -313,7 +306,6 @@ ptr_len_casecmp(const char *p1, int l1, const char *str)
 inline int
 ptr_len_cmp(const char *p1, int l1, const char *str)
 {
-
   while (l1 > 0) {
     if (*str == '\0') {
       return 1;
@@ -357,7 +349,7 @@ ptr_len_pbrk(const char *p1, int l1, const char *str)
 
     while (*str_cur != '\0') {
       if (*p1 == *str_cur) {
-        return (char *) p1;
+        return (char *)p1;
       }
       str_cur++;
     }
@@ -373,27 +365,27 @@ ptr_len_pbrk(const char *p1, int l1, const char *str)
 // On error, we'll return 0, and nothing is written to the buffer.
 // TODO: Do these really need to be inline?
 inline int
-ink_small_itoa(int val, char* buf, int buf_len)
+ink_small_itoa(int val, char *buf, int buf_len)
 {
   ink_assert(buf_len > 5);
   ink_assert((val >= 0) && (val < 100000));
 
-  if (val < 10) {               // 0 - 9
+  if (val < 10) { // 0 - 9
     buf[0] = '0' + val;
     return 1;
-  } else if (val < 100) {       // 10 - 99
+  } else if (val < 100) { // 10 - 99
     buf[1] = '0' + (val % 10);
     val /= 10;
     buf[0] = '0' + (val % 10);
     return 2;
-  } else if (val < 1000) {      // 100 - 999
+  } else if (val < 1000) { // 100 - 999
     buf[2] = '0' + (val % 10);
     val /= 10;
     buf[1] = '0' + (val % 10);
     val /= 10;
     buf[0] = '0' + (val % 10);
     return 3;
-  } else if (val < 10000) {     // 1000 - 9999
+  } else if (val < 10000) { // 1000 - 9999
     buf[3] = '0' + (val % 10);
     val /= 10;
     buf[2] = '0' + (val % 10);
@@ -402,7 +394,7 @@ ink_small_itoa(int val, char* buf, int buf_len)
     val /= 10;
     buf[0] = '0' + (val % 10);
     return 4;
-  } else {                      // 10000 - 99999
+  } else { // 10000 - 99999
     buf[4] = '0' + (val % 10);
     val /= 10;
     buf[3] = '0' + (val % 10);
@@ -417,7 +409,7 @@ ink_small_itoa(int val, char* buf, int buf_len)
 }
 
 inline int
-ink_fast_itoa(int32_t val, char* buf, int buf_len)
+ink_fast_itoa(int32_t val, char *buf, int buf_len)
 {
   if ((val < 0) || (val > 99999)) {
     int ret = snprintf(buf, buf_len, "%d", val);
@@ -429,7 +421,7 @@ ink_fast_itoa(int32_t val, char* buf, int buf_len)
 }
 
 inline int
-ink_fast_uitoa(uint32_t val, char* buf, int buf_len)
+ink_fast_uitoa(uint32_t val, char *buf, int buf_len)
 {
   if (val > 99999) {
     int ret = snprintf(buf, buf_len, "%u", val);
@@ -441,7 +433,7 @@ ink_fast_uitoa(uint32_t val, char* buf, int buf_len)
 }
 
 inline int
-ink_fast_ltoa(int64_t val, char* buf, int buf_len)
+ink_fast_ltoa(int64_t val, char *buf, int buf_len)
 {
   if ((val < 0) || (val > 99999)) {
     int ret = snprintf(buf, buf_len, "%" PRId64 "", val);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_sys_control.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_sys_control.cc b/lib/ts/ink_sys_control.cc
index 770f3aa..626b496 100644
--- a/lib/ts/ink_sys_control.cc
+++ b/lib/ts/ink_sys_control.cc
@@ -31,9 +31,9 @@ ink_max_out_rlimit(int which, bool max_it, bool unlim_it)
   struct rlimit rl;
 
 #if defined(linux)
-#  define MAGIC_CAST(x) (enum __rlimit_resource)(x)
+#define MAGIC_CAST(x) (enum __rlimit_resource)(x)
 #else
-#  define MAGIC_CAST(x) x
+#define MAGIC_CAST(x) x
 #endif
 
   if (max_it) {
@@ -71,7 +71,7 @@ ink_get_max_files()
   struct rlimit lim;
 
   // Linux-only ...
-  if ((fd = fopen("/proc/sys/fs/file-max","r"))) {
+  if ((fd = fopen("/proc/sys/fs/file-max", "r"))) {
     uint64_t fmax;
     if (fscanf(fd, "%" PRIu64 "", &fmax) == 1) {
       fclose(fd);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_sys_control.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_sys_control.h b/lib/ts/ink_sys_control.h
index 15e2b2c..7326f6b 100644
--- a/lib/ts/ink_sys_control.h
+++ b/lib/ts/ink_sys_control.h
@@ -26,7 +26,7 @@
 
 #include <sys/resource.h>
 
-rlim_t ink_max_out_rlimit(int which, bool max_it=true, bool unlim_it=true);
+rlim_t ink_max_out_rlimit(int which, bool max_it = true, bool unlim_it = true);
 rlim_t ink_get_max_files();
 
 #endif /*_INK_SYS_CONTROL_H*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_syslog.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_syslog.cc b/lib/ts/ink_syslog.cc
index e8e637c..65f8d04 100644
--- a/lib/ts/ink_syslog.cc
+++ b/lib/ts/ink_syslog.cc
@@ -30,33 +30,30 @@
  ****************************************************************************/
 #include "libts.h"
 
-struct syslog_fac
-{
+struct syslog_fac {
   char *long_str;
   char *short_str;
   int fac_int;
 };
 
-static const syslog_fac convert_table[] = {
-  {(char *) "LOG_KERN", (char *) "KERN", LOG_KERN},
-  {(char *) "LOG_USER", (char *) "USER", LOG_USER},
-  {(char *) "LOG_MAIL", (char *) "MAIL", LOG_MAIL},
-  {(char *) "LOG_DAEMON", (char *) "DAEMON", LOG_DAEMON},
-  {(char *) "LOG_AUTH", (char *) "AUTH", LOG_AUTH},
-  {(char *) "LOG_LPR", (char *) "LPR", LOG_LPR},
-  {(char *) "LOG_NEWS", (char *) "NEWS", LOG_NEWS},
-  {(char *) "LOG_UUCP", (char *) "UUCP", LOG_UUCP},
-  {(char *) "LOG_CRON", (char *) "CRON", LOG_CRON},
-  {(char *) "LOG_LOCAL0", (char *) "LOCAL0", LOG_LOCAL0},
-  {(char *) "LOG_LOCAL1", (char *) "LOCAL1", LOG_LOCAL1},
-  {(char *) "LOG_LOCAL2", (char *) "LOCAL2", LOG_LOCAL2},
-  {(char *) "LOG_LOCAL3", (char *) "LOCAL3", LOG_LOCAL3},
-  {(char *) "LOG_LOCAL4", (char *) "LOCAL4", LOG_LOCAL4},
-  {(char *) "LOG_LOCAL5", (char *) "LOCAL5", LOG_LOCAL5},
-  {(char *) "LOG_LOCAL6", (char *) "LOCAL6", LOG_LOCAL6},
-  {(char *) "LOG_LOCAL7", (char *) "LOCAL7", LOG_LOCAL7},
-  {(char *) "INVALID_LOG_FAC", (char *) "INVALID", -1}
-};
+static const syslog_fac convert_table[] = {{(char *)"LOG_KERN", (char *) "KERN", LOG_KERN},
+                                           {(char *)"LOG_USER", (char *) "USER", LOG_USER},
+                                           {(char *)"LOG_MAIL", (char *) "MAIL", LOG_MAIL},
+                                           {(char *)"LOG_DAEMON", (char *) "DAEMON", LOG_DAEMON},
+                                           {(char *)"LOG_AUTH", (char *) "AUTH", LOG_AUTH},
+                                           {(char *)"LOG_LPR", (char *) "LPR", LOG_LPR},
+                                           {(char *)"LOG_NEWS", (char *) "NEWS", LOG_NEWS},
+                                           {(char *)"LOG_UUCP", (char *) "UUCP", LOG_UUCP},
+                                           {(char *)"LOG_CRON", (char *) "CRON", LOG_CRON},
+                                           {(char *)"LOG_LOCAL0", (char *) "LOCAL0", LOG_LOCAL0},
+                                           {(char *)"LOG_LOCAL1", (char *) "LOCAL1", LOG_LOCAL1},
+                                           {(char *)"LOG_LOCAL2", (char *) "LOCAL2", LOG_LOCAL2},
+                                           {(char *)"LOG_LOCAL3", (char *) "LOCAL3", LOG_LOCAL3},
+                                           {(char *)"LOG_LOCAL4", (char *) "LOCAL4", LOG_LOCAL4},
+                                           {(char *)"LOG_LOCAL5", (char *) "LOCAL5", LOG_LOCAL5},
+                                           {(char *)"LOG_LOCAL6", (char *) "LOCAL6", LOG_LOCAL6},
+                                           {(char *)"LOG_LOCAL7", (char *) "LOCAL7", LOG_LOCAL7},
+                                           {(char *)"INVALID_LOG_FAC", (char *) "INVALID", -1}};
 static const int convert_table_size = sizeof(convert_table) / sizeof(syslog_fac) - 1;
 
 // int facility_string_to_int(const char* str)
@@ -69,7 +66,6 @@ static const int convert_table_size = sizeof(convert_table) / sizeof(syslog_fac)
 int
 facility_string_to_int(const char *str)
 {
-
   if (str == NULL) {
     return -1;
   }
@@ -78,7 +74,6 @@ facility_string_to_int(const char *str)
     if (strcasecmp(convert_table[i].long_str, str) == 0 || strcasecmp(convert_table[i].short_str, str) == 0) {
       return convert_table[i].fac_int;
     }
-
   }
   return -1;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_thread.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_thread.cc b/lib/ts/ink_thread.cc
index 3894d38..ef38815 100644
--- a/lib/ts/ink_thread.cc
+++ b/lib/ts/ink_thread.cc
@@ -43,9 +43,9 @@ static int64_t ink_semaphore_count = 0;
 #endif
 
 void
-ink_sem_init(ink_semaphore * sp, unsigned int count)
+ink_sem_init(ink_semaphore *sp, unsigned int count)
 {
-  // Darwin has sem_open, but not sem_init. We emulate sem_init with sem_open.
+// Darwin has sem_open, but not sem_init. We emulate sem_init with sem_open.
 #if TS_EMULATE_ANON_SEMAPHORES
   char sname[NAME_MAX];
 
@@ -63,7 +63,7 @@ ink_sem_init(ink_semaphore * sp, unsigned int count)
 }
 
 void
-ink_sem_destroy(ink_semaphore * sp)
+ink_sem_destroy(ink_semaphore *sp)
 {
 #if TS_EMULATE_ANON_SEMAPHORES
   ink_assert(sem_close(sp->get()) != -1);
@@ -73,24 +73,26 @@ ink_sem_destroy(ink_semaphore * sp)
 }
 
 void
-ink_sem_wait(ink_semaphore * sp)
+ink_sem_wait(ink_semaphore *sp)
 {
   int r;
-  while (EINTR == (r = sem_wait(sp->get())));
+  while (EINTR == (r = sem_wait(sp->get())))
+    ;
   ink_assert(!r);
 }
 
 bool
-ink_sem_trywait(ink_semaphore * sp)
+ink_sem_trywait(ink_semaphore *sp)
 {
   int r;
-  while (EINTR == (r = sem_trywait(sp->get())));
+  while (EINTR == (r = sem_trywait(sp->get())))
+    ;
   ink_assert(r == 0 || (errno == EAGAIN));
   return r == 0;
 }
 
 void
-ink_sem_post(ink_semaphore * sp)
+ink_sem_post(ink_semaphore *sp)
 {
   ink_assert(sem_post(sp->get()) != -1);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_thread.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_thread.h b/lib/ts/ink_thread.h
index 0bf2829..0fa4ff7 100644
--- a/lib/ts/ink_thread.h
+++ b/lib/ts/ink_thread.h
@@ -64,13 +64,15 @@ typedef pthread_key_t ink_thread_key;
 
 struct ink_semaphore {
 #if TS_EMULATE_ANON_SEMAPHORES
-  sem_t * sema;
+  sem_t *sema;
   int64_t semid;
 #else
   sem_t sema;
 #endif
 
-  sem_t * get() {
+  sem_t *
+  get()
+  {
 #if TS_EMULATE_ANON_SEMAPHORES
     return sema;
 #else
@@ -103,7 +105,7 @@ typedef timestruc_t ink_timestruc;
 #if defined(POSIX_THREAD)
 
 static inline void
-ink_thread_key_create(ink_thread_key * key, void (*destructor) (void *value))
+ink_thread_key_create(ink_thread_key *key, void (*destructor)(void *value))
 {
   ink_assert(!pthread_key_create(key, destructor));
 }
@@ -128,7 +130,7 @@ ink_thread_key_delete(ink_thread_key key)
 
 
 static inline ink_thread
-ink_thread_create(void *(*f) (void *), void *a, int detached = 0, size_t stacksize = 0)
+ink_thread_create(void *(*f)(void *), void *a, int detached = 0, size_t stacksize = 0)
 {
   ink_thread t;
   int ret;
@@ -153,14 +155,14 @@ ink_thread_create(void *(*f) (void *), void *a, int detached = 0, size_t stacksi
    * Fix for INKqa10118.
    * If the thread has not been created successfully return 0.
    */
-  return ret ? (ink_thread) 0 : t;
+  return ret ? (ink_thread)0 : t;
 }
 
 static inline void
 ink_thread_cancel(ink_thread who)
 {
 #if defined(freebsd)
-  (void) who;
+  (void)who;
   ink_assert(!"not supported");
 #else
   int ret = pthread_cancel(who);
@@ -186,8 +188,8 @@ static inline int
 ink_thread_get_priority(ink_thread t, int *priority)
 {
 #if defined(freebsd)
-  (void) t;
-  (void) priority;
+  (void)t;
+  (void)priority;
   ink_assert(!"not supported");
   return -1;
 #else
@@ -200,7 +202,7 @@ ink_thread_get_priority(ink_thread t, int *priority)
 }
 
 static inline int
-ink_thread_sigsetmask(int how, const sigset_t * set, sigset_t * oset)
+ink_thread_sigsetmask(int how, const sigset_t *set, sigset_t *oset)
 {
   return (pthread_sigmask(how, set, oset));
 }
@@ -209,38 +211,39 @@ ink_thread_sigsetmask(int how, const sigset_t * set, sigset_t * oset)
  * Posix Semaphores
  ******************************************************************/
 
-void ink_sem_init(ink_semaphore * sp, unsigned int count);
-void ink_sem_destroy(ink_semaphore * sp);
-void ink_sem_wait(ink_semaphore * sp);
-bool ink_sem_trywait(ink_semaphore * sp);
-void ink_sem_post(ink_semaphore * sp);
+void ink_sem_init(ink_semaphore *sp, unsigned int count);
+void ink_sem_destroy(ink_semaphore *sp);
+void ink_sem_wait(ink_semaphore *sp);
+bool ink_sem_trywait(ink_semaphore *sp);
+void ink_sem_post(ink_semaphore *sp);
 
 /*******************************************************************
  * Posix Condition Variables
  ******************************************************************/
 
 static inline void
-ink_cond_init(ink_cond * cp)
+ink_cond_init(ink_cond *cp)
 {
   ink_assert(pthread_cond_init(cp, NULL) == 0);
 }
 
 static inline void
-ink_cond_destroy(ink_cond * cp)
+ink_cond_destroy(ink_cond *cp)
 {
   ink_assert(pthread_cond_destroy(cp) == 0);
 }
 
 static inline void
-ink_cond_wait(ink_cond * cp, ink_mutex * mp)
+ink_cond_wait(ink_cond *cp, ink_mutex *mp)
 {
   ink_assert(pthread_cond_wait(cp, mp) == 0);
 }
 static inline int
-ink_cond_timedwait(ink_cond * cp, ink_mutex * mp, ink_timestruc * t)
+ink_cond_timedwait(ink_cond *cp, ink_mutex *mp, ink_timestruc *t)
 {
   int err;
-  while (EINTR == (err = pthread_cond_timedwait(cp, mp, t)));
+  while (EINTR == (err = pthread_cond_timedwait(cp, mp, t)))
+    ;
 #if defined(freebsd) || defined(openbsd)
   ink_assert((err == 0) || (err == ETIMEDOUT));
 #else
@@ -250,13 +253,13 @@ ink_cond_timedwait(ink_cond * cp, ink_mutex * mp, ink_timestruc * t)
 }
 
 static inline void
-ink_cond_signal(ink_cond * cp)
+ink_cond_signal(ink_cond *cp)
 {
   ink_assert(pthread_cond_signal(cp) == 0);
 }
 
 static inline void
-ink_cond_broadcast(ink_cond * cp)
+ink_cond_broadcast(ink_cond *cp)
 {
   ink_assert(pthread_cond_broadcast(cp) == 0);
 }
@@ -277,7 +280,7 @@ ink_thread_exit(void *status)
 // Linux specific... Feel free to add support for other platforms
 // that has a feature to give a thread specific name / tag.
 static inline void
-ink_set_thread_name(const char* name ATS_UNUSED)
+ink_set_thread_name(const char *name ATS_UNUSED)
 {
 #if defined(HAVE_PTHREAD_SETNAME_NP_1)
   pthread_setname_np(name);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_time.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_time.cc b/lib/ts/ink_time.cc
index a40b9f4..38f47fe 100644
--- a/lib/ts/ink_time.cc
+++ b/lib/ts/ink_time.cc
@@ -85,16 +85,14 @@ ink_microseconds(int which)
 double
 ink_time_wall_seconds()
 {
-
   struct timeval s_val;
 
   gettimeofday(&s_val, 0);
-  return ((double) s_val.tv_sec + 0.000001 * s_val.tv_usec);
-}                               /* End ink_time_wall_seconds */
+  return ((double)s_val.tv_sec + 0.000001 * s_val.tv_usec);
+} /* End ink_time_wall_seconds */
 
 
-struct dtconv
-{
+struct dtconv {
   char *abbrev_month_names[12];
   char *month_names[12];
   char *abbrev_weekday_names[7];
@@ -108,14 +106,13 @@ struct dtconv
 };
 
 
-
 /*
  * The man page for cftime lies. It claims that it is thread safe.
  * Instead, it silently trashes the heap (by freeing things more than
  * once) when used in a mulithreaded program. Gack!
  */
 int
-cftime_replacement(char *s, int maxsize, const char *format, const time_t * clock)
+cftime_replacement(char *s, int maxsize, const char *format, const time_t *clock)
 {
   struct tm tm;
 
@@ -127,24 +124,22 @@ cftime_replacement(char *s, int maxsize, const char *format, const time_t * cloc
 #undef cftime
 /* Throw an error if they ever call plain-old cftime. */
 int
-cftime(char *s, char *format, const time_t * clock)
+cftime(char *s, char *format, const time_t *clock)
 {
-  (void) s;
-  (void) format;
-  (void) clock;
+  (void)s;
+  (void)format;
+  (void)clock;
   printf("ERROR cftime is not thread safe -- call cftime_replacement\n");
   ink_assert(!"cftime");
   return 0;
 }
 
-#define DAYS_OFFSET  25508
+#define DAYS_OFFSET 25508
 
 ink_time_t
-convert_tm(const struct tm * tp)
+convert_tm(const struct tm *tp)
 {
-  static const int days[12] = {
-    305, 336, -1, 30, 60, 91, 121, 152, 183, 213, 244, 274
-  };
+  static const int days[12] = {305, 336, -1, 30, 60, 91, 121, 152, 183, 213, 244, 274};
 
   ink_time_t t;
   int year;
@@ -156,8 +151,8 @@ convert_tm(const struct tm * tp)
   mday = tp->tm_mday;
 
   /* what should we do? */
-  if ((year<70) || (year> 137))
-    return (ink_time_t) UNDEFINED_TIME;
+  if ((year < 70) || (year > 137))
+    return (ink_time_t)UNDEFINED_TIME;
 
   mday += days[month];
   /* month base == march */
@@ -172,13 +167,13 @@ convert_tm(const struct tm * tp)
 }
 
 char *
-ink_ctime_r(const ink_time_t * clock, char *buf)
+ink_ctime_r(const ink_time_t *clock, char *buf)
 {
   return ctime_r(clock, buf);
 }
 
 struct tm *
-ink_localtime_r(const ink_time_t * clock, struct tm *res)
+ink_localtime_r(const ink_time_t *clock, struct tm *res)
 {
   return localtime_r(clock, res);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_time.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_time.h b/lib/ts/ink_time.h
index 04d3b1a..1da2373 100644
--- a/lib/ts/ink_time.h
+++ b/lib/ts/ink_time.h
@@ -32,7 +32,7 @@
  ****************************************************************************/
 
 #ifndef _ink_time_h_
-#define	_ink_time_h_
+#define _ink_time_h_
 
 #include "ink_platform.h"
 #include "ink_defs.h"
@@ -60,13 +60,13 @@ typedef time_t ink_time_t;
 uint64_t ink_microseconds(int which);
 double ink_time_wall_seconds();
 
-int cftime_replacement(char *s, int maxsize, const char *format, const time_t * clock);
+int cftime_replacement(char *s, int maxsize, const char *format, const time_t *clock);
 #define cftime(s, format, clock) cftime_replacement(s, 8192, format, clock)
 
 ink_time_t convert_tm(const struct tm *tp);
 
-inkcoreapi char *ink_ctime_r(const ink_time_t * clock, char *buf);
-inkcoreapi struct tm *ink_localtime_r(const ink_time_t * clock, struct tm *res);
+inkcoreapi char *ink_ctime_r(const ink_time_t *clock, char *buf);
+inkcoreapi struct tm *ink_localtime_r(const ink_time_t *clock, struct tm *res);
 
 /*===========================================================================*
                               Inline Stuffage
@@ -82,7 +82,7 @@ ink_timezone()
   return tzp.tz_minuteswest * 60;
 }
 
-#else  // non-freebsd, non-openbsd for the else
+#else // non-freebsd, non-openbsd for the else
 
 inline int
 ink_timezone()

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/libts.h
----------------------------------------------------------------------
diff --git a/lib/ts/libts.h b/lib/ts/libts.h
index 8a3d9fa..d244158 100644
--- a/lib/ts/libts.h
+++ b/lib/ts/libts.h
@@ -34,8 +34,8 @@
 
  */
 
-#if !defined (_inktomiplus_h_)
-#define	_inktomiplus_h_
+#if !defined(_inktomiplus_h_)
+#define _inktomiplus_h_
 
 /* Removed for now, to fix build on Solaris
 #define std *** _FIXME_REMOVE_DEPENDENCY_ON_THE_STL_ ***

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/llqueue.cc
----------------------------------------------------------------------
diff --git a/lib/ts/llqueue.cc b/lib/ts/llqueue.cc
index 81125e2..414ecb6 100644
--- a/lib/ts/llqueue.cc
+++ b/lib/ts/llqueue.cc
@@ -38,9 +38,9 @@
 // were supposed to work, but #ifdef'ing them out of here for now.
 #ifdef NOT_USED_HERE
 static LLQrec *
-newrec(LLQ * Q)
+newrec(LLQ *Q)
 {
-  LLQrec * new_val;
+  LLQrec *new_val;
   int i;
 
   if (Q->free != NULL) {
@@ -64,7 +64,7 @@ newrec(LLQ * Q)
 
 // Not used either ...
 static void
-freerec(LLQ * Q, LLQrec * rec)
+freerec(LLQ *Q, LLQrec *rec)
 {
   rec->next = Q->free;
   Q->free = rec;
@@ -74,7 +74,7 @@ freerec(LLQ * Q, LLQrec * rec)
 LLQ *
 create_queue()
 {
-  LLQ * new_val = (LLQ *)ats_malloc(sizeof(LLQ));
+  LLQ *new_val = (LLQ *)ats_malloc(sizeof(LLQ));
 
   ink_sem_init(&(new_val->sema), 0);
   ink_mutex_init(&(new_val->mux), "LLQ::create_queue");
@@ -87,7 +87,7 @@ create_queue()
 
 // matching delete function, only for empty queue!
 void
-delete_queue(LLQ * Q)
+delete_queue(LLQ *Q)
 {
   // There seems to have been some ideas of making sure that this queue is
   // actually empty ...
@@ -100,9 +100,9 @@ delete_queue(LLQ * Q)
 }
 
 int
-enqueue(LLQ * Q, void *data)
+enqueue(LLQ *Q, void *data)
 {
-  LLQrec * new_val;
+  LLQrec *new_val;
 
   ink_mutex_acquire(&(Q->mux));
   new_val = (LLQrec *)ats_malloc(sizeof(LLQrec));
@@ -125,7 +125,7 @@ enqueue(LLQ * Q, void *data)
 }
 
 uint64_t
-queue_len(LLQ * Q)
+queue_len(LLQ *Q)
 {
   uint64_t len;
 
@@ -137,7 +137,7 @@ queue_len(LLQ * Q)
 }
 
 uint64_t
-queue_highwater(LLQ * Q)
+queue_highwater(LLQ *Q)
 {
   uint64_t highwater;
 
@@ -149,7 +149,6 @@ queue_highwater(LLQ * Q)
 }
 
 
-
 /*
  *---------------------------------------------------------------------------
  *
@@ -170,7 +169,7 @@ queue_highwater(LLQ * Q)
  *---------------------------------------------------------------------------
  */
 bool
-queue_is_empty(LLQ * Q)
+queue_is_empty(LLQ *Q)
 {
   uint64_t len;
 
@@ -180,16 +179,15 @@ queue_is_empty(LLQ * Q)
 }
 
 void *
-dequeue(LLQ * Q)
+dequeue(LLQ *Q)
 {
-  LLQrec * rec;
+  LLQrec *rec;
   void *d;
   ink_sem_wait(&(Q->sema));
   ink_mutex_acquire(&(Q->mux));
 
 
   if (Q->head == NULL) {
-
     ink_mutex_release(&(Q->mux));
 
     return NULL;
@@ -202,7 +200,7 @@ dequeue(LLQ * Q)
     Q->tail = NULL;
 
   d = rec->data;
-//freerec(Q, rec);
+  // freerec(Q, rec);
   ats_free(rec);
 
   Q->len--;
@@ -212,7 +210,6 @@ dequeue(LLQ * Q)
 }
 
 
-
 #ifdef LLQUEUE_MAIN
 
 void *
@@ -227,12 +224,12 @@ testfun(void *unused)
   do {
     scanf("%d", &num);
     if (num == 0) {
-      printf("DEQUEUE: %d\n", (int) dequeue(Q));
+      printf("DEQUEUE: %d\n", (int)dequeue(Q));
     } else if (num == -1) {
       printf("queue_is_empty: %d\n", queue_is_empty(Q));
     } else {
       printf("enqueue: %d\n", num);
-      enqueue(Q, (void *) num);
+      enqueue(Q, (void *)num);
     }
   } while (num >= -1);
 
@@ -245,7 +242,7 @@ testfun(void *unused)
 void
 main()
 {
-  assert(thr_create(NULL, 0, testfun, (void *) NULL, THR_NEW_LWP, NULL) == 0);
+  assert(thr_create(NULL, 0, testfun, (void *)NULL, THR_NEW_LWP, NULL) == 0);
   while (1) {
     ;
   }


Mime
View raw message