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
}
*/
#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 */
+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)
+static 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 */
+uint8_t *key; /* key string */
+uint16_t keyLen; /* length of key string */
+uint16_t *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*/
- TRC2(cmHashFuncAnyKey);
/* Set up the internal state */
len = keyLen; /* key length */
a = 0x9e3779b9; /* a = b = the golden ratio; an arbitrary value */
/*---------------------------------------- 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;
}
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 */
}
/* 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 */
*/
#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 */
+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)
+static 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 */
+uint8_t *key; /* key string */
+uint16_t keyLen; /* length of key string */
+uint16_t *idx; /* idx to return */
#endif
{
- U32 sum; /* Sum of octets for hash function */
+ uint32_t sum; /* Sum of octets for hash function */
- TRC2(cmHashFuncU32Mod);
/* 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;
* key of type CM_HASH_KEYTYPE_BCD8.
*
* Steps:
-* 1. Converts the 8 BCD coded octets into 2 U32s
-* 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_ts
+* 2. Adds 2 uint32_ts to get one uint32_t.
+* 3. Apply uint32_tMod technique to get the index
* 4. Return the index
*
* Note:
*/
#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)
+static 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 */
+uint8_t *key; /* key string */
+uint16_t keyLen; /* length of key string */
+uint16_t *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 */
- TRC2(cmHashFuncBCD8);
/* 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 () */
*/
#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 */
+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)
+static 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 */
+uint8_t *key; /* key string */
+uint16_t keyLen; /* length of key string */
+uint16_t *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 */
- TRC2(cmHashFuncString)
sum = 0;
/* 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;
*/
#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 */
+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)
+static 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 */
+uint8_t *key; /* key string */
+uint16_t keyLen; /* length of key string */
+uint16_t *idx; /* index to return */
#endif
{
- U32 sum; /* sum of key string octets */
+ uint32_t sum; /* sum of key string octets */
- TRC2(cmHashFuncDefault);
/* 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;
*/
#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 */
+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)
+static 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 */
+uint8_t *key; /* key string */
+uint16_t keyLen; /* length of key string */
+uint16_t *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 */
- TRC2(cmHashFuncMult24);
UNUSED(keyLen);
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 */
* 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.
*/
#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 */
+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)
+static 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 */
+uint8_t *key; /* key string */
+uint16_t keyLen; /* length of key string */
+uint16_t *idx; /* index to return */
#endif
{
- TRC2(cmHashFuncConId);
/* 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:
*/
#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 */
+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)
+static 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 */
+uint8_t *key; /* key string */
+uint16_t keyLen; /* length of key string */
+uint16_t *idx; /* index to return */
#endif
{
- TRC2(cmHashFuncDirIdx);
UNUSED(hashListCp);
UNUSED(keyLen);
- *idx = *((U16 *) key);
+ *idx = *((uint16_t *) key);
return ROK;
} /* end of cmHashFuncDirIdx */
*/
#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 */
+static S16 cmHashMatchKey(key1, keyLen1, key2, keyLen2)
+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 */
#endif
{
- TRC2(cmHashMatchKey);
/* compare key lengths */
if (keyLen1 != keyLen2)
*/
#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)
+static S16 cmListInsert(oldEntry, newEntry)
CmListEnt *oldEntry; /* add new entry after this entry */
CmListEnt *newEntry; /* new entry to add */
#endif
{
- TRC2(cmListInsert);
newEntry->next = oldEntry->next;
newEntry->prev = oldEntry;
*/
#ifdef ANSI
-PRIVATE S16 cmListDelete
+static S16 cmListDelete
(
CmListEnt *entry /* entry to delete */
)
#else
-PRIVATE S16 cmListDelete(entry)
+static S16 cmListDelete(entry)
CmListEnt *entry; /* entry to delete */
#endif
{
- TRC2(cmListDelete);
if (entry == NULLP)
return RFAILED;
*
*/
#ifdef ANSI
-PUBLIC S16 cmHashListInit
+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
-PUBLIC S16 cmHashListInit(hashListCp, nmbBins, offset, dupFlg, keyType, region, pool)
+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 */
+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 */
#endif
{
- U16 i;
+ uint16_t i;
#ifndef CM_MT_HASH_BIN
CmListEnt *hl;
#else
CmListBinEnt *hl;
#endif
- TRC2(cmHashListInit);
#if (ERRCLASS & ERRCLS_DEBUG)
/* error check on parameters */
hashListCp->hashFunc = cmHashFuncString;
break;
- case CM_HASH_KEYTYPE_U32MOD:
+ case CM_HASH_KEYTYPE_UINT32_MOD:
hashListCp->hashFunc = cmHashFuncU32Mod;
break;
/* 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;
*
*/
#ifdef ANSI
-PUBLIC S16 cmHashListDeinit
+S16 cmHashListDeinit
(
CmHashListCp *hashListCp /* hash list to deinitialize */
)
#else
-PUBLIC S16 cmHashListDeinit(hashListCp)
+S16 cmHashListDeinit(hashListCp)
CmHashListCp *hashListCp; /* hash list to deinitialize */
#endif
{
- TRC2(cmHashListDeinit);
#if (ERRCLASS & ERRCLS_DEBUG)
/* error check on parameters */
*/
#ifdef ANSI
-PUBLIC S16 cmHashListInsert
+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
-PUBLIC S16 cmHashListInsert(hashListCp, entry, key, keyLen)
+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 */
+uint8_t *key; /* pointer to key */
+uint16_t 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 */
- TRC2(cmHashListInsert);
#if (ERRCLASS & ERRCLS_DEBUG)
/* error check on parameters */
}
/* 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;
*/
#ifdef ANSI
-PUBLIC S16 cmHashListDelete
+S16 cmHashListDelete
(
CmHashListCp *hashListCp, /* hash list to delete from */
PTR entry /* entry to delete */
)
#else
-PUBLIC S16 cmHashListDelete(hashListCp, entry)
+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
- TRC2(cmHashListDelete);
#if (ERRCLASS & ERRCLS_DEBUG)
/* error check on parameters */
#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) ||
*/
#ifdef ANSI
-PUBLIC S16 cmHashListFind
+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
-PUBLIC S16 cmHashListFind(hashListCp, key, keyLen, seqNmb, entry)
+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 */
+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 */
#endif
{
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 */
- TRC2(cmHashListFind);
#if (ERRCLASS & ERRCLS_DEBUG)
/* error check on parameters */
== ROK)
{
/* matching key */
- *entry = (PTR) (((U8 *) hashListEnt) - hashListCp->offset);
+ *entry = (PTR) (((uint8_t *) hashListEnt) - hashListCp->offset);
/* check for duplicates */
if (!hashListCp->dupFlg)
*
*/
#ifdef ANSI
-PUBLIC S16 cmHashListGetNext
+S16 cmHashListGetNext
(
CmHashListCp *hashListCp, /* hash list to get from */
PTR prevEnt, /* previous entry */
PTR *entry /* entry to be returned */
)
#else
-PUBLIC S16 cmHashListGetNext(hashListCp, prevEnt, entry)
+S16 cmHashListGetNext(hashListCp, prevEnt, entry)
CmHashListCp *hashListCp; /* hash list to get from */
PTR prevEnt; /* previous entry */
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 */
- TRC2(cmHashListGetNext);
#if (ERRCLASS & ERRCLS_DEBUG)
/* error check on parameters */
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;
}
/* 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;
if (prevListEnt != (CmHashListEnt *) hashListBin)
{
/* found next entry */
- *entry = (PTR) (((U8 *) prevListEnt) - hashListCp->offset);
+ *entry = (PTR) (((uint8_t *) prevListEnt) - hashListCp->offset);
return ROK;
}
*
*/
#ifdef ANSI
-PUBLIC S16 cmHashListBinGetNextEntry
+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
-PUBLIC S16 cmHashListBinGetNextEntry(hashListCp, binIdx, prevEnt, entry)
+S16 cmHashListBinGetNextEntry(hashListCp, binIdx, prevEnt, entry)
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 */
#endif
CmHashListEnt *hashListEnt; /* temporary hash list entry pointer */
CmHashListEnt *prevListEnt; /* previous hash list entry pointer */
- TRC2(cmHashListBinGetNextEntry);
#if (ERRCLASS & ERRCLS_DEBUG)
/* error check on parameters */
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;
}
/* 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];
if (prevListEnt != (CmHashListEnt *) hashListBin)
{
/* found next entry */
- *entry = (PTR) (((U8 *) prevListEnt) - hashListCp->offset);
+ *entry = (PTR) (((uint8_t *) prevListEnt) - hashListCp->offset);
return ROK;
}
*
*/
#ifdef ANSI
-PUBLIC S16 cmHashListQuery
+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
-PUBLIC S16 cmHashListQuery(hashListCp, queryType, result)
+S16 cmHashListQuery(hashListCp, queryType, result)
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 */
#endif
{
#ifdef CM_MT_HASH_BIN
- U8 i;
+ uint8_t i;
#endif
- TRC2(cmHashListQuery);
/* deal with queries that do not need hashListCp */
{
/* 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;
}
{
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++)
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 */
*/
#ifdef ANSI
-PUBLIC S16 cmHashListOAInsert
+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
-PUBLIC S16 cmHashListOAInsert(hashListCp, entry, key, keyLen)
+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 */
+uint8_t *key; /* pointer to key */
+uint16_t keyLen; /* length of key */
#endif
{
/* cm_hash_c_001.main_21. Modify. Compilation Issue resolved. */
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;
- TRC2(cmHashListOAInsert);
#if (ERRCLASS & ERRCLS_DEBUG)
/* error check on parameters */
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;