mirror of
https://github.com/postgres/postgres.git
synced 2025-11-04 20:11:56 +03:00
pgindent run over code.
This commit is contained in:
@@ -157,12 +157,13 @@ main(int argc, char *const argv[])
|
||||
struct cursor *ptr;
|
||||
struct _defines *defptr;
|
||||
struct typedefs *typeptr;
|
||||
|
||||
|
||||
/* remove old cursor definitions if any are still there */
|
||||
for (ptr = cur; ptr != NULL;)
|
||||
{
|
||||
struct cursor *this = ptr;
|
||||
struct arguments *l1, *l2;
|
||||
struct arguments *l1,
|
||||
*l2;
|
||||
|
||||
free(ptr->command);
|
||||
free(ptr->connection);
|
||||
@@ -191,7 +192,7 @@ main(int argc, char *const argv[])
|
||||
defptr = defptr->next;
|
||||
free(this);
|
||||
}
|
||||
|
||||
|
||||
/* and old typedefs */
|
||||
for (typeptr = types; typeptr != NULL;)
|
||||
{
|
||||
@@ -203,7 +204,7 @@ main(int argc, char *const argv[])
|
||||
typeptr = typeptr->next;
|
||||
free(this);
|
||||
}
|
||||
|
||||
|
||||
/* initialize lex */
|
||||
lex_init();
|
||||
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
/* variables */
|
||||
|
||||
extern int braces_open,
|
||||
autocommit, struct_level;
|
||||
extern char *yytext, errortext[128];
|
||||
autocommit,
|
||||
struct_level;
|
||||
extern char *yytext,
|
||||
errortext[128];
|
||||
extern int yylineno,
|
||||
yyleng;
|
||||
extern FILE *yyin,
|
||||
@@ -36,9 +38,9 @@ extern void yyerror(char *);
|
||||
/* return codes */
|
||||
|
||||
#define OK 0
|
||||
#define PARSE_ERROR -1
|
||||
#define PARSE_ERROR -1
|
||||
#define ILLEGAL_OPTION -2
|
||||
#define INDICATOR_NOT_ARRAY -3
|
||||
#define INDICATOR_NOT_ARRAY -3
|
||||
|
||||
#define NO_INCLUDE_FILE ENOENT
|
||||
#define OUT_OF_MEMORY ENOMEM
|
||||
|
||||
@@ -123,7 +123,7 @@ get_type(enum ECPGttype typ)
|
||||
{
|
||||
switch (typ)
|
||||
{
|
||||
case ECPGt_char:
|
||||
case ECPGt_char:
|
||||
return ("ECPGt_char");
|
||||
break;
|
||||
case ECPGt_unsigned_char:
|
||||
@@ -161,14 +161,15 @@ get_type(enum ECPGttype typ)
|
||||
case ECPGt_NO_INDICATOR: /* no indicator */
|
||||
return ("ECPGt_NO_INDICATOR");
|
||||
break;
|
||||
case ECPGt_char_variable: /* string that should not be quoted */
|
||||
case ECPGt_char_variable: /* string that should not be
|
||||
* quoted */
|
||||
return ("ECPGt_char_variable");
|
||||
break;
|
||||
default:
|
||||
sprintf(errortext, "illegal variable type %d\n", typ);
|
||||
yyerror(errortext);
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -208,16 +209,16 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * typ, const char *in
|
||||
switch (typ->u.element->typ)
|
||||
{
|
||||
case ECPGt_array:
|
||||
yyerror("No nested arrays allowed (except strings)"); /* array of array */
|
||||
yyerror("No nested arrays allowed (except strings)"); /* array of array */
|
||||
break;
|
||||
case ECPGt_struct:
|
||||
case ECPGt_union:
|
||||
ECPGdump_a_struct(o, name, ind_name, typ->size, typ->u.element, ind_typ->u.element, NULL, prefix, ind_prefix);
|
||||
ECPGdump_a_struct(o, name, ind_name, typ->size, typ->u.element, ind_typ->u.element, NULL, prefix, ind_prefix);
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
if (!IS_SIMPLE_TYPE(typ->u.element->typ))
|
||||
yyerror("Internal error: unknown datatype, please inform pgsql-bugs@postgresql.org");
|
||||
|
||||
|
||||
ECPGdump_a_simple(o, name, typ->u.element->typ,
|
||||
typ->u.element->size, typ->size, NULL, prefix);
|
||||
if (ind_typ->typ == ECPGt_NO_INDICATOR)
|
||||
@@ -227,17 +228,17 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * typ, const char *in
|
||||
if (ind_typ->typ != ECPGt_array)
|
||||
{
|
||||
fprintf(stderr, "Indicator for an array has to be array too.\n");
|
||||
exit(INDICATOR_NOT_ARRAY);
|
||||
}
|
||||
exit(INDICATOR_NOT_ARRAY);
|
||||
}
|
||||
ECPGdump_a_simple(o, ind_name, ind_typ->u.element->typ,
|
||||
ind_typ->u.element->size, ind_typ->size, NULL, prefix);
|
||||
ind_typ->u.element->size, ind_typ->size, NULL, prefix);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ECPGt_struct:
|
||||
ECPGdump_a_struct(o, name, ind_name, 1, typ, ind_typ, NULL, prefix, ind_prefix);
|
||||
break;
|
||||
case ECPGt_union: /* cannot dump a complete union */
|
||||
case ECPGt_union: /* cannot dump a complete union */
|
||||
yyerror("Type of union has to be specified");
|
||||
break;
|
||||
case ECPGt_char_variable:
|
||||
@@ -364,12 +365,12 @@ ECPGfree_type(struct ECPGtype * typ)
|
||||
{
|
||||
if (!IS_SIMPLE_TYPE(typ->typ))
|
||||
{
|
||||
switch(typ->typ)
|
||||
switch (typ->typ)
|
||||
{
|
||||
case ECPGt_array:
|
||||
case ECPGt_array:
|
||||
switch (typ->u.element->typ)
|
||||
{
|
||||
case ECPGt_array:
|
||||
case ECPGt_array:
|
||||
yyerror("internal error, found multi-dimensional array\n");
|
||||
break;
|
||||
case ECPGt_struct:
|
||||
@@ -378,7 +379,7 @@ ECPGfree_type(struct ECPGtype * typ)
|
||||
ECPGfree_struct_member(typ->u.element->u.members);
|
||||
free(typ->u.members);
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
if (!IS_SIMPLE_TYPE(typ->u.element->typ))
|
||||
yyerror("Internal error: unknown datatype, please inform pgsql-bugs@postgresql.org");
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ struct ECPGtype *ECPGmake_simple_type(enum ECPGttype, long);
|
||||
struct ECPGtype *ECPGmake_varchar_type(enum ECPGttype, long);
|
||||
struct ECPGtype *ECPGmake_array_type(struct ECPGtype *, long);
|
||||
struct ECPGtype *ECPGmake_struct_type(struct ECPGstruct_member *, enum ECPGttype type);
|
||||
struct ECPGstruct_member * ECPGstruct_member_dup(struct ECPGstruct_member *);
|
||||
struct ECPGstruct_member *ECPGstruct_member_dup(struct ECPGstruct_member *);
|
||||
|
||||
/* Frees a type. */
|
||||
void ECPGfree_struct_member(struct ECPGstruct_member *);
|
||||
@@ -71,7 +71,7 @@ enum WHEN_TYPE
|
||||
|
||||
struct when
|
||||
{
|
||||
enum WHEN_TYPE code;
|
||||
enum WHEN_TYPE code;
|
||||
char *command;
|
||||
char *str;
|
||||
};
|
||||
@@ -85,10 +85,10 @@ struct index
|
||||
|
||||
struct this_type
|
||||
{
|
||||
enum ECPGttype type_enum;
|
||||
char *type_str;
|
||||
int type_dimension;
|
||||
int type_index;
|
||||
enum ECPGttype type_enum;
|
||||
char *type_str;
|
||||
int type_dimension;
|
||||
int type_index;
|
||||
};
|
||||
|
||||
struct _include_path
|
||||
@@ -109,8 +109,8 @@ struct cursor
|
||||
|
||||
struct typedefs
|
||||
{
|
||||
char *name;
|
||||
struct this_type *type;
|
||||
char *name;
|
||||
struct this_type *type;
|
||||
struct ECPGstruct_member *struct_member_list;
|
||||
struct typedefs *next;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user