util/StringAPI: add strncmp() wrapper
This commit is contained in:

committed by
Max Kellermann

parent
ad2b858933
commit
bb7f7bd3e5
@@ -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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -134,6 +134,13 @@ StringCompare(const char *a, const char *b) noexcept
|
|||||||
return strcmp(a, b);
|
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.
|
* Checks whether #a and #b are equal.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user