1
0
miroir de https://github.com/luanti-org/luanti.git synchronisé 2026-01-09 02:35:37 +01:00

util/hex.h: Reserve result space in hex_encode()

Reserve enough space for the result of hex_encode() to eliminate reallocations
Cette révision appartient à :
starling13
2019-04-07 13:01:42 +03:00
révisé par SmallJoker
Parent 3deaa7cf57
révision 1db4ae96b1

Voir le fichier

@@ -26,6 +26,8 @@ static const char hex_chars[] = "0123456789abcdef";
static inline std::string hex_encode(const char *data, unsigned int data_size)
{
std::string ret;
ret.reserve(data_size * 2);
char buf2[3];
buf2[2] = '\0';