1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-11 10:01:57 +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:
Andres Freund
2017-10-10 14:42:16 -07:00
parent fa5e119dc7
commit fffd651e83
10 changed files with 77 additions and 47 deletions

View File

@ -43,8 +43,6 @@
#endif
#include <sys/param.h>
#include "common/string.h"
#ifndef NL_ARGMAX
#define NL_ARGMAX 16
#endif
@ -804,7 +802,7 @@ fmtstr(char *value, int leftjust, int minlen, int maxwidth,
* than that.
*/
if (pointflag)
vallen = pg_strnlen(value, maxwidth);
vallen = strnlen(value, maxwidth);
else
vallen = strlen(value);