moved chunk_skip_zero to chunk.h

This commit is contained in:
Andreas Steffen
2012-04-03 14:12:50 +02:00
parent 4e5b7e09ee
commit 320fd5fe62
3 changed files with 21 additions and 19 deletions
+18
View File
@@ -234,6 +234,24 @@ static inline chunk_t chunk_skip(chunk_t chunk, size_t bytes)
return chunk_empty;
}
/**
* Skip a leading zero-valued byte
*/
static inline chunk_t chunk_skip_zero(chunk_t chunk)
{
if (chunk.len && *chunk.ptr == 0x00)
{
if (chunk.len == 1)
{
return chunk_empty;
}
chunk.ptr++;
chunk.len--;
}
return chunk;
}
/**
* Compare two chunks, returns zero if a equals b
* or negative/positive if a is small/greater than b