1
0
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:
Bruce Momjian
2008-06-18 18:42:54 +00:00
parent 3eb9da524d
commit 9de09c087d
8 changed files with 155 additions and 140 deletions

View File

@@ -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.