Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 588d963

Browse files
committed
Create src/fe_utils/, and move stuff into there from pg_dump's dumputils.
Per discussion, we want to create a static library and put the stuff into it that until now has been shared across src/bin/ directories by ad-hoc methods like symlinking a source file. This commit creates the library and populates it with a couple of files that contain the widely-useful portions of pg_dump's dumputils.c file. dumputils.c survives, because it has some stuff that didn't seem appropriate for fe_utils, but it's significantly smaller and is no longer referenced from any other directory. Follow-on patches will move more stuff into fe_utils. The Mkvcbuild.pm hacking here is just a best guess; we'll see how the buildfarm likes it.
1 parent a596db3 commit 588d963

35 files changed

+1004
-848
lines changed

src/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ SUBDIRS = \
2222
include \
2323
interfaces \
2424
backend/replication/libpqwalreceiver \
25+
fe_utils \
2526
bin \
2627
pl \
2728
makefiles \

src/Makefile.global.in

+6-1
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,12 @@ submake-libpgport:
501501
$(MAKE) -C $(top_builddir)/src/port all
502502
$(MAKE) -C $(top_builddir)/src/common all
503503

504-
.PHONY: submake-libpq submake-libpgport
504+
submake-libpgfeutils:
505+
$(MAKE) -C $(top_builddir)/src/port all
506+
$(MAKE) -C $(top_builddir)/src/common all
507+
$(MAKE) -C $(top_builddir)/src/fe_utils all
508+
509+
.PHONY: submake-libpq submake-libpgport submake-libpgfeutils
505510

506511

507512
##########################################################################

src/bin/pg_dump/Makefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,21 @@ top_builddir = ../../..
1717
include $(top_builddir)/src/Makefile.global
1818

1919
override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
20+
LDFLAGS += -L$(top_builddir)/src/fe_utils -lpgfeutils
2021

2122
OBJS= pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o \
2223
pg_backup_null.o pg_backup_tar.o pg_backup_directory.o \
2324
pg_backup_utils.o parallel.o compress_io.o dumputils.o $(WIN32RES)
2425

2526
all: pg_dump pg_restore pg_dumpall
2627

27-
pg_dump: pg_dump.o common.o pg_dump_sort.o $(OBJS) | submake-libpq submake-libpgport
28+
pg_dump: pg_dump.o common.o pg_dump_sort.o $(OBJS) | submake-libpq submake-libpgport submake-libpgfeutils
2829
$(CC) $(CFLAGS) pg_dump.o common.o pg_dump_sort.o $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
2930

30-
pg_restore: pg_restore.o $(OBJS) | submake-libpq submake-libpgport
31+
pg_restore: pg_restore.o $(OBJS) | submake-libpq submake-libpgport submake-libpgfeutils
3132
$(CC) $(CFLAGS) pg_restore.o $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
3233

33-
pg_dumpall: pg_dumpall.o dumputils.o | submake-libpq submake-libpgport
34+
pg_dumpall: pg_dumpall.o dumputils.o | submake-libpq submake-libpgport submake-libpgfeutils
3435
$(CC) $(CFLAGS) pg_dumpall.o dumputils.o $(WIN32RES) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
3536

3637
install: all installdirs

src/bin/pg_dump/common.c

+1-34
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <ctype.h>
2323

2424
#include "catalog/pg_class.h"
25+
#include "fe_utils/string_utils.h"
2526

2627

2728
/*
@@ -992,37 +993,3 @@ strInArray(const char *pattern, char **arr, int arr_size)
992993
}
993994
return -1;
994995
}
995-
996-
997-
/*
998-
* Support for simple list operations
999-
*/
1000-
1001-
void
1002-
simple_oid_list_append(SimpleOidList *list, Oid val)
1003-
{
1004-
SimpleOidListCell *cell;
1005-
1006-
cell = (SimpleOidListCell *) pg_malloc(sizeof(SimpleOidListCell));
1007-
cell->next = NULL;
1008-
cell->val = val;
1009-
1010-
if (list->tail)
1011-
list->tail->next = cell;
1012-
else
1013-
list->head = cell;
1014-
list->tail = cell;
1015-
}
1016-
1017-
bool
1018-
simple_oid_list_member(SimpleOidList *list, Oid val)
1019-
{
1020-
SimpleOidListCell *cell;
1021-
1022-
for (cell = list->head; cell; cell = cell->next)
1023-
{
1024-
if (cell->val == val)
1025-
return true;
1026-
}
1027-
return false;
1028-
}

0 commit comments

Comments
 (0)