Skip to content

Commit 16d967d

Browse files
committed
Removed some duplicated code
1 parent d8b062b commit 16d967d

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/postgresql/database_postgresql.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2737,9 +2737,7 @@ char *dbmem_mprintf (const char *format, ...) {
27372737
}
27382738

27392739
// Allocate buffer in TopMemoryContext and format string
2740-
MemoryContext old = MemoryContextSwitchTo(TopMemoryContext);
2741-
char *result = (char*)palloc(len + 1);
2742-
MemoryContextSwitchTo(old);
2740+
char *result = dbmem_alloc(len + 1);
27432741
if (!result) {va_end(args); return NULL;}
27442742
vsnprintf(result, len + 1, format, args);
27452743

@@ -2759,9 +2757,7 @@ char *dbmem_vmprintf (const char *format, va_list list) {
27592757
if (len < 0) return NULL;
27602758

27612759
// Allocate buffer in TopMemoryContext and format string
2762-
MemoryContext old = MemoryContextSwitchTo(TopMemoryContext);
2763-
char *result = (char*)palloc(len + 1);
2764-
MemoryContextSwitchTo(old);
2760+
char *result = dbmem_alloc(len + 1);
27652761
if (!result) return NULL;
27662762
vsnprintf(result, len + 1, format, list);
27672763

0 commit comments

Comments
 (0)