Re-indent clatd code with clang-format

clang-format --style file -i *.{c,h,cpp}

Bug: 118848635
Test: 1. browse over ipv6-only network
      2. atest clatd_test
      3. clang-format --style file -i *.{c,h,cpp}

Change-Id: I7389426101df7745370d0ac5c55176cd8fe2b08b
diff --git a/getaddr.c b/getaddr.c
index e0478cf..6f4bc86 100644
--- a/getaddr.c
+++ b/getaddr.c
@@ -15,10 +15,10 @@
  *
  * getaddr.c - get a locally configured address
  */
-#include <netinet/in.h>
-#include <strings.h>
-#include <string.h>
 #include <net/if.h>
+#include <netinet/in.h>
+#include <string.h>
+#include <strings.h>
 
 #include <linux/if_addr.h>
 #include <linux/rtnetlink.h>
@@ -26,8 +26,8 @@
 #include <netlink/msg.h>
 
 #include "getaddr.h"
-#include "netlink_msg.h"
 #include "logging.h"
+#include "netlink_msg.h"
 
 // shared state between getinterface_ip and getaddr_cb
 struct target {
@@ -39,8 +39,8 @@
 
 /* function: getaddr_cb
  * callback for getinterface_ip
- * msg  - netlink message
- * data - (struct target) info for which address we're looking for
+ *   msg  - netlink message
+ *   data - (struct target) info for which address we're looking for
  */
 static int getaddr_cb(struct nl_msg *msg, void *data) {
   struct ifaddrmsg *ifa_p;
@@ -51,24 +51,22 @@
   ifa_p = (struct ifaddrmsg *)nlmsg_data(nlmsg_hdr(msg));
   rta_p = (struct rtattr *)IFA_RTA(ifa_p);
 
-  if(ifa_p->ifa_index != targ_p->ifindex)
-    return NL_OK;
+  if (ifa_p->ifa_index != targ_p->ifindex) return NL_OK;
 
-  if(ifa_p->ifa_scope != RT_SCOPE_UNIVERSE)
-    return NL_OK;
+  if (ifa_p->ifa_scope != RT_SCOPE_UNIVERSE) return NL_OK;
 
   rta_len = RTM_PAYLOAD(nlmsg_hdr(msg));
   for (; RTA_OK(rta_p, rta_len); rta_p = RTA_NEXT(rta_p, rta_len)) {
-    switch(rta_p->rta_type) {
+    switch (rta_p->rta_type) {
       case IFA_ADDRESS:
-        if((targ_p->family == AF_INET6) && !(ifa_p->ifa_flags & IFA_F_SECONDARY)) {
+        if ((targ_p->family == AF_INET6) && !(ifa_p->ifa_flags & IFA_F_SECONDARY)) {
           memcpy(&targ_p->ip.ip6, RTA_DATA(rta_p), rta_p->rta_len - sizeof(struct rtattr));
           targ_p->foundip = 1;
           return NL_OK;
         }
         break;
       case IFA_LOCAL:
-        if(targ_p->family == AF_INET) {
+        if (targ_p->family == AF_INET) {
           memcpy(&targ_p->ip.ip4, RTA_DATA(rta_p), rta_p->rta_len - sizeof(struct rtattr));
           targ_p->foundip = 1;
           return NL_OK;
@@ -82,9 +80,9 @@
 
 /* function: error_handler
  * error callback for getinterface_ip
- * nla  - source of the error message
- * err  - netlink message
- * arg  - (struct target) info for which address we're looking for
+ *   nla  - source of the error message
+ *   err  - netlink message
+ *   arg  - (struct target) info for which address we're looking for
  */
 static int error_handler(__attribute__((unused)) struct sockaddr_nl *nla,
                          __attribute__((unused)) struct nlmsgerr *err,
@@ -93,9 +91,10 @@
 }
 
 /* function: getinterface_ip
- * finds the first global non-privacy IP of the given family for the given interface, or returns NULL.  caller frees pointer
- * interface - interface to look for
- * family    - family
+ * finds the first global non-privacy IP of the given family for the given interface, or returns
+ * NULL.  caller frees pointer
+ *   interface - interface to look for
+ *   family    - family
  */
 union anyip *getinterface_ip(const char *interface, int family) {
   struct ifaddrmsg ifa;
@@ -103,18 +102,18 @@
   struct target targ;
   union anyip *retval = NULL;
 
-  targ.family = family;
+  targ.family  = family;
   targ.foundip = 0;
   targ.ifindex = if_nametoindex(interface);
-  if(targ.ifindex == 0) {
-    return NULL; // interface not found
+  if (targ.ifindex == 0) {
+    return NULL;  // interface not found
   }
 
   memset(&ifa, 0, sizeof(ifa));
   ifa.ifa_family = targ.family;
 
   callbacks = nl_cb_alloc(NL_CB_DEFAULT);
-  if(!callbacks) {
+  if (!callbacks) {
     goto cleanup;
   }
   nl_cb_set(callbacks, NL_CB_VALID, NL_CB_CUSTOM, getaddr_cb, &targ);
@@ -123,18 +122,17 @@
   // sends message and waits for a response
   send_ifaddrmsg(RTM_GETADDR, NLM_F_REQUEST | NLM_F_ROOT, &ifa, callbacks);
 
-  if(targ.foundip) {
+  if (targ.foundip) {
     retval = malloc(sizeof(union anyip));
-    if(!retval) {
-      logmsg(ANDROID_LOG_FATAL,"getinterface_ip/out of memory");
+    if (!retval) {
+      logmsg(ANDROID_LOG_FATAL, "getinterface_ip/out of memory");
       goto cleanup;
     }
     memcpy(retval, &targ.ip, sizeof(union anyip));
   }
 
 cleanup:
-  if(callbacks)
-    nl_cb_put(callbacks);
+  if (callbacks) nl_cb_put(callbacks);
 
   return retval;
 }