[Epic-ID: ODUHIGH-475][Task-ID: ODUHIGH-476]Integration fixes upto PRACH scheduling...
[o-du/l2.git] / src / cm / cm_hash.c
index 2d2668d..c8c6a58 100644 (file)
 *********************************************************************21*/
   
 \f  
-/* header include files -- defines (.h) */
-
-#include "envopt.h"        /* environment options */
-#include "envdep.h"        /* environment dependent */
-#include "envind.h"        /* environment independent */
-
-#include "gen.h"           /* general */
-#include "ssi.h"           /* system services */
-#include "cm_hash.h"       /* common hash functions */
-#include "cm_err.h"        /* common functions error */
-
-/* header include -- typedef structs (.x) */
-
-#include "gen.x"           /* general */
-#include "ssi.x"           /* system services */
-#include "cm_lib.x"        /* common library functions */
-#include "cm_hash.x"       /* common hash functions */
+#include <common_def.h>
 
 \f
 /* local defines */
  extern "C" {
 #endif
 
-PRIVATE S16 cmHashFuncBCD8   ARGS((CmHashListCp *hashListCp, U8 *key, 
-                                         U16 keyLen, U16 *idx));
+static S16 cmHashFuncBCD8   ARGS((CmHashListCp *hashListCp, uint8_t *key, 
+                                         uint16_t keyLen, uint16_t *idx));
 
-PRIVATE S16 cmHashFuncConId  ARGS((CmHashListCp *hashListCp, U8 *key, 
-                                         U16 keyLen, U16 *idx));
+static S16 cmHashFuncConId  ARGS((CmHashListCp *hashListCp, uint8_t *key, 
+                                         uint16_t keyLen, uint16_t *idx));
 
-PRIVATE S16 cmHashFuncU32Mod  ARGS((CmHashListCp *hashListCp, U8 *key, 
-                                         U16 keyLen, U16 *idx));
+static S16 cmHashFuncU32Mod  ARGS((CmHashListCp *hashListCp, uint8_t *key, 
+                                         uint16_t keyLen, uint16_t *idx));
 
-PRIVATE S16 cmHashFuncString  ARGS((CmHashListCp *hashListCp, U8 *key, 
-                                         U16 keyLen, U16 *idx));
+static S16 cmHashFuncString  ARGS((CmHashListCp *hashListCp, uint8_t *key, 
+                                         uint16_t keyLen, uint16_t *idx));
 
-PRIVATE S16 cmHashFuncDefault ARGS((CmHashListCp *hashListCp, U8 *key, 
-                                         U16 keyLen, U16 *idx));
+static S16 cmHashFuncDefault ARGS((CmHashListCp *hashListCp, uint8_t *key, 
+                                         uint16_t keyLen, uint16_t *idx));
 
-PRIVATE S16 cmHashFuncAnyKey  ARGS((CmHashListCp *hashListCp, U8 *key, 
-                                         U16 keyLen, U16 *idx));
+static S16 cmHashFuncAnyKey  ARGS((CmHashListCp *hashListCp, uint8_t *key, 
+                                         uint16_t keyLen, uint16_t *idx));
 
-PRIVATE S16 cmHashMatchKey ARGS((U8 *key1, U16 keyLen1, U8 *key2, U16 keyLen2));
+static S16 cmHashMatchKey ARGS((uint8_t *key1, uint16_t keyLen1, uint8_t *key2, uint16_t keyLen2));
 
-PRIVATE S16 cmListInsert   ARGS((CmListEnt *oldEntry, CmListEnt *newEntry));
+static S16 cmListInsert   ARGS((CmListEnt *oldEntry, CmListEnt *newEntry));
 
-PRIVATE S16 cmListDelete   ARGS((CmListEnt *entry));
+static S16 cmListDelete   ARGS((CmListEnt *entry));
 
 /* cm_hash_c_001.main_22: Fixing warnings on GCC compiler */
-PRIVATE S16 cmHashFuncMult24 ARGS((CmHashListCp *hashListCp, U8 *key, U16 keyLen, U16 *idx));
+static S16 cmHashFuncMult24 ARGS((CmHashListCp *hashListCp, uint8_t *key, uint16_t keyLen, uint16_t *idx));
 
-PRIVATE S16 cmHashFuncDirIdx ARGS((CmHashListCp *hashListCp, U8 *key, U16 keyLen, U16 *idx));
+static S16 cmHashFuncDirIdx ARGS((CmHashListCp *hashListCp, uint8_t *key, uint16_t keyLen, uint16_t *idx));
 
 #ifdef __cplusplus
  }
@@ -171,26 +155,18 @@ PRIVATE S16 cmHashFuncDirIdx ARGS((CmHashListCp *hashListCp, U8 *key, U16 keyLen
 *
 */
 
-#ifdef ANSI
-PRIVATE S16 cmHashFuncAnyKey
+static S16 cmHashFuncAnyKey
 (
-CmHashListCp       *hashListCp,        /* hash list control point */
-U8                 *key,               /* key string */
-U16                keyLen,             /* length of key string */
-U16                *idx                /* idx to return */
+CmHashListCp  *hashListCp,        /* hash list control point */
+uint8_t       *key,               /* key string */
+uint16_t      keyLen,             /* length of key string */
+uint16_t      *idx                /* idx to return */
 ) 
-#else
-PRIVATE S16 cmHashFuncAnyKey (hashListCp, key, keyLen, idx)
-CmHashListCp       *hashListCp;        /* hash list control point */
-U8                 *key;               /* key string */
-U16                keyLen;             /* length of key string */
-U16                *idx;               /* idx to return */
-#endif
 {
-   U32             a;                 /* hash variables */
-   U32             b;                 /* hash variables */         
-   U32             c;                 /* hash variables */
-   U32             len;               /* length */
+   uint32_t   a;                 /* hash variables */
+   uint32_t   b;                 /* hash variables */         
+   uint32_t   c;                 /* hash variables */
+   uint32_t   len;               /* length */
 
    /*cm_hash_c_001.main_23 : Fix for TRACE5 feature crash due to missing TRC MACRO*/
    /* Set up the internal state */
@@ -202,9 +178,9 @@ U16                *idx;               /* idx to return */
    /*---------------------------------------- handle most of the key */
    while (len >= 12)
    {
-      a += (key[0] +((U32)key[1]<<8) +((U32)key[2]<<16) +((U32)key[3]<<24));
-      b += (key[4] +((U32)key[5]<<8) +((U32)key[6]<<16) +((U32)key[7]<<24));
-      c += (key[8] +((U32)key[9]<<8) +((U32)key[10]<<16)+((U32)key[11]<<24));
+      a += (key[0] +((uint32_t)key[1]<<8) +((uint32_t)key[2]<<16) +((uint32_t)key[3]<<24));
+      b += (key[4] +((uint32_t)key[5]<<8) +((uint32_t)key[6]<<16) +((uint32_t)key[7]<<24));
+      c += (key[8] +((uint32_t)key[9]<<8) +((uint32_t)key[10]<<16)+((uint32_t)key[11]<<24));
       CM_HASH_MIX(a, b, c);
       key += 12; len -= 12;
    }
@@ -213,17 +189,17 @@ U16                *idx;               /* idx to return */
    c += keyLen;
    switch(len)              /* all the case statements fall through */
    {
-   case 11: c+=((U32)key[10]<<24);
-   case 10: c+=((U32)key[9]<<16);
-   case 9 : c+=((U32)key[8]<<8);
+   case 11: c+=((uint32_t)key[10]<<24);
+   case 10: c+=((uint32_t)key[9]<<16);
+   case 9 : c+=((uint32_t)key[8]<<8);
       /* the first byte of c is reserved for the keyLen */
-   case 8 : b+=((U32)key[7]<<24);
-   case 7 : b+=((U32)key[6]<<16);
-   case 6 : b+=((U32)key[5]<<8);
+   case 8 : b+=((uint32_t)key[7]<<24);
+   case 7 : b+=((uint32_t)key[6]<<16);
+   case 6 : b+=((uint32_t)key[5]<<8);
    case 5 : b+=key[4];
-   case 4 : a+=((U32)key[3]<<24);
-   case 3 : a+=((U32)key[2]<<16);
-   case 2 : a+=((U32)key[1]<<8);
+   case 4 : a+=((uint32_t)key[3]<<24);
+   case 3 : a+=((uint32_t)key[2]<<16);
+   case 2 : a+=((uint32_t)key[1]<<8);
    case 1 : a+=key[0];
      /* case 0: nothing left to add */
    }
@@ -232,9 +208,9 @@ U16                *idx;               /* idx to return */
 
    /* if nmbBins is a power of 2, use shift, else use division */
    if (hashListCp->binBitMask != CM_HASH_NOBITMASK)
-      *idx = (U16) (c & hashListCp->binBitMask);
+      *idx = (uint16_t) (c & hashListCp->binBitMask);
    else
-      *idx = (U16) (c % hashListCp->nmbBins);
+      *idx = (uint16_t) (c % hashListCp->nmbBins);
 
    return ROK;
 } /* end of cmHashFuncAnyKey */
@@ -257,36 +233,28 @@ U16                *idx;               /* idx to return */
 *
 */
 
-#ifdef ANSI
-PRIVATE S16 cmHashFuncU32Mod
+static S16 cmHashFuncU32Mod
 (
-CmHashListCp       *hashListCp,        /* hash list control point */
-U8                 *key,               /* key string */
-U16                keyLen,             /* length of key string */
-U16                *idx                /* idx to return */
+CmHashListCp *hashListCp,        /* hash list control point */
+uint8_t      *key,               /* key string */
+uint16_t     keyLen,             /* length of key string */
+uint16_t     *idx                /* idx to return */
 ) 
-#else
-PRIVATE S16 cmHashFuncU32Mod (hashListCp, key, keyLen, idx)
-CmHashListCp       *hashListCp;        /* hash list control point */
-U8                 *key;               /* key string */
-U16                keyLen;             /* length of key string */
-U16                *idx;               /* idx to return */
-#endif
 {
-   U32             sum;                /* Sum of octets for hash function */
+   uint32_t  sum;                /* Sum of octets for hash function */
 
 
    /* keyLen is marked Unused to remove compilation 
     * warnings. */
    UNUSED(keyLen);
 
-   sum = *((U32 *)key);
+   sum = *((uint32_t *)key);
 
    /* if nmbBins is a power of 2, use shift, else use division */
    if (hashListCp->binBitMask != CM_HASH_NOBITMASK)
-      *idx = (U16) (sum & hashListCp->binBitMask);
+      *idx = (uint16_t) (sum & hashListCp->binBitMask);
    else
-      *idx = (U16) (sum % hashListCp->nmbBins);
+      *idx = (uint16_t) (sum % hashListCp->nmbBins);
 
    return ROK;
 
@@ -300,9 +268,9 @@ U16                *idx;               /* idx to return */
 *              key of type CM_HASH_KEYTYPE_BCD8. 
 *
 *       Steps:
-*              1. Converts the 8 BCD coded octets into 2 U32
-*              2. Adds 2 U32s to get one U32
-*              3. Apply U32Mod technique to get the index 
+*              1. Converts the 8 BCD coded octets into 2 uint32_t
+*              2. Adds 2 uint32_ts to get one uint32_t
+*              3. Apply uint32_tMod technique to get the index 
 *              4. Return the index
 *
 *       Note: 
@@ -317,56 +285,48 @@ U16                *idx;               /* idx to return */
 *
 */
 
-#ifdef ANSI
-PRIVATE S16 cmHashFuncBCD8
+static S16 cmHashFuncBCD8
 (
 CmHashListCp  *hashListCp,        /* hash list control point */
-U8            *key,               /* key string */
-U16           keyLen,             /* length of key string */
-U16           *idx                /* idx to return */
+uint8_t       *key,               /* key string */
+uint16_t      keyLen,             /* length of key string */
+uint16_t      *idx                /* idx to return */
 ) 
-#else
-PRIVATE S16 cmHashFuncBCD8 (hashListCp, key, keyLen, idx)
-CmHashListCp  *hashListCp;        /* hash list control point */
-U8            *key;               /* key string */
-U16           keyLen;             /* length of key string */
-U16           *idx;               /* idx to return */
-#endif
 {
-   U16      tmp16 = 0;
-   U32      firstU32 = 0;    /* First  U32 prepared for lower 4 octets */
-   U32      secondU32 = 0;   /* Second U32 prepared for higher 4 octets */
-   U32      sum;             /* Sum of the above 2 octets to get the index */
+   uint16_t  tmp16 = 0;
+   uint32_t  firstUInt32 = 0;    /* First  uint32_t prepared for lower 4 octets */
+   uint32_t  secondUInt32 = 0;   /* Second uint32_t prepared for higher 4 octets */
+   uint32_t  sum;             /* Sum of the above 2 octets to get the index */
 
 
    /* keyLen is marked Unused to remove compilation 
     * warnings. */
    UNUSED(keyLen);
 
-   /* Compute second U32 */
-   tmp16 = (U16) PutHiByte(tmp16, (U8) key[0]); 
-   tmp16 = (U16) PutLoByte(tmp16, (U8) key[1]);
-   secondU32 = (U32) PutHiWord(secondU32, (U16) tmp16); 
-   tmp16 = (U16) PutHiByte(tmp16, (U8) key[2]);
-   tmp16 = (U16) PutLoByte(tmp16, (U8) key[3]);
-   secondU32 = (U32) PutLoWord(secondU32, (U16) tmp16); 
+   /* Compute second uint32_t */
+   tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) key[0]); 
+   tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) key[1]);
+   secondUInt32 = (uint32_t) PutHiWord(secondUInt32, (uint16_t) tmp16); 
+   tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) key[2]);
+   tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) key[3]);
+   secondUInt32 = (uint32_t) PutLoWord(secondUInt32, (uint16_t) tmp16); 
 
 
-   /* Compute first U32 */
-   tmp16 = (U16) PutHiByte(tmp16, (U8) key[4]); 
-   tmp16 = (U16) PutLoByte(tmp16, (U8) key[5]);
-   firstU32 = (U32) PutHiWord(firstU32, (U16) tmp16); 
-   tmp16 = (U16) PutHiByte(tmp16, (U8) key[6]);
-   tmp16 = (U16) PutLoByte(tmp16, (U8) key[7]);
-   firstU32 = (U32) PutLoWord(firstU32, (U16) tmp16); 
+   /* Compute first uint32_t */
+   tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) key[4]); 
+   tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) key[5]);
+   firstUInt32 = (uint32_t) PutHiWord(firstUInt32, (uint16_t) tmp16); 
+   tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) key[6]);
+   tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) key[7]);
+   firstUInt32 = (uint32_t) PutLoWord(firstUInt32, (uint16_t) tmp16); 
 
-   sum = firstU32 + secondU32;
+   sum = firstUInt32 + secondUInt32;
 
    /* if nmbBins is a power of 2, use shift, else use division */
    if (hashListCp->binBitMask != CM_HASH_NOBITMASK)
-      *idx = (U16) (sum & hashListCp->binBitMask);
+      *idx = (uint16_t) (sum & hashListCp->binBitMask);
    else
-      *idx = (U16) (sum % hashListCp->nmbBins);
+      *idx = (uint16_t) (sum % hashListCp->nmbBins);
 
    return ROK;
 } /* end of cmHashFuncBCD8 () */
@@ -391,24 +351,16 @@ U16           *idx;               /* idx to return */
 *
 */
 
-#ifdef ANSI
-PRIVATE S16 cmHashFuncString
+static S16 cmHashFuncString
 (
-CmHashListCp       *hashListCp,        /* hash list control point */
-U8                 *key,               /* key string */
-U16                keyLen,             /* length of key string */
-U16                *idx                /* idx to return */
+CmHashListCp *hashListCp,        /* hash list control point */
+uint8_t      *key,               /* key string */
+uint16_t     keyLen,             /* length of key string */
+uint16_t     *idx                /* idx to return */
 ) 
-#else
-PRIVATE S16 cmHashFuncString (hashListCp, key, keyLen, idx)
-CmHashListCp       *hashListCp;        /* hash list control point */
-U8                 *key;               /* key string */
-U16                keyLen;             /* length of key string */
-U16                *idx;               /* idx to return */
-#endif
 {
-   U16             cntr;               /* Index */
-   U32             sum;                /* Sum of octets for hash function */
+   uint16_t  cntr;               /* Index */
+   uint32_t  sum;                /* Sum of octets for hash function */
 
 
    sum = 0;
@@ -420,9 +372,9 @@ U16                *idx;               /* idx to return */
 
    /* if nmbBins is a power of 2, use shift, else use division */
    if (hashListCp->binBitMask != CM_HASH_NOBITMASK)
-      *idx = (U16) (sum & hashListCp->binBitMask);
+      *idx = (uint16_t) (sum & hashListCp->binBitMask);
    else
-      *idx = (U16) (sum % hashListCp->nmbBins);
+      *idx = (uint16_t) (sum % hashListCp->nmbBins);
 
    return ROK;
 
@@ -448,37 +400,29 @@ U16                *idx;               /* idx to return */
 *
 */
 
-#ifdef ANSI
-PRIVATE S16 cmHashFuncDefault
+static S16 cmHashFuncDefault
 (
-CmHashListCp       *hashListCp,        /* hash list control point */
-U8                 *key,               /* key string */
-U16                keyLen,             /* length of key string */
-U16                *idx                /* index to return */
+CmHashListCp *hashListCp,        /* hash list control point */
+uint8_t      *key,               /* key string */
+uint16_t     keyLen,             /* length of key string */
+uint16_t     *idx                /* index to return */
 ) 
-#else
-PRIVATE S16 cmHashFuncDefault(hashListCp, key, keyLen, idx)
-CmHashListCp       *hashListCp;        /* hash list control point */
-U8                 *key;               /* key string */
-U16                keyLen;             /* length of key string */
-U16                *idx;               /* index to return */
-#endif
 {
-   U32             sum;                /* sum of key string octets */
+   uint32_t  sum;                /* sum of key string octets */
 
 
    /* add all bytes of the key */
    sum = 0;
    while (keyLen--)
-      sum += (U32) (*key++);
+      sum += (uint32_t) (*key++);
 
    /* compute index by dividing the range into the sum */
 
    /* if nmbBins is a power of 2, use shift, else use division */
    if (hashListCp->binBitMask != CM_HASH_NOBITMASK)
-      *idx = (U16) (sum & hashListCp->binBitMask);
+      *idx = (uint16_t) (sum & hashListCp->binBitMask);
    else
-      *idx = (U16) (sum % hashListCp->nmbBins);
+      *idx = (uint16_t) (sum % hashListCp->nmbBins);
 
    return ROK;
 
@@ -516,24 +460,16 @@ U16                *idx;               /* index to return */
 *
 */
 
-#ifdef ANSI
-PRIVATE S16 cmHashFuncMult24
+static S16 cmHashFuncMult24
 (
-CmHashListCp       *hashListCp,        /* hash list control point */
-U8                 *key,               /* key string */
-U16                keyLen,             /* length of key string */
-U16                *idx                /* index to return */
+CmHashListCp *hashListCp,        /* hash list control point */
+uint8_t      *key,               /* key string */
+uint16_t     keyLen,             /* length of key string */
+uint16_t     *idx                /* index to return */
 ) 
-#else
-PRIVATE S16 cmHashFuncMult24(hashListCp, key, keyLen, idx)
-CmHashListCp       *hashListCp;        /* hash list control point */
-U8                 *key;               /* key string */
-U16                keyLen;             /* length of key string */
-U16                *idx;               /* index to return */
-#endif
 {
-   U32             prod;               /* (constant multiplier * key) */
-   U8              shift;              /* Bits to be shifted to get index */
+   uint32_t  prod;               /* (constant multiplier * key) */
+   uint8_t   shift;              /* Bits to be shifted to get index */
 
 
    UNUSED(keyLen);
@@ -544,10 +480,10 @@ U16                *idx;               /* index to return */
       return RFAILED;
 #endif
 
-   prod = CM_HASH_MULT24_CONST * *((U32 *)key);
+   prod = CM_HASH_MULT24_CONST * *((uint32_t *)key);
 
    shift = CM_HASH_MULT24_BITPOS - hashListCp->nmbBinBits;
-   *idx = ((U16) (prod & (hashListCp->binBitMask << shift))) >> shift;
+   *idx = ((uint16_t) (prod & (hashListCp->binBitMask << shift))) >> shift;
 
    return ROK;
 } /* end of cmHashFuncMult24 */
@@ -563,7 +499,7 @@ U16                *idx;               /* index to return */
 *              key of type CM_HASH_KEYTYPE_CONID. 
 *
 *              This function can be used for keys that are an integer whose 
-*              size is U8, U16 or U32. Instead of adding all octets of the key,
+*              size is uint8_t, uint16_t or uint32_t. Instead of adding all octets of the key,
 *              this fn computes the "index" of the bin in which the entry
 *              needs to be inserted by taking a modulo of the integer with the 
 *              total number of bins.
@@ -578,46 +514,38 @@ U16                *idx;               /* index to return */
 *
 */
 
-#ifdef ANSI
-PRIVATE S16 cmHashFuncConId
+static S16 cmHashFuncConId
 (
-CmHashListCp       *hashListCp,        /* hash list control point */
-U8                 *key,               /* key string */
-U16                keyLen,             /* length of key string */
-U16                *idx                /* index to return */
+CmHashListCp *hashListCp,        /* hash list control point */
+uint8_t      *key,               /* key string */
+uint16_t     keyLen,             /* length of key string */
+uint16_t     *idx                /* index to return */
 ) 
-#else
-PRIVATE S16 cmHashFuncConId(hashListCp, key, keyLen, idx)
-CmHashListCp       *hashListCp;        /* hash list control point */
-U8                 *key;               /* key string */
-U16                keyLen;             /* length of key string */
-U16                *idx;               /* index to return */
-#endif
 {
 
 
    /* switch based on the length of the key */
    switch (keyLen)
    {
-      case CM_HASHKEYLEN_U32:
+      case CM_HASHKEYLEN_UINT32:
         if (hashListCp->binBitMask != CM_HASH_NOBITMASK)
-         *idx = (U16) (((U32) *((U32 *)key)) & hashListCp->binBitMask);
+         *idx = (uint16_t) (((uint32_t) *((uint32_t *)key)) & hashListCp->binBitMask);
         else
-         *idx = (U16) (((U32) *((U32 *)key)) % hashListCp->nmbBins);  
+         *idx = (uint16_t) (((uint32_t) *((uint32_t *)key)) % hashListCp->nmbBins);  
         break;
 
-      case CM_HASHKEYLEN_U16:
+      case CM_HASHKEYLEN_UINT16:
          if (hashListCp->binBitMask != CM_HASH_NOBITMASK)
-           *idx = (U16) (((U16)*((U16 *)key)) & hashListCp->binBitMask);
+           *idx = (uint16_t) (((uint16_t)*((uint16_t *)key)) & hashListCp->binBitMask);
          else
-           *idx = (U16) (((U16)*((U16 *)key)) % hashListCp->nmbBins);
+           *idx = (uint16_t) (((uint16_t)*((uint16_t *)key)) % hashListCp->nmbBins);
          break;
 
-      case CM_HASHKEYLEN_U8:
+      case CM_HASHKEYLEN_UINT8:
          if (hashListCp->binBitMask != CM_HASH_NOBITMASK)
-           *idx = (U16) (((U8)*((U8 *)key)) & hashListCp->binBitMask);
+           *idx = (uint16_t) (((uint8_t)*((uint8_t *)key)) & hashListCp->binBitMask);
          else
-           *idx = (U16) (((U8)*((U8 *)key)) % hashListCp->nmbBins);
+           *idx = (uint16_t) (((uint8_t)*((uint8_t *)key)) % hashListCp->nmbBins);
          break;
 
       default:
@@ -646,27 +574,19 @@ U16                *idx;               /* index to return */
 *
 */
 
-#ifdef ANSI
-PRIVATE S16 cmHashFuncDirIdx
+static S16 cmHashFuncDirIdx
 (
-CmHashListCp       *hashListCp,        /* hash list control point */
-U8                 *key,               /* key string */
-U16                keyLen,             /* length of key string */
-U16                *idx                /* index to return */
+CmHashListCp *hashListCp,        /* hash list control point */
+uint8_t      *key,               /* key string */
+uint16_t     keyLen,             /* length of key string */
+uint16_t     *idx                /* index to return */
 ) 
-#else
-PRIVATE S16 cmHashFuncDirIdx(hashListCp, key, keyLen, idx)
-CmHashListCp       *hashListCp;        /* hash list control point */
-U8                 *key;               /* key string */
-U16                keyLen;             /* length of key string */
-U16                *idx;               /* index to return */
-#endif
 {
 
    UNUSED(hashListCp);
    UNUSED(keyLen);
 
-   *idx = *((U16 *) key);
+   *idx = *((uint16_t *) key);
 
    return ROK;
 } /* end of cmHashFuncDirIdx */
@@ -687,21 +607,13 @@ U16                *idx;               /* index to return */
 *
 */
 
-#ifdef ANSI
-PRIVATE S16 cmHashMatchKey
+static S16 cmHashMatchKey
 (
-U8 *key1,                         /* first key string */
-U16 keyLen1,                      /* length of first key string */
-U8 *key2,                         /* second key string */
-U16 keyLen2                       /* length of second key string */
+uint8_t *key1,                         /* first key string */
+uint16_t keyLen1,                      /* length of first key string */
+uint8_t *key2,                         /* second key string */
+uint16_t keyLen2                       /* length of second key string */
 ) 
-#else
-PRIVATE S16 cmHashMatchKey(key1, keyLen1, key2, keyLen2)
-U8 *key1;                         /* first key string */
-U16 keyLen1;                      /* length of first key string */
-U8 *key2;                         /* second key string */
-U16 keyLen2;                      /* length of second key string */
-#endif
 {
 
    /* compare key lengths */
@@ -727,17 +639,11 @@ U16 keyLen2;                      /* length of second key string */
 *
 */
 
-#ifdef ANSI
-PRIVATE S16 cmListInsert
+static S16 cmListInsert
 (
 CmListEnt *oldEntry,                    /* add new entry after this entry */
 CmListEnt *newEntry                     /* new entry to add */
 ) 
-#else
-PRIVATE S16 cmListInsert(oldEntry, newEntry) 
-CmListEnt *oldEntry;                    /* add new entry after this entry */
-CmListEnt *newEntry;                    /* new entry to add */
-#endif
 {
 
    newEntry->next         = oldEntry->next;
@@ -763,15 +669,10 @@ CmListEnt *newEntry;                    /* new entry to add */
 *
 */
 
-#ifdef ANSI
-PRIVATE S16 cmListDelete
+static S16 cmListDelete
 (
 CmListEnt *entry                        /* entry to delete */
 ) 
-#else
-PRIVATE S16 cmListDelete(entry) 
-CmListEnt *entry;                       /* entry to delete */
-#endif
 {
 
    if (entry == NULLP) 
@@ -824,29 +725,18 @@ CmListEnt *entry;                       /* entry to delete */
 *       File:  cm_hash.c
 *
 */
-#ifdef ANSI
 S16 cmHashListInit
 (
 CmHashListCp *hashListCp,  /* hash list to initialize */
-U16          nmbBins,      /* number of hash list bins */
-U16          offset,       /* offset of CmHashListEnt in entries */
+uint16_t     nmbBins,      /* number of hash list bins */
+uint16_t     offset,       /* offset of CmHashListEnt in entries */
 Bool         dupFlg,       /* allow duplicate keys */
-U16          keyType,      /* key type for selecting hash fn */
+uint16_t     keyType,      /* key type for selecting hash fn */
 Region       region,       /* memory region to allocate bins */
 Pool         pool          /* memory pool to allocate bins */
 )
-#else
-S16 cmHashListInit(hashListCp, nmbBins, offset, dupFlg, keyType, region, pool)
-CmHashListCp *hashListCp;  /* hash list to initialize */
-U16          nmbBins;      /* number of hash list bins */
-U16          offset;       /* offset of CmHashListEnt in entries */
-Bool         dupFlg;       /* allow duplicate keys */
-U16          keyType;      /* key type for selecting hash fn */
-Region       region;       /* memory region to allocate bins */
-Pool         pool;         /* memory pool to allocate bins */
-#endif
 {
-   U16 i;
+   uint16_t i;
 #ifndef CM_MT_HASH_BIN
    CmListEnt *hl;
 #else
@@ -894,7 +784,7 @@ Pool         pool;         /* memory pool to allocate bins */
          hashListCp->hashFunc = cmHashFuncString;
          break;
 
-      case CM_HASH_KEYTYPE_U32MOD:
+      case CM_HASH_KEYTYPE_UINT32_MOD:
          hashListCp->hashFunc = cmHashFuncU32Mod;
          break;
 
@@ -920,11 +810,11 @@ Pool         pool;         /* memory pool to allocate bins */
    if (nmbBins)
    {
 #ifndef CM_MT_HASH_BIN
-      if (SGetSBuf(region, pool, (Data **) &hashListCp->hl, 
+      if (SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,region, pool, (Data **) &hashListCp->hl, 
                    (Size) (nmbBins * sizeof(CmListEnt))) != ROK)
          return RFAILED;
 #else
-      if (SGetSBuf(region, pool, (Data **) &hashListCp->hl, 
+      if (SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,region, pool, (Data **) &hashListCp->hl, 
                    (Size) (nmbBins * sizeof(CmListBinEnt))) != ROK)
          return RFAILED;
 #endif
@@ -950,7 +840,7 @@ Pool         pool;         /* memory pool to allocate bins */
       /* initialize bin bit mask */
       if (((nmbBins) & (nmbBins - 1)) == 0)
       {
-         U16   binBitMask;
+         uint16_t   binBitMask;
 
          /* number of bins is a power of 2 */
          hashListCp->binBitMask = nmbBins - 1;
@@ -982,15 +872,10 @@ Pool         pool;         /* memory pool to allocate bins */
 *       File:  cm_hash.c
 *
 */
-#ifdef ANSI
 S16 cmHashListDeinit
 (
 CmHashListCp *hashListCp   /* hash list to deinitialize */
 )
-#else
-S16 cmHashListDeinit(hashListCp)
-CmHashListCp *hashListCp;  /* hash list to deinitialize */
-#endif
 {
 
 #if (ERRCLASS & ERRCLS_DEBUG)
@@ -1002,11 +887,11 @@ CmHashListCp *hashListCp;  /* hash list to deinitialize */
    /* deallocate memory for bins */
    if (hashListCp->nmbBins)
 #ifndef CM_MT_HASH_BIN
-      (Void) SPutSBuf(hashListCp->region, hashListCp->pool, 
+      (Void) SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,hashListCp->region, hashListCp->pool, 
                       (Data *) hashListCp->hl, 
                       (Size) (hashListCp->nmbBins * sizeof(CmListEnt)));
 #else
-      (Void) SPutSBuf(hashListCp->region, hashListCp->pool, 
+      (Void) SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,hashListCp->region, hashListCp->pool, 
                       (Data *) hashListCp->hl, 
                       (Size) (hashListCp->nmbBins * sizeof(CmListBinEnt)));
 #endif
@@ -1050,25 +935,17 @@ CmHashListCp *hashListCp;  /* hash list to deinitialize */
 *
 */
 
-#ifdef ANSI
 S16 cmHashListInsert
 (
 CmHashListCp *hashListCp,  /* hash list to add to */
 PTR          entry,        /* entry to add */
-U8           *key,         /* pointer to key */
-U16          keyLen        /* length of key */
+uint8_t      *key,         /* pointer to key */
+uint16_t     keyLen        /* length of key */
 )
-#else
-S16 cmHashListInsert(hashListCp, entry, key, keyLen)
-CmHashListCp *hashListCp;  /* hash list to add to */
-PTR          entry;        /* entry to add */
-U8           *key;         /* pointer to key */
-U16          keyLen;       /* length of key */
-#endif
 {
    CmHashListEnt *hashListEnt;    /* pointer to hash list entry header */
    PTR dupEntry;                  /* pointer to entry with duplicate key */
-   U16 idx;                       /* index for insertion into hash list */
+   uint16_t idx;                       /* index for insertion into hash list */
 
 
 #if (ERRCLASS & ERRCLS_DEBUG)
@@ -1087,7 +964,7 @@ U16          keyLen;       /* length of key */
    }
 
    /* get pointer to hash list entry header */
-   hashListEnt = (CmHashListEnt *) (((U8 *) entry) + hashListCp->offset);
+   hashListEnt = (CmHashListEnt *) (((uint8_t *) entry) + hashListCp->offset);
 
    /* initialize hash list entry header */
    hashListEnt->list.next = NULLP;
@@ -1133,21 +1010,15 @@ U16          keyLen;       /* length of key */
 *
 */
 
-#ifdef ANSI
 S16 cmHashListDelete
 (
 CmHashListCp *hashListCp,  /* hash list to delete from */
 PTR          entry         /* entry to delete */
 )
-#else
-S16 cmHashListDelete(hashListCp, entry)
-CmHashListCp *hashListCp;  /* hash list to delete from */
-PTR          entry;        /* entry to delete */
-#endif
 {
    CmHashListEnt *hashListEnt;    /* pointer to hash list entry header */
 #ifdef CM_MT_HASH_BIN
-   U16 idx;           /* index for selecting the right hash list bin */
+   uint16_t idx;           /* index for selecting the right hash list bin */
 #endif
 
 
@@ -1158,7 +1029,7 @@ PTR          entry;        /* entry to delete */
 #endif
 
    /* get pointer to hash list entry header */
-   hashListEnt = (CmHashListEnt *) (((U8 *) entry) + hashListCp->offset);
+   hashListEnt = (CmHashListEnt *) (((uint8_t *) entry) + hashListCp->offset);
 
    /* check if entry is already deleted if yes then return OK */
    if((hashListEnt->list.next == NULLP) ||
@@ -1216,33 +1087,24 @@ PTR          entry;        /* entry to delete */
 *
 */
 
-#ifdef ANSI
 S16 cmHashListFind
 (
 CmHashListCp *hashListCp,  /* hash list to search */
-U8           *key,         /* pointer to key */
-U16          keyLen,       /* length of key */
-U16          seqNmb,       /* used in case of duplicate keys */
+uint8_t      *key,         /* pointer to key */
+uint16_t     keyLen,       /* length of key */
+uint16_t     seqNmb,       /* used in case of duplicate keys */
 PTR          *entry        /* entry to be returned */
 )
-#else
-S16 cmHashListFind(hashListCp, key, keyLen, seqNmb, entry)
-CmHashListCp *hashListCp;  /* hash list to search */
-U8           *key;         /* pointer to key */
-U16          keyLen;       /* length of key */
-U16          seqNmb;       /* used in case of duplicate keys */
-PTR          *entry;       /* entry to be returned */
-#endif
 {
    CmHashListEnt *hashListEnt;    /* pointer to hash list entry header */
 #ifndef CM_MT_HASH_BIN
    CmListEnt *hashListBin;        /* pointer to hash list bin */
 #else
    CmListBinEnt *hashListBin;        /* pointer to hash list bin */
-   U16 entCnt=0;                     /* counter for number of entries */
+   uint16_t entCnt=0;                     /* counter for number of entries */
 #endif
-   U16 i;                         /* counter for sequence number */
-   U16 idx;                       /* index for insertion into hash list */
+   uint16_t i;                         /* counter for sequence number */
+   uint16_t idx;                       /* index for insertion into hash list */
 
 
 #if (ERRCLASS & ERRCLS_DEBUG)
@@ -1273,7 +1135,7 @@ PTR          *entry;       /* entry to be returned */
           == ROK)
       {
          /* matching key */
-         *entry = (PTR) (((U8 *) hashListEnt) - hashListCp->offset);
+         *entry = (PTR) (((uint8_t *) hashListEnt) - hashListCp->offset);
 
          /* check for duplicates */
          if (!hashListCp->dupFlg)
@@ -1321,19 +1183,12 @@ PTR          *entry;       /* entry to be returned */
 *       File:  cm_hash.c
 *
 */
-#ifdef ANSI
 S16 cmHashListGetNext
 (
 CmHashListCp *hashListCp,    /* hash list to get from */
 PTR          prevEnt,        /* previous entry */
 PTR          *entry          /* entry to be returned */
 )
-#else
-S16 cmHashListGetNext(hashListCp, prevEnt, entry)
-CmHashListCp *hashListCp;    /* hash list to get from */
-PTR          prevEnt;        /* previous entry */
-PTR          *entry;         /* entry to be returned */
-#endif
 {
 #ifndef CM_MT_HASH_BIN
    CmListEnt     *hashListBin;   /* temporary hash list bin pointer */
@@ -1342,7 +1197,7 @@ PTR          *entry;         /* entry to be returned */
 #endif
    CmHashListEnt *hashListEnt;   /* temporary hash list entry pointer */
    CmHashListEnt *prevListEnt;   /* previous hash list entry pointer */
-   U16           i;              /* hash list counter */
+   uint16_t           i;              /* hash list counter */
 
 
 #if (ERRCLASS & ERRCLS_DEBUG)
@@ -1367,7 +1222,7 @@ PTR          *entry;         /* entry to be returned */
             hashListEnt = (CmHashListEnt *) hashListCp->hl[i].next;
 
             /* requested entry is in nxtEnt */
-            *entry = (PTR) (((U8 *) hashListEnt) - hashListCp->offset);
+            *entry = (PTR) (((uint8_t *) hashListEnt) - hashListCp->offset);
 
             return ROK;
          }
@@ -1379,7 +1234,7 @@ PTR          *entry;         /* entry to be returned */
    /* use previous entry to find next entry */
 
    /* get pointer to previous hash list entry header */
-   prevListEnt = (CmHashListEnt *) (((U8 *) prevEnt) + hashListCp->offset);
+   prevListEnt = (CmHashListEnt *) (((uint8_t *) prevEnt) + hashListCp->offset);
 
    /* get index of previous entry */
    i = prevListEnt->hashVal;
@@ -1393,7 +1248,7 @@ PTR          *entry;         /* entry to be returned */
       if (prevListEnt != (CmHashListEnt *) hashListBin)
       {
          /* found next entry */
-         *entry = (PTR) (((U8 *) prevListEnt) - hashListCp->offset);
+         *entry = (PTR) (((uint8_t *) prevListEnt) - hashListCp->offset);
 
          return ROK;
       }
@@ -1438,21 +1293,13 @@ PTR          *entry;         /* entry to be returned */
 *       File:  cm_hash.c
 *
 */
-#ifdef ANSI
 S16 cmHashListBinGetNextEntry
 (
 CmHashListCp *hashListCp,    /* hash list to get from */
-U16          binIdx,         /* Bin Index to retreive the entry */
+uint16_t     binIdx,         /* Bin Index to retreive the entry */
 PTR          prevEnt,        /* previous entry */
 PTR          *entry          /* entry to be returned */
 )
-#else
-S16 cmHashListBinGetNextEntry(hashListCp, binIdx, prevEnt, entry)
-CmHashListCp *hashListCp;    /* hash list to get from */
-U16          binIdx;         /* Bin Index to retreive the entry */
-PTR          prevEnt;        /* previous entry */
-PTR          *entry;         /* entry to be returned */
-#endif
 {
    CmListBinEnt  *hashListBin;   /* temporary hash list bin pointer */
    CmHashListEnt *hashListEnt;   /* temporary hash list entry pointer */
@@ -1476,7 +1323,7 @@ PTR          *entry;         /* entry to be returned */
          hashListEnt = (CmHashListEnt *) hashListCp->hl[binIdx].next;
 
          /* requested entry is in nxtEnt */
-         *entry = (PTR) (((U8 *) hashListEnt) - hashListCp->offset);
+         *entry = (PTR) (((uint8_t *) hashListEnt) - hashListCp->offset);
 
          return ROK;
       }
@@ -1488,7 +1335,7 @@ PTR          *entry;         /* entry to be returned */
    /* use previous entry to find next entry */
 
    /* get pointer to previous hash list entry header */
-   prevListEnt = (CmHashListEnt *) (((U8 *) prevEnt) + hashListCp->offset);
+   prevListEnt = (CmHashListEnt *) (((uint8_t *) prevEnt) + hashListCp->offset);
 
    /* set pointers to get next entry */
    hashListBin = &hashListCp->hl[binIdx];
@@ -1498,7 +1345,7 @@ PTR          *entry;         /* entry to be returned */
    if (prevListEnt != (CmHashListEnt *) hashListBin)
    {
       /* found next entry */
-      *entry = (PTR) (((U8 *) prevListEnt) - hashListCp->offset);
+      *entry = (PTR) (((uint8_t *) prevListEnt) - hashListCp->offset);
 
       return ROK;
    }
@@ -1528,22 +1375,15 @@ PTR          *entry;         /* entry to be returned */
 *       File:  cm_hash.c
 *
 */
-#ifdef ANSI
 S16 cmHashListQuery
 (
 CmHashListCp *hashListCp,    /* hash list to query */
-U8           queryType,      /* type of query */
-U16          *result         /* result of query */
+uint8_t      queryType,      /* type of query */
+uint16_t     *result         /* result of query */
 )
-#else
-S16 cmHashListQuery(hashListCp, queryType, result)
-CmHashListCp *hashListCp;    /* hash list to query */
-U8           queryType;      /* type of query */
-U16          *result;        /* result of query */
-#endif
 {
 #ifdef CM_MT_HASH_BIN
-   U8       i;
+   uint8_t       i;
 #endif
 
 
@@ -1560,9 +1400,9 @@ U16          *result;        /* result of query */
    {
       /* storage for each bin */
 #ifndef CM_MT_HASH_BIN
-      *result = (U16) sizeof(CmListEnt);
+      *result = (uint16_t) sizeof(CmListEnt);
 #else
-      *result = (U16) sizeof(CmListBinEnt);
+      *result = (uint16_t) sizeof(CmListBinEnt);
 #endif
       return ROK;
    }
@@ -1580,7 +1420,7 @@ U16          *result;        /* result of query */
    {
       case CM_HASH_QUERYTYPE_ENTRIES:   /* current number of entries */
 #ifndef CM_MT_HASH_BIN
-         *result = (U16) hashListCp->nmbEnt;
+         *result = (uint16_t) hashListCp->nmbEnt;
 #else
          *result = 0;
          for (i=0; i < hashListCp->nmbBins; i++)
@@ -1591,19 +1431,19 @@ U16          *result;        /* result of query */
          return ROK;
 
       case CM_HASH_QUERYTYPE_BINS:      /* number of bins */
-         *result = (U16) hashListCp->nmbBins;
+         *result = (uint16_t) hashListCp->nmbBins;
          return ROK;
 
       case CM_HASH_QUERYTYPE_OFFSET:    /* offset of CmHashListEnt in entries */
-         *result = (U16) hashListCp->offset;
+         *result = (uint16_t) hashListCp->offset;
          return ROK;
 
       case CM_HASH_QUERYTYPE_DUPFLG:    /* allow duplicate keys */
-         *result = (U16) hashListCp->dupFlg;
+         *result = (uint16_t) hashListCp->dupFlg;
          return ROK;
 
       case CM_HASH_QUERYTYPE_KEYTYPE:   /* key type for selecting hash functions */
-         *result = (U16) hashListCp->keyType;
+         *result = (uint16_t) hashListCp->keyType;
          return ROK;
 
       default:                          /* process other query types */
@@ -1638,21 +1478,13 @@ U16          *result;        /* result of query */
 *
 */
 
-#ifdef ANSI
 S16 cmHashListOAInsert
 (
 CmHashListCp *hashListCp,  /* hash table to add to */
 PTR          entry,        /* entry to add */
-U8           *key,         /* pointer to key */
-U16          keyLen        /* length of key */
+uint8_t      *key,         /* pointer to key */
+uint16_t     keyLen        /* length of key */
 )
-#else
-S16 cmHashListOAInsert(hashListCp, entry, key, keyLen)
-CmHashListCp *hashListCp;  /* hash table to add to */
-PTR          entry;        /* entry to add */
-U8           *key;         /* pointer to key */
-U16          keyLen;       /* length of key */
-#endif
 {
 /* cm_hash_c_001.main_21. Modify. Compilation Issue resolved. */
 #ifndef CM_MT_HASH_BIN
@@ -1661,11 +1493,11 @@ U16          keyLen;       /* length of key */
    CmListBinEnt  *hashBin;        /* temporary hash list bin pointer */
 #endif
    CmHashListEnt *hashListEnt;    /* pointer to hash list entry header */
-   U16 idx;                       /* index for insertion into hash list */
-   U16 hashSize;                  /* hash size */
-   U16 i;
+   uint16_t idx;                       /* index for insertion into hash list */
+   uint16_t hashSize;                  /* hash size */
+   uint16_t i;
    /* cm_hash_c_001.main_21. Modify. Compilation Issue resolved. */
-   U16 nmbEnt;
+   uint16_t nmbEnt;
 
 
 #if (ERRCLASS & ERRCLS_DEBUG)
@@ -1689,7 +1521,7 @@ U16          keyLen;       /* length of key */
       return (ROUTRES);
 
    /* get pointer to hash list entry header */
-   hashListEnt = (CmHashListEnt *) (((U8 *) entry) + hashListCp->offset);
+   hashListEnt = (CmHashListEnt *) (((uint8_t *) entry) + hashListCp->offset);
 
    /* initialize hash list entry header */
    hashListEnt->list.next = NULLP;