From 2720c57005cf006d9a1a5bf82b0f1ed6e35b3151 Mon Sep 17 00:00:00 2001 From: Michael Meskes Date: Thu, 3 Sep 2009 09:59:20 +0000 Subject: [PATCH] Removed some variables no longer needed. --- src/interfaces/ecpg/ChangeLog | 4 ++++ src/interfaces/ecpg/compatlib/informix.c | 10 +++------- src/interfaces/ecpg/pgtypeslib/interval.c | 4 ++-- src/interfaces/ecpg/pgtypeslib/numeric.c | 8 +++----- src/interfaces/ecpg/pgtypeslib/timestamp.c | 4 +--- src/interfaces/ecpg/preproc/type.c | 20 +++++--------------- 6 files changed, 18 insertions(+), 32 deletions(-) diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog index 3a7b0b5a08..6593b6d552 100644 --- a/src/interfaces/ecpg/ChangeLog +++ b/src/interfaces/ecpg/ChangeLog @@ -2424,6 +2424,10 @@ Fri, 14 Aug 2009 14:45:02 +0200 - Made sure sqlca is reset for declare cursor in Informix mode as pointed out by Böszörményi Zoltán . + +Thu, 03 Sep 2009 11:45:13 +0200 + + - Removed some no longer used variables as reported by clang. - Set ecpg library version to 6.2. - Set compat library version to 3.2. - Set ecpg version to 4.6. diff --git a/src/interfaces/ecpg/compatlib/informix.c b/src/interfaces/ecpg/compatlib/informix.c index 1d447dbe7c..41ef2bfccc 100644 --- a/src/interfaces/ecpg/compatlib/informix.c +++ b/src/interfaces/ecpg/compatlib/informix.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.60 2009/08/14 13:28:22 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.61 2009/09/03 09:59:20 meskes Exp $ */ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" @@ -767,13 +767,12 @@ rfmtlong(long lng_val, char *fmt, char *outbuf) size_t fmt_len = strlen(fmt); size_t temp_len; int i, - j, + j, /* position in temp */ k, dotpos; int leftalign = 0, blank = 0, sign = 0, - entity = 0, entitydone = 0, signdone = 0, brackets_ok = 0; @@ -811,7 +810,6 @@ rfmtlong(long lng_val, char *fmt, char *outbuf) /* start to parse the formatstring */ temp[0] = '\0'; - j = 0; /* position in temp */ k = value.digits - 1; /* position in the value_string */ for (i = fmt_len - 1, j = 0; i >= 0; i--, j++) { @@ -819,9 +817,7 @@ rfmtlong(long lng_val, char *fmt, char *outbuf) if (k < 0) { blank = 1; - if (k == -2) - entity = 1; - else if (k == -1) + if (k == -1) sign = 1; if (leftalign) { diff --git a/src/interfaces/ecpg/pgtypeslib/interval.c b/src/interfaces/ecpg/pgtypeslib/interval.c index 47470233f8..b9894d7ffc 100644 --- a/src/interfaces/ecpg/pgtypeslib/interval.c +++ b/src/interfaces/ecpg/pgtypeslib/interval.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/interval.c,v 1.41 2009/06/11 14:49:13 momjian Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/interval.c,v 1.42 2009/09/03 09:59:20 meskes Exp $ */ #include "postgres_fe.h" #include @@ -918,7 +918,7 @@ EncodeInterval(struct /* pg_ */ tm * tm, fsec_t fsec, int style, char *str) AppendSeconds(cp, sec, fsec, MAX_INTERVAL_PRECISION, false); cp += strlen(cp); *cp++ = 'S'; - *cp++ = '\0'; + *cp = '\0'; } break; diff --git a/src/interfaces/ecpg/pgtypeslib/numeric.c b/src/interfaces/ecpg/pgtypeslib/numeric.c index 93505eaab1..1feac9b76e 100644 --- a/src/interfaces/ecpg/pgtypeslib/numeric.c +++ b/src/interfaces/ecpg/pgtypeslib/numeric.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/numeric.c,v 1.33 2006/10/04 00:30:12 momjian Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/numeric.c,v 1.34 2009/09/03 09:59:20 meskes Exp $ */ #include "postgres_fe.h" #include @@ -1046,7 +1046,6 @@ select_div_scale(numeric *var1, numeric *var2, int *rscale) NumericDigit firstdigit1, firstdigit2; int res_dscale; - int res_rscale; /* * The result scale of a division isn't specified in any SQL standard. For @@ -1098,7 +1097,7 @@ select_div_scale(numeric *var1, numeric *var2, int *rscale) res_dscale = Min(res_dscale, NUMERIC_MAX_DISPLAY_SCALE); /* Select result scale */ - *rscale = res_rscale = res_dscale + 4; + *rscale = res_dscale + 4; return res_dscale; } @@ -1537,9 +1536,8 @@ int PGTYPESnumeric_to_double(numeric *nv, double *dp) { double tmp; - int i; - if ((i = numericvar_to_double(nv, &tmp)) != 0) + if (numericvar_to_double(nv, &tmp) != 0) return -1; *dp = tmp; return 0; diff --git a/src/interfaces/ecpg/pgtypeslib/timestamp.c b/src/interfaces/ecpg/pgtypeslib/timestamp.c index 22e3ce7273..315c683455 100644 --- a/src/interfaces/ecpg/pgtypeslib/timestamp.c +++ b/src/interfaces/ecpg/pgtypeslib/timestamp.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/timestamp.c,v 1.45 2009/06/11 14:49:13 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/timestamp.c,v 1.46 2009/09/03 09:59:20 meskes Exp $ */ #include "postgres_fe.h" @@ -237,8 +237,6 @@ recalc_t: if (tzn != NULL) *tzn = NULL; #endif - - dt = dt2local(dt, *tzp); } else { diff --git a/src/interfaces/ecpg/preproc/type.c b/src/interfaces/ecpg/preproc/type.c index 0465762f8d..a277bd0e50 100644 --- a/src/interfaces/ecpg/preproc/type.c +++ b/src/interfaces/ecpg/preproc/type.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.84 2009/08/07 10:51:20 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.85 2009/09/03 09:59:20 meskes Exp $ */ #include "postgres_fe.h" @@ -228,7 +228,7 @@ static void ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type, char *varcharsize, char *arrsiz, const char *siz, const char *prefix, int); static void ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, char *arrsiz, - struct ECPGtype * type, struct ECPGtype * ind_type, const char *offset, const char *prefix, const char *ind_prefix); + struct ECPGtype * type, struct ECPGtype * ind_type, const char *prefix, const char *ind_prefix); void ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, @@ -254,7 +254,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, type->size, type->u.element, (ind_type == NULL) ? NULL : ((ind_type->type == ECPGt_NO_INDICATOR) ? ind_type : ind_type->u.element), - NULL, prefix, ind_prefix); + prefix, ind_prefix); break; default: if (!IS_SIMPLE_TYPE(type->u.element->type)) @@ -280,7 +280,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, if (indicator_set && ind_type->type != ECPGt_struct) mmerror(INDICATOR_NOT_STRUCT, ET_FATAL, "indicator for struct has to be a struct"); - ECPGdump_a_struct(o, name, ind_name, make_str("1"), type, ind_type, NULL, prefix, ind_prefix); + ECPGdump_a_struct(o, name, ind_name, make_str("1"), type, ind_type, prefix, ind_prefix); break; case ECPGt_union: /* cannot dump a complete union */ base_yyerror("type of union has to be specified"); @@ -459,7 +459,7 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type, /* Penetrate a struct and dump the contents. */ static void -ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, char *arrsiz, struct ECPGtype * type, struct ECPGtype * ind_type, const char *offsetarg, const char *prefix, const char *ind_prefix) +ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, char *arrsiz, struct ECPGtype * type, struct ECPGtype * ind_type, const char *prefix, const char *ind_prefix) { /* * If offset is NULL, then this is the first recursive level. If not then @@ -467,18 +467,8 @@ ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, char *arrsiz, */ struct ECPGstruct_member *p, *ind_p = NULL; - char obuf[BUFSIZ]; char pbuf[BUFSIZ], ind_pbuf[BUFSIZ]; - const char *offset; - - if (offsetarg == NULL) - { - sprintf(obuf, "sizeof(%s)", name); - offset = obuf; - } - else - offset = offsetarg; if (atoi(arrsiz) == 1) sprintf(pbuf, "%s%s.", prefix ? prefix : "", name); -- 2.40.0