mirror of
https://github.com/postgres/postgres.git
synced 2025-11-29 23:43:17 +03:00
Move wchar2char() and char2wchar() from tsearch into /mb to be easier to
use for other modules; also move pnstrdup(). Clean up code slightly.
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mmgr/mcxt.c,v 1.63 2008/01/01 19:45:55 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mmgr/mcxt.c,v 1.64 2008/06/18 18:42:54 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -624,6 +624,18 @@ repalloc(void *pointer, Size size)
|
||||
pointer, size);
|
||||
}
|
||||
|
||||
/* Like pstrdup(), but append null byte */
|
||||
char *
|
||||
pnstrdup(const char *in, int len)
|
||||
{
|
||||
char *out = palloc(len + 1);
|
||||
|
||||
memcpy(out, in, len);
|
||||
out[len] = '\0';
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MemoryContextSwitchTo
|
||||
* Returns the current context; installs the given context.
|
||||
|
||||
Reference in New Issue
Block a user