mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Rewrite strnlen replacement implementation from 8a241792f9
.
The previous placement of the fallback implementation in libpgcommon was problematic, because libpqport functions need strnlen functionality. Move replacement into libpgport. Provide strnlen() under its posix name, instead of pg_strnlen(). Fix stupid configure bug, executing the test only when compiled with threading support. Author: Andres Freund Discussion: https://postgr.es/m/E1e1gR2-0005fB-SI@gemulon.postgresql.org
This commit is contained in:
@ -12,19 +12,4 @@
|
||||
|
||||
extern bool pg_str_endswith(const char *str, const char *end);
|
||||
|
||||
/*
|
||||
* Portable version of posix' strnlen.
|
||||
*
|
||||
* Returns the number of characters before a null-byte in the string pointed
|
||||
* to by str, unless there's no null-byte before maxlen. In the latter case
|
||||
* maxlen is returned.
|
||||
*
|
||||
* Use the system strnlen if provided, it's likely to be faster.
|
||||
*/
|
||||
#ifdef HAVE_STRNLEN
|
||||
#define pg_strnlen(str, maxlen) strnlen(str, maxlen)
|
||||
#else
|
||||
extern size_t pg_strnlen(const char *str, size_t maxlen);
|
||||
#endif
|
||||
|
||||
#endif /* COMMON_STRING_H */
|
||||
|
Reference in New Issue
Block a user