File tree Expand file tree Collapse file tree 2 files changed +19
-16
lines changed Expand file tree Collapse file tree 2 files changed +19
-16
lines changed Original file line number Diff line number Diff line change 14
14
*
15
15
*
16
16
* IDENTIFICATION
17
- * $PostgreSQL: pgsql/src/backend/utils/mmgr/mcxt.c,v 1.64 2008/06/18 18:42:54 momjian Exp $
17
+ * $PostgreSQL: pgsql/src/backend/utils/mmgr/mcxt.c,v 1.65 2008/06/28 16:45:22 tgl Exp $
18
18
*
19
19
*-------------------------------------------------------------------------
20
20
*/
@@ -624,18 +624,6 @@ repalloc(void *pointer, Size size)
624
624
pointer , size );
625
625
}
626
626
627
- /* Like pstrdup(), but append null byte */
628
- char *
629
- pnstrdup (const char * in , int len )
630
- {
631
- char * out = palloc (len + 1 );
632
-
633
- memcpy (out , in , len );
634
- out [len ] = '\0' ;
635
- return out ;
636
- }
637
-
638
-
639
627
/*
640
628
* MemoryContextSwitchTo
641
629
* Returns the current context; installs the given context.
@@ -676,6 +664,21 @@ MemoryContextStrdup(MemoryContext context, const char *string)
676
664
return nstr ;
677
665
}
678
666
667
+ /*
668
+ * pnstrdup
669
+ * Like pstrdup(), but append null byte to a
670
+ * not-necessarily-null-terminated input string.
671
+ */
672
+ char *
673
+ pnstrdup (const char * in , Size len )
674
+ {
675
+ char * out = palloc (len + 1 );
676
+
677
+ memcpy (out , in , len );
678
+ out [len ] = '\0' ;
679
+ return out ;
680
+ }
681
+
679
682
680
683
#if defined(WIN32 ) || defined(__CYGWIN__ )
681
684
/*
Original file line number Diff line number Diff line change 21
21
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
22
22
* Portions Copyright (c) 1994, Regents of the University of California
23
23
*
24
- * $PostgreSQL: pgsql/src/include/utils/palloc.h,v 1.39 2008/06/18 18:42:54 momjian Exp $
24
+ * $PostgreSQL: pgsql/src/include/utils/palloc.h,v 1.40 2008/06/28 16:45:22 tgl Exp $
25
25
*
26
26
*-------------------------------------------------------------------------
27
27
*/
@@ -70,8 +70,6 @@ extern void pfree(void *pointer);
70
70
71
71
extern void * repalloc (void * pointer , Size size );
72
72
73
- extern char * pnstrdup (const char * in , int len );
74
-
75
73
/*
76
74
* MemoryContextSwitchTo can't be a macro in standard C compilers.
77
75
* But we can make it an inline function when using GCC.
@@ -99,6 +97,8 @@ extern char *MemoryContextStrdup(MemoryContext context, const char *string);
99
97
100
98
#define pstrdup (str ) MemoryContextStrdup(CurrentMemoryContext, (str))
101
99
100
+ extern char * pnstrdup (const char * in , Size len );
101
+
102
102
#if defined(WIN32 ) || defined(__CYGWIN__ )
103
103
extern void * pgport_palloc (Size sz );
104
104
extern char * pgport_pstrdup (const char * str );
You can’t perform that action at this time.
0 commit comments