From 2b5ae847d4c385a6732b05ed4bf43f8817b7901e Mon Sep 17 00:00:00 2001 From: Jason Petersen Date: Mon, 8 Feb 2016 12:44:05 -0700 Subject: [PATCH] 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. --- src/bin/csql/copy_options.c | 30 +++++++++++++++--------------- src/bin/csql/copy_options.h | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/bin/csql/copy_options.c b/src/bin/csql/copy_options.c index 357ae726c..da5dd5826 100644 --- a/src/bin/csql/copy_options.c +++ b/src/bin/csql/copy_options.c @@ -16,7 +16,21 @@ #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 xstrcat(char **var, const char *more) { @@ -212,20 +226,6 @@ error: /* 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 * needed for the \stage command, and sets them in the copy options structure. diff --git a/src/bin/csql/copy_options.h b/src/bin/csql/copy_options.h index 07a3aeb09..4a2e15222 100644 --- a/src/bin/csql/copy_options.h +++ b/src/bin/csql/copy_options.h @@ -46,7 +46,7 @@ typedef struct copy_options bool psql_inout; /* true = use psql stdin/stdout */ 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 */ } copy_options;