Group and order mem_* function implementations

This commit is contained in:
Robert Müller 2023-02-04 00:33:56 +01:00
parent 08a1214397
commit cb6de6a384

View file

@ -223,6 +223,25 @@ void mem_zero(void *block, unsigned size)
memset(block, 0, size);
}
int mem_comp(const void *a, const void *b, int size)
{
return memcmp(a, b, size);
}
int mem_has_null(const void *block, unsigned size)
{
const unsigned char *bytes = (const unsigned char *)block;
unsigned i;
for(i = 0; i < size; i++)
{
if(bytes[i] == 0)
{
return 1;
}
}
return 0;
}
IOHANDLE io_open_impl(const char *filename, int flags)
{
dbg_assert(flags == (IOFLAG_READ | IOFLAG_SKIP_BOM) || flags == IOFLAG_READ || flags == IOFLAG_WRITE || flags == IOFLAG_APPEND, "flags must be read, read+skipbom, write or append");
@ -3426,25 +3445,6 @@ void str_escape(char **dst, const char *src, const char *end)
**dst = 0;
}
int mem_comp(const void *a, const void *b, int size)
{
return memcmp(a, b, size);
}
int mem_has_null(const void *block, unsigned size)
{
const unsigned char *bytes = (const unsigned char *)block;
unsigned i;
for(i = 0; i < size; i++)
{
if(bytes[i] == 0)
{
return 1;
}
}
return 0;
}
void net_stats(NETSTATS *stats_inout)
{
*stats_inout = network_stats;