moved chunk_increment() function to libstrongswan

This commit is contained in:
Martin Willi
2009-08-26 14:07:26 +02:00
parent d4df33f255
commit 500f515a64
3 changed files with 28 additions and 18 deletions
+18
View File
@@ -449,6 +449,24 @@ int chunk_compare(chunk_t a, chunk_t b)
return memcmp(a.ptr, b.ptr, len);
};
/**
* Described in header.
*/
bool chunk_increment(chunk_t chunk)
{
int i;
for (i = chunk.len - 1; i >= 0; i--)
{
if (++chunk.ptr[i] != 0)
{
return FALSE;
}
}
return TRUE;
}
/**
* Remove non-printable characters from a chunk.
*/