Make copy_options.ch similar to PostgreSQL copy.c

We reorganized these functions in our copy; not sure why (makes diffing
harder). I'm moving it back.
pull/327/head
Jason Petersen 2016-02-08 12:44:05 -07:00
parent bc23113732
commit 2b5ae847d4
No known key found for this signature in database
GPG Key ID: 9F1D3510D110ABA9
2 changed files with 16 additions and 16 deletions

View File

@ -16,7 +16,21 @@
#include "stringutils.h" #include "stringutils.h"
/* Concatenates "more" onto "var", and frees the original value of *var. */ void
free_copy_options(copy_options * ptr)
{
if (!ptr)
return;
free(ptr->before_tofrom);
free(ptr->after_tofrom);
free(ptr->file);
free(ptr->tableName);
free(ptr->columnList);
free(ptr);
}
/* concatenate "more" onto "var", freeing the original value of *var */
static void static void
xstrcat(char **var, const char *more) xstrcat(char **var, const char *more)
{ {
@ -212,20 +226,6 @@ error:
/* Frees copy options. */ /* Frees copy options. */
void
free_copy_options(copy_options * ptr)
{
if (!ptr)
return;
free(ptr->before_tofrom);
free(ptr->after_tofrom);
free(ptr->file);
free(ptr->tableName);
free(ptr->columnList);
free(ptr);
}
/* /*
* ParseStageOptions takes the given copy options, parses the additional options * ParseStageOptions takes the given copy options, parses the additional options
* needed for the \stage command, and sets them in the copy options structure. * needed for the \stage command, and sets them in the copy options structure.

View File

@ -46,7 +46,7 @@ typedef struct copy_options
bool psql_inout; /* true = use psql stdin/stdout */ bool psql_inout; /* true = use psql stdin/stdout */
bool from; /* true = FROM, false = TO */ bool from; /* true = FROM, false = TO */
char *tableName; /* table name to stage data to */ char *tableName; /* table name to stage data to */
char *columnList; /* optional column list used in staging */ char *columnList; /* optional column list used in staging */
} copy_options; } copy_options;