Skip to content

Commit

Permalink
wiseconnect: Drop ip_to_reverse_hex()
Browse files Browse the repository at this point in the history
ip_to_reverse_hex() relies son sscanf(). However sscanf() is not
available in minimal configuration of Zephyr.

However, ip_to_reverse_hex() is orphan and can be safely dropped.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
  • Loading branch information
jerome-pouiller authored and jhedberg committed Feb 7, 2025
1 parent 07dd0bf commit 2e64a70
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ void string2array(uint8_t *dst, const uint8_t *src, uint32_t length);
int32_t rsi_atoi(const int8_t *str);
void rsi_ascii_dot_address_to_4bytes(uint8_t *hexAddr, int8_t *asciiDotAddress);
void rsi_ascii_mac_address_to_6bytes(uint8_t *hexAddr, int8_t *asciiMacAddress);
uint64_t ip_to_reverse_hex(const char *ip);

int8_t rsi_ascii_hex2num(int8_t ascii_hex_in);
int8_t rsi_char_hex2dec(int8_t *cBuf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,31 +484,6 @@ void rsi_ascii_dot_address_to_4bytes(uint8_t *hexAddr, int8_t *asciiDotAddress)
hexAddr[byteNum] = (uint8_t)rsi_atoi(cBuf);
}
/*=============================================================================*/
/**
* @fn uint64_t ip_to_reverse_hex(char *ip)
* @brief Convert IP address to reverse Hex format.
* @param[in] ip - IP address to convert.
* @return IP address in reverse Hex format
*/
uint64_t ip_to_reverse_hex(const char *ip)
{
long unsigned int ip1, ip2, ip3, ip4;
uint64_t ip_hex;
uint32_t status;

status = sscanf(ip, "%lu.%lu.%lu.%lu", &ip1, &ip2, &ip3, &ip4);
if (status != 4) {
return 0x00000000; // Problem if we actually pass 0.0.0.0
}

ip_hex = (uint64_t)ip1;
ip_hex |= (uint64_t)(ip2 << 8);
ip_hex |= (uint64_t)(ip3 << 16);
ip_hex |= (uint64_t)(ip4 << 24);

return ip_hex;
}
/*=============================================================================*/
/**
* @fn uint32_t rsi_ntohl(uint32_t a)
* @brief Converts the unsigned integer from network byte order to host byte order.
Expand Down

0 comments on commit 2e64a70

Please # to comment.