Rename rde_common to bej_common

bej_common.h is a more consistant name than rde_common.h.

Also this repo only contains code related to BEJ encoding and decoding.
Therefore this change removes the rde related structs defind in the
bej_common.h. Those structs should be defined somewhere else (libpldm).

Signed-off-by: Kasun Athukorala <kasunath@google.com>
Change-Id: Ic296ece11efc0967366e197a8609c3c88c325610
diff --git a/src/rde_common.c b/src/bej_common.c
similarity index 64%
rename from src/rde_common.c
rename to src/bej_common.c
index 258a543..1d3be07 100644
--- a/src/rde_common.c
+++ b/src/bej_common.c
@@ -1,6 +1,6 @@
-#include "rde_common.h"
+#include "bej_common.h"
 
-uint64_t rdeGetUnsignedInteger(const uint8_t* bytes, uint8_t numOfBytes)
+uint64_t bejGetUnsignedInteger(const uint8_t* bytes, uint8_t numOfBytes)
 {
     uint64_t num = 0;
     for (uint8_t i = 0; i < numOfBytes; ++i)
@@ -10,15 +10,15 @@
     return num;
 }
 
-uint64_t rdeGetNnint(const uint8_t* nnint)
+uint64_t bejGetNnint(const uint8_t* nnint)
 {
     // In nnint, first byte indicate how many bytes are there. Remaining bytes
     // represent the value in little-endian format.
     const uint8_t size = *nnint;
-    return rdeGetUnsignedInteger(nnint + sizeof(uint8_t), size);
+    return bejGetUnsignedInteger(nnint + sizeof(uint8_t), size);
 }
 
-uint8_t rdeGetNnintSize(const uint8_t* nnint)
+uint8_t bejGetNnintSize(const uint8_t* nnint)
 {
     // In nnint, first byte indicate how many bytes are there.
     return *nnint + sizeof(uint8_t);
diff --git a/src/bej_decoder_core.c b/src/bej_decoder_core.c
index 877d8e4..b1688a9 100644
--- a/src/bej_decoder_core.c
+++ b/src/bej_decoder_core.c
@@ -58,7 +58,7 @@
     {
         return 0;
     }
-    uint64_t value = rdeGetUnsignedInteger(bytes, numOfBytes);
+    uint64_t value = bejGetUnsignedInteger(bytes, numOfBytes);
     uint8_t bitsInVal = numOfBytes * 8;
     // Since numOfBytes > 0, bitsInVal is non negative.
     uint64_t mask = (uint64_t)1 << (uint8_t)(bitsInVal - 1);
@@ -112,11 +112,11 @@
     // segment.
     bejGetLocalBejSFLVOffsets(params->state.encodedSubStream, &localOffset);
     struct BejSFLV* sflv = &params->sflv;
-    const uint32_t valueLength = (uint32_t)(rdeGetNnint(
+    const uint32_t valueLength = (uint32_t)(bejGetNnint(
         params->state.encodedSubStream + localOffset.valueLenNnintOffset));
     // Sequence number itself should be 16bits. Using 32bits for
     // [sequence_number + schema_type].
-    uint32_t tupleS = (uint32_t)(rdeGetNnint(params->state.encodedSubStream));
+    uint32_t tupleS = (uint32_t)(bejGetNnint(params->state.encodedSubStream));
     sflv->tupleS.schema = (uint8_t)(tupleS & DICTIONARY_TYPE_MASK);
     sflv->tupleS.sequenceNumber =
         (uint16_t)((tupleS & (~DICTIONARY_TYPE_MASK)) >>
@@ -147,7 +147,7 @@
     // being decoded.
     bejGetLocalBejSFLVOffsets(params->state.encodedSubStream, &localOffset);
     return params->state.encodedStreamOffset + localOffset.valueOffset +
-           rdeGetNnintSize(params->sflv.value);
+           bejGetNnintSize(params->sflv.value);
 }
 
 /**
@@ -344,7 +344,7 @@
     RETURN_IF_CALLBACK_IERROR(params->decodedCallback->callbackSetStart,
                               propName, params->callbacksDataPtr);
 
-    uint64_t elements = rdeGetNnint(params->sflv.value);
+    uint64_t elements = bejGetNnint(params->sflv.value);
     // If its an empty set, we are done here.
     if (elements == 0)
     {
@@ -403,7 +403,7 @@
     RETURN_IF_CALLBACK_IERROR(params->decodedCallback->callbackArrayStart,
                               propName, params->callbacksDataPtr);
 
-    uint64_t elements = rdeGetNnint(params->sflv.value);
+    uint64_t elements = bejGetNnint(params->sflv.value);
     // If its an empty array, we are done here.
     if (elements == 0)
     {
@@ -515,7 +515,7 @@
     {
         // Get the string for enum value.
         uint16_t enumValueSequenceN =
-            (uint16_t)(rdeGetNnint(params->sflv.value));
+            (uint16_t)(bejGetNnint(params->sflv.value));
         const struct BejDictionaryProperty* enumValueProp;
         RETURN_IF_IERROR(
             bejDictGetProperty(dictionary, prop->childPointerOffset,
@@ -582,24 +582,24 @@
         // nnint      - fract
         // nnint      - Length of exp
         // bejInteger - exp (includes sign for the exponent)
-        uint8_t wholeByteLen = (uint8_t)rdeGetNnint(params->sflv.value);
+        uint8_t wholeByteLen = (uint8_t)bejGetNnint(params->sflv.value);
         const uint8_t* wholeBejInt =
-            params->sflv.value + rdeGetNnintSize(params->sflv.value);
+            params->sflv.value + bejGetNnintSize(params->sflv.value);
         const uint8_t* fractZeroCountNnint = wholeBejInt + wholeByteLen;
         const uint8_t* fractNnint =
-            fractZeroCountNnint + rdeGetNnintSize(fractZeroCountNnint);
-        const uint8_t* lenExpNnint = fractNnint + rdeGetNnintSize(fractNnint);
-        const uint8_t* expBejInt = lenExpNnint + rdeGetNnintSize(lenExpNnint);
+            fractZeroCountNnint + bejGetNnintSize(fractZeroCountNnint);
+        const uint8_t* lenExpNnint = fractNnint + bejGetNnintSize(fractNnint);
+        const uint8_t* expBejInt = lenExpNnint + bejGetNnintSize(lenExpNnint);
 
         struct BejReal realValue;
         realValue.whole = bejGetIntegerValue(wholeBejInt, wholeByteLen);
-        realValue.zeroCount = rdeGetNnint(fractZeroCountNnint);
-        realValue.fract = rdeGetNnint(fractNnint);
-        realValue.expLen = (uint8_t)rdeGetNnint(lenExpNnint);
+        realValue.zeroCount = bejGetNnint(fractZeroCountNnint);
+        realValue.fract = bejGetNnint(fractNnint);
+        realValue.expLen = (uint8_t)bejGetNnint(lenExpNnint);
         if (realValue.expLen != 0)
         {
             realValue.exp = bejGetIntegerValue(
-                expBejInt, (uint8_t)rdeGetNnint(lenExpNnint));
+                expBejInt, (uint8_t)bejGetNnint(lenExpNnint));
         }
         RETURN_IF_CALLBACK_IERROR(params->decodedCallback->callbackReal,
                                   propName, &realValue,
diff --git a/src/meson.build b/src/meson.build
index 6651bda..c09268e 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,7 +1,7 @@
 libbej_lib = library(
   'libbej',
   'bej_decoder_core.c',
-  'rde_common.c',
+  'bej_common.c',
   'bej_dictionary.c',
   'bej_decoder_json.cpp',
   include_directories : libbej_incs,