util/StringAPI: add strncmp() wrapper

This commit is contained in:
Max Kellermann 2019-04-16 14:01:59 +02:00 committed by Max Kellermann
parent ad2b858933
commit bb7f7bd3e5
1 changed files with 8 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2010-2018 Max Kellermann <max.kellermann@gmail.com>
* Copyright 2010-2019 Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -134,6 +134,13 @@ StringCompare(const char *a, const char *b) noexcept
return strcmp(a, b);
}
gcc_pure gcc_nonnull_all
static inline int
StringCompare(const char *a, const char *b, size_t n) noexcept
{
return strncmp(a, b, n);
}
/**
* Checks whether #a and #b are equal.
*/