Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
a8593a34
Commit
a8593a34
authored
20 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Convert MemoryContextSwitchTo() into an inline function when using GCC.
parent
477a64d9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/backend/utils/mmgr/mcxt.c
+9
-1
9 additions, 1 deletion
src/backend/utils/mmgr/mcxt.c
src/include/utils/palloc.h
+19
-1
19 additions, 1 deletion
src/include/utils/palloc.h
with
28 additions
and
2 deletions
src/backend/utils/mmgr/mcxt.c
+
9
−
1
View file @
a8593a34
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mmgr/mcxt.c,v 1.5
3
200
4/12/31 22:02:48 pgsq
l Exp $
* $PostgreSQL: pgsql/src/backend/utils/mmgr/mcxt.c,v 1.5
4
200
5/02/18 21:52:33 tg
l Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -619,7 +619,13 @@ repalloc(void *pointer, Size size)
...
@@ -619,7 +619,13 @@ repalloc(void *pointer, Size size)
/*
/*
* MemoryContextSwitchTo
* MemoryContextSwitchTo
* Returns the current context; installs the given context.
* Returns the current context; installs the given context.
*
* This is inlined when using GCC.
*
* TODO: investigate supporting inlining for some non-GCC compilers.
*/
*/
#ifndef __GNUC__
MemoryContext
MemoryContext
MemoryContextSwitchTo
(
MemoryContext
context
)
MemoryContextSwitchTo
(
MemoryContext
context
)
{
{
...
@@ -632,6 +638,8 @@ MemoryContextSwitchTo(MemoryContext context)
...
@@ -632,6 +638,8 @@ MemoryContextSwitchTo(MemoryContext context)
return
old
;
return
old
;
}
}
#endif
/* ! __GNUC__ */
/*
/*
* MemoryContextStrdup
* MemoryContextStrdup
* Like strdup(), but allocate from the specified context
* Like strdup(), but allocate from the specified context
...
...
This diff is collapsed.
Click to expand it.
src/include/utils/palloc.h
+
19
−
1
View file @
a8593a34
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/utils/palloc.h,v 1.3
2
200
4/12/31 22:03:46 pgsq
l Exp $
* $PostgreSQL: pgsql/src/include/utils/palloc.h,v 1.3
3
200
5/02/18 21:52:34 tg
l Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -70,8 +70,26 @@ extern void pfree(void *pointer);
...
@@ -70,8 +70,26 @@ extern void pfree(void *pointer);
extern
void
*
repalloc
(
void
*
pointer
,
Size
size
);
extern
void
*
repalloc
(
void
*
pointer
,
Size
size
);
/*
* MemoryContextSwitchTo can't be a macro in standard C compilers.
* But we can make it an inline function when using GCC.
*/
#ifdef __GNUC__
static
__inline__
MemoryContext
MemoryContextSwitchTo
(
MemoryContext
context
)
{
MemoryContext
old
=
CurrentMemoryContext
;
CurrentMemoryContext
=
context
;
return
old
;
}
#else
extern
MemoryContext
MemoryContextSwitchTo
(
MemoryContext
context
);
extern
MemoryContext
MemoryContextSwitchTo
(
MemoryContext
context
);
#endif
/* __GNUC__ */
/*
/*
* These are like standard strdup() except the copied string is
* These are like standard strdup() except the copied string is
* allocated in a context, not with malloc().
* allocated in a context, not with malloc().
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment