[hipl-commit] [trunk] Rev 4499: Directly return 0 / -1 instead of using weird nonstandard definitions.

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Wed, 12 May 2010 16:56:07 +0300

Committer: Diego Biurrun <diego@xxxxxxxxxx>
Date: 12/05/2010 at 16:56:07
Revision: 4499
Revision-id: diego@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: trunk

Log:
  Directly return 0 / -1 instead of using weird nonstandard definitions.

Modified:
  M  hipd/hit_to_ip.c
  M  hipd/netdev.c
  M  hipd/nsupdate.c

=== modified file 'hipd/hit_to_ip.c'
--- hipd/hit_to_ip.c    2010-04-29 14:59:33 +0000
+++ hipd/hit_to_ip.c    2010-05-12 13:55:00 +0000
@@ -24,8 +24,6 @@
 #include "maintenance.h"
 #include "lib/conf/conf.h"
 
-//  value to return by the function
-#define ERR -1
 
 int hip_hit_to_ip_status = 0;
 
@@ -95,7 +93,7 @@
 static int hip_get_hit_to_ip_hostname(const hip_hit_t *hit, const char 
*hostname, const int hostname_len)
 {
     if ((hit == NULL) || (hostname == NULL)) {
-        return ERR;
+        return -1;
     }
 
     uint8_t *bytes = (uint8_t *) hit->s6_addr;
@@ -114,7 +112,7 @@
         strncpy(cp, hip_hit_to_ip_zone, hostname_len - 64);
     }
 
-    return OK;
+    return 0;
 }
 
 /**
@@ -137,11 +135,11 @@
     int res;
 
     if ((hit == NULL) || (retval == NULL)) {
-        return ERR;
+        return -1;
     }
 
-    if (hip_get_hit_to_ip_hostname(hit, hit_to_ip_hostname, 
sizeof(hit_to_ip_hostname)) != OK) {
-        return ERR;
+    if (hip_get_hit_to_ip_hostname(hit, hit_to_ip_hostname, 
sizeof(hit_to_ip_hostname)) != 0) {
+        return -1;
     }
 
     memset(&hints, 0, sizeof(hints));
@@ -159,7 +157,7 @@
 
     if (res != 0) {
         HIP_DEBUG("getaddrinfo error %s\n", gai_strerror(res));
-        return ERR;
+        return -1;
     }
 
     /* Look at the list and return only one address, let us prefer AF_INET */
@@ -183,8 +181,8 @@
     }
 
     if (found_addr) {
-        return OK;
+        return 0;
     } else {
-        return ERR;
+        return -1;
     }
 }

=== modified file 'hipd/netdev.c'
--- hipd/netdev.c       2010-04-29 14:59:33 +0000
+++ hipd/netdev.c       2010-05-12 13:55:00 +0000
@@ -834,7 +834,7 @@
         HIP_DEBUG("operation may take a while..\n");
         int res = hip_hit_to_ip(hit, addr);
 
-        if (res == OK) {
+        if (res == 0) {
             HIP_DEBUG_IN6ADDR("found hit-to-ip addr ", addr);
             err = 0;
             goto out_err;

=== modified file 'hipd/nsupdate.c'
--- hipd/nsupdate.c     2010-04-16 18:44:39 +0000
+++ hipd/nsupdate.c     2010-05-12 13:55:00 +0000
@@ -233,7 +233,7 @@
         exit(1);         // just in case
     } else {  // PARENT
               /* We execute waitpid in SIGCHLD handler */
-        return OK;
+        return 0;
     }
 }
 
@@ -298,5 +298,5 @@
 {
     HIP_DEBUG("Updating dns records...\n");
     hip_for_each_hi(run_nsupdate_for_hit, (void *) &start);
-    return OK;
+    return 0;
 }

Other related posts:

  • » [hipl-commit] [trunk] Rev 4499: Directly return 0 / -1 instead of using weird nonstandard definitions. - Diego Biurrun