PUD: pull getNodeIdAsNumber into setupNodeIdNumberForOlsrCacheAndValidateLongLong
authorFerry Huberts <f.huberts@mindef.nl>
Wed, 26 Oct 2011 09:45:16 +0000 (11:45 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 14 Feb 2012 13:32:56 +0000 (14:32 +0100)
Signed-off-by: Ferry Huberts <f.huberts@mindef.nl>
lib/pud/src/configuration.c

index 39873ea..f23bc10 100644 (file)
@@ -227,25 +227,6 @@ unsigned char * getNodeId(void) {
        return getNodeIdWithLength(NULL);
 }
 
-/**
- @param value
- A pointer to the node ID number
- @return
- - true on success
- - false otherwise
- */
-static bool getNodeIdAsNumber(unsigned long long * value) {
-       if (!nodeIdNumberSet) {
-               if (!readULL(PUD_NODE_ID_NAME, (char *) &nodeId[0],
-                               &nodeIdNumber.val)) {
-                       return false;
-               }
-               nodeIdNumberSet = true;
-       }
-       *value = nodeIdNumber.val;
-       return true;
-}
-
 /**
  Get the nodeId and its length
 
@@ -324,9 +305,14 @@ static bool setupNodeIdNumberForOlsrCacheAndValidateULongLong(
                nodeIdNumberType * valueBuffer, unsigned long long min,
                unsigned long long max,
                unsigned int bytes) {
-       if (!getNodeIdAsNumber(&valueBuffer->val)) {
-               return false;
+       if (!nodeIdNumberSet) {
+               if (!readULL(PUD_NODE_ID_NAME, (char *) &nodeId[0],
+                               &nodeIdNumber.val)) {
+                       return false;
+               }
+               nodeIdNumberSet = true;
        }
+       valueBuffer->val = nodeIdNumber.val;
 
        if (setupNodeIdNumberForOlsrCache(valueBuffer->val, min, max, bytes)) {
                return true;