PUD: only use setupNodeIdBinaryBufferForOlsrCache
authorFerry Huberts <ferry.huberts@pelagic.nl>
Fri, 3 Feb 2012 13:42:45 +0000 (14:42 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 14 Feb 2012 13:32:59 +0000 (14:32 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/pud/src/configuration.c
lib/pud/wireformat/include/OlsrdPudWireFormat/wireFormat.h
lib/pud/wireformat/src/wireFormat.c

index d68207d..890c66d 100644 (file)
@@ -379,7 +379,7 @@ static bool setupNodeIdBinaryLongLong(unsigned long long min,
        nodeIdBinaryLength = bytes;
        nodeIdBinarySet = true;
 
-       if (setupNodeIdBinaryLongForOlsrCache(nodeIdBinary.longValue, bytes)) {
+       if (setupNodeIdBinaryBufferForOlsrCache(&nodeIdBinary.longValue, bytes)) {
                return true;
        }
 
index 628c84e..9a13207 100644 (file)
@@ -885,8 +885,6 @@ static inline void setPositionUpdateHdop(PudOlsrPositionUpdate * olsrGpsMessage,
  * NodeInfo
  */
 
-bool setupNodeIdBinaryLongForOlsrCache(unsigned long long val,
-               unsigned int bytes);
 bool setupNodeIdBinaryBufferForOlsrCache(void * val, size_t bytes);
 
 /**
index 320c01a..ccceae8 100644 (file)
@@ -40,38 +40,6 @@ static unsigned char cachedNodeIdBuffer[PUD_CACHED_NODEID_BUFFER_SIZE];
 static unsigned int cachedNodeIdBufferLength = 0;
 
 /**
- Setup a nodeId number in the cachedNodeIdBuffer.
-
- @param val
- The value to setup in the cache
- @param bytes
- The number of bytes used by the number in the wire format
-
- @return
- - true when the number is valid
- - false otherwise
- */
-bool setupNodeIdBinaryLongForOlsrCache(unsigned long long val,
-               unsigned int bytes) {
-       int i = bytes - 1;
-
-       if (bytes > PUD_CACHED_NODEID_BUFFER_SIZE) {
-               return false;
-       }
-
-       while (i >= 0) {
-               cachedNodeIdBuffer[i] = val & 0xff;
-               val >>= 8;
-               i--;
-       }
-
-       assert(val == 0);
-
-       cachedNodeIdBufferLength = bytes;
-       return true;
-}
-
-/**
  Setup a nodeId buffer in the cachedNodeIdBuffer.
 
  @param val