diff options
author | Peter Geoghegan <pg@bowt.ie> | 2022-09-22 12:53:20 -0700 |
---|---|---|
committer | Peter Geoghegan <pg@bowt.ie> | 2022-09-22 12:53:20 -0700 |
commit | 3535ebce5dc542b90f14d6e81cce80fe7226bda5 (patch) | |
tree | d522e66b87443f8b4d344889ecd1d8729be1b030 /src/interfaces/ecpg/include | |
parent | 163b0993a162ebae00fe5de8f593a5da28821a1b (diff) |
Harmonize parameter names in ecpg code.
Make ecpg function declarations consistently use named parameters. Also
make sure that the declarations use names that match corresponding names
from function definitions.
Like other recent commits that cleaned up function parameter names, this
commit was written with help from clang-tidy.
Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com
Diffstat (limited to 'src/interfaces/ecpg/include')
-rw-r--r-- | src/interfaces/ecpg/include/ecpg_informix.h | 82 | ||||
-rw-r--r-- | src/interfaces/ecpg/include/ecpglib.h | 60 | ||||
-rw-r--r-- | src/interfaces/ecpg/include/pgtypes_date.h | 20 | ||||
-rw-r--r-- | src/interfaces/ecpg/include/pgtypes_interval.h | 8 | ||||
-rw-r--r-- | src/interfaces/ecpg/include/pgtypes_numeric.h | 36 | ||||
-rw-r--r-- | src/interfaces/ecpg/include/pgtypes_timestamp.h | 12 |
6 files changed, 112 insertions, 106 deletions
diff --git a/src/interfaces/ecpg/include/ecpg_informix.h b/src/interfaces/ecpg/include/ecpg_informix.h index a5260a55427..5d918c37972 100644 --- a/src/interfaces/ecpg/include/ecpg_informix.h +++ b/src/interfaces/ecpg/include/ecpg_informix.h @@ -33,55 +33,55 @@ extern "C" { #endif -extern int rdatestr(date, char *); -extern void rtoday(date *); -extern int rjulmdy(date, short *); -extern int rdefmtdate(date *, const char *, const char *); -extern int rfmtdate(date, const char *, char *); -extern int rmdyjul(short *, date *); -extern int rstrdate(const char *, date *); -extern int rdayofweek(date); +extern int rdatestr(date d, char *str); +extern void rtoday(date * d); +extern int rjulmdy(date d, short *mdy); +extern int rdefmtdate(date * d, const char *fmt, const char *str); +extern int rfmtdate(date d, const char *fmt, char *str); +extern int rmdyjul(short *mdy, date * d); +extern int rstrdate(const char *str, date * d); +extern int rdayofweek(date d); -extern int rfmtlong(long, const char *, char *); -extern int rgetmsg(int, char *, int); -extern int risnull(int, const char *); -extern int rsetnull(int, char *); -extern int rtypalign(int, int); -extern int rtypmsize(int, int); -extern int rtypwidth(int, int); -extern void rupshift(char *); +extern int rfmtlong(long lng_val, const char *fmt, char *outbuf); +extern int rgetmsg(int msgnum, char *s, int maxsize); +extern int risnull(int t, const char *ptr); +extern int rsetnull(int t, char *ptr); +extern int rtypalign(int offset, int type); +extern int rtypmsize(int type, int len); +extern int rtypwidth(int sqltype, int sqllen); +extern void rupshift(char *str); -extern int byleng(char *, int); -extern void ldchar(char *, int, char *); +extern int byleng(char *str, int len); +extern void ldchar(char *src, int len, char *dest); -extern void ECPG_informix_set_var(int, void *, int); -extern void *ECPG_informix_get_var(int); +extern void ECPG_informix_set_var(int number, void *pointer, int lineno); +extern void *ECPG_informix_get_var(int number); extern void ECPG_informix_reset_sqlca(void); /* Informix defines these in decimal.h */ -int decadd(decimal *, decimal *, decimal *); -int deccmp(decimal *, decimal *); -void deccopy(decimal *, decimal *); -int deccvasc(const char *, int, decimal *); -int deccvdbl(double, decimal *); -int deccvint(int, decimal *); -int deccvlong(long, decimal *); -int decdiv(decimal *, decimal *, decimal *); -int decmul(decimal *, decimal *, decimal *); -int decsub(decimal *, decimal *, decimal *); -int dectoasc(decimal *, char *, int, int); -int dectodbl(decimal *, double *); -int dectoint(decimal *, int *); -int dectolong(decimal *, long *); +int decadd(decimal *arg1, decimal *arg2, decimal *sum); +int deccmp(decimal *arg1, decimal *arg2); +void deccopy(decimal *src, decimal *target); +int deccvasc(const char *cp, int len, decimal *np); +int deccvdbl(double dbl, decimal *np); +int deccvint(int in, decimal *np); +int deccvlong(long lng, decimal *np); +int decdiv(decimal *n1, decimal *n2, decimal *result); +int decmul(decimal *n1, decimal *n2, decimal *result); +int decsub(decimal *n1, decimal *n2, decimal *result); +int dectoasc(decimal *np, char *cp, int len, int right); +int dectodbl(decimal *np, double *dblp); +int dectoint(decimal *np, int *ip); +int dectolong(decimal *np, long *lngp); /* Informix defines these in datetime.h */ -extern void dtcurrent(timestamp *); -extern int dtcvasc(char *, timestamp *); -extern int dtsub(timestamp *, timestamp *, interval *); -extern int dttoasc(timestamp *, char *); -extern int dttofmtasc(timestamp *, char *, int, char *); -extern int intoasc(interval *, char *); -extern int dtcvfmtasc(char *, char *, timestamp *); +extern void dtcurrent(timestamp * ts); +extern int dtcvasc(char *str, timestamp * ts); +extern int dtsub(timestamp * ts1, timestamp * ts2, interval * iv); +extern int dttoasc(timestamp * ts, char *output); +extern int dttofmtasc(timestamp * ts, char *output, int str_len, char *fmtstr); +extern int intoasc(interval * i, char *str); +extern int dtcvfmtasc(char *inbuf, char *fmtstr, timestamp * dtvalue); #ifdef __cplusplus } diff --git a/src/interfaces/ecpg/include/ecpglib.h b/src/interfaces/ecpg/include/ecpglib.h index 00240109a6c..21a21344830 100644 --- a/src/interfaces/ecpg/include/ecpglib.h +++ b/src/interfaces/ecpg/include/ecpglib.h @@ -49,20 +49,24 @@ extern "C" { #endif -void ECPGdebug(int, FILE *); -bool ECPGstatus(int, const char *); -bool ECPGsetcommit(int, const char *, const char *); -bool ECPGsetconn(int, const char *); -bool ECPGconnect(int, int, const char *, const char *, const char *, const char *, int); -bool ECPGdo(const int, const int, const int, const char *, const bool, const int, const char *,...); -bool ECPGtrans(int, const char *, const char *); -bool ECPGdisconnect(int, const char *); -bool ECPGprepare(int, const char *, const bool, const char *, const char *); -bool ECPGdeallocate(int, int, const char *, const char *); -bool ECPGdeallocate_all(int, int, const char *); -char *ECPGprepared_statement(const char *, const char *, int); -PGconn *ECPGget_PGconn(const char *); -PGTransactionStatusType ECPGtransactionStatus(const char *); +void ECPGdebug(int n, FILE *dbgs); +bool ECPGstatus(int lineno, const char *connection_name); +bool ECPGsetcommit(int lineno, const char *mode, const char *connection_name); +bool ECPGsetconn(int lineno, const char *connection_name); +bool ECPGconnect(int lineno, int c, const char *name, const char *user, + const char *passwd, const char *connection_name, int autocommit); +bool ECPGdo(const int lineno, const int compat, const int force_indicator, + const char *connection_name, const bool questionmarks, + const int st, const char *query,...); +bool ECPGtrans(int lineno, const char *connection_name, const char *transaction); +bool ECPGdisconnect(int lineno, const char *connection_name); +bool ECPGprepare(int lineno, const char *connection_name, const bool questionmarks, + const char *name, const char *variable); +bool ECPGdeallocate(int lineno, int c, const char *connection_name, const char *name); +bool ECPGdeallocate_all(int lineno, int compat, const char *connection_name); +char *ECPGprepared_statement(const char *connection_name, const char *name, int lineno); +PGconn *ECPGget_PGconn(const char *connection_name); +PGTransactionStatusType ECPGtransactionStatus(const char *connection_name); /* print an error message */ void sqlprint(void); @@ -74,19 +78,21 @@ void sqlprint(void); /* dynamic SQL */ -bool ECPGdo_descriptor(int, const char *, const char *, const char *); -bool ECPGdeallocate_desc(int, const char *); -bool ECPGallocate_desc(int, const char *); -bool ECPGget_desc_header(int, const char *, int *); -bool ECPGget_desc(int, const char *, int,...); -bool ECPGset_desc_header(int, const char *, int); -bool ECPGset_desc(int, const char *, int,...); - -void ECPGset_noind_null(enum ECPGttype, void *); -bool ECPGis_noind_null(enum ECPGttype, const void *); -bool ECPGdescribe(int, int, bool, const char *, const char *,...); - -void ECPGset_var(int, void *, int); +bool ECPGdo_descriptor(int line, const char *connection, + const char *descriptor, const char *query); +bool ECPGdeallocate_desc(int line, const char *name); +bool ECPGallocate_desc(int line, const char *name); +bool ECPGget_desc_header(int lineno, const char *desc_name, int *count); +bool ECPGget_desc(int lineno, const char *desc_name, int index,...); +bool ECPGset_desc_header(int lineno, const char *desc_name, int count); +bool ECPGset_desc(int lineno, const char *desc_name, int index,...); + +void ECPGset_noind_null(enum ECPGttype type, void *ptr); +bool ECPGis_noind_null(enum ECPGttype type, const void *ptr); +bool ECPGdescribe(int line, int compat, bool input, + const char *connection_name, const char *stmt_name,...); + +void ECPGset_var(int number, void *pointer, int lineno); void *ECPGget_var(int number); /* dynamic result allocation */ diff --git a/src/interfaces/ecpg/include/pgtypes_date.h b/src/interfaces/ecpg/include/pgtypes_date.h index c668097466e..5490cf8217d 100644 --- a/src/interfaces/ecpg/include/pgtypes_date.h +++ b/src/interfaces/ecpg/include/pgtypes_date.h @@ -14,16 +14,16 @@ extern "C" #endif extern date * PGTYPESdate_new(void); -extern void PGTYPESdate_free(date *); -extern date PGTYPESdate_from_asc(char *, char **); -extern char *PGTYPESdate_to_asc(date); -extern date PGTYPESdate_from_timestamp(timestamp); -extern void PGTYPESdate_julmdy(date, int *); -extern void PGTYPESdate_mdyjul(int *, date *); -extern int PGTYPESdate_dayofweek(date); -extern void PGTYPESdate_today(date *); -extern int PGTYPESdate_defmt_asc(date *, const char *, const char *); -extern int PGTYPESdate_fmt_asc(date, const char *, char *); +extern void PGTYPESdate_free(date * d); +extern date PGTYPESdate_from_asc(char *str, char **endptr); +extern char *PGTYPESdate_to_asc(date dDate); +extern date PGTYPESdate_from_timestamp(timestamp dt); +extern void PGTYPESdate_julmdy(date jd, int *mdy); +extern void PGTYPESdate_mdyjul(int *mdy, date * jdate); +extern int PGTYPESdate_dayofweek(date dDate); +extern void PGTYPESdate_today(date * d); +extern int PGTYPESdate_defmt_asc(date * d, const char *fmt, const char *str); +extern int PGTYPESdate_fmt_asc(date dDate, const char *fmtstring, char *outbuf); #ifdef __cplusplus } diff --git a/src/interfaces/ecpg/include/pgtypes_interval.h b/src/interfaces/ecpg/include/pgtypes_interval.h index 3b17cd1d115..8471b609db5 100644 --- a/src/interfaces/ecpg/include/pgtypes_interval.h +++ b/src/interfaces/ecpg/include/pgtypes_interval.h @@ -36,10 +36,10 @@ extern "C" #endif extern interval * PGTYPESinterval_new(void); -extern void PGTYPESinterval_free(interval *); -extern interval * PGTYPESinterval_from_asc(char *, char **); -extern char *PGTYPESinterval_to_asc(interval *); -extern int PGTYPESinterval_copy(interval *, interval *); +extern void PGTYPESinterval_free(interval *intvl); +extern interval * PGTYPESinterval_from_asc(char *str, char **endptr); +extern char *PGTYPESinterval_to_asc(interval *span); +extern int PGTYPESinterval_copy(interval *intvlsrc, interval *intvldest); #ifdef __cplusplus } diff --git a/src/interfaces/ecpg/include/pgtypes_numeric.h b/src/interfaces/ecpg/include/pgtypes_numeric.h index 5c763a9eb61..61506f44ca8 100644 --- a/src/interfaces/ecpg/include/pgtypes_numeric.h +++ b/src/interfaces/ecpg/include/pgtypes_numeric.h @@ -43,24 +43,24 @@ extern "C" numeric *PGTYPESnumeric_new(void); decimal *PGTYPESdecimal_new(void); -void PGTYPESnumeric_free(numeric *); -void PGTYPESdecimal_free(decimal *); -numeric *PGTYPESnumeric_from_asc(char *, char **); -char *PGTYPESnumeric_to_asc(numeric *, int); -int PGTYPESnumeric_add(numeric *, numeric *, numeric *); -int PGTYPESnumeric_sub(numeric *, numeric *, numeric *); -int PGTYPESnumeric_mul(numeric *, numeric *, numeric *); -int PGTYPESnumeric_div(numeric *, numeric *, numeric *); -int PGTYPESnumeric_cmp(numeric *, numeric *); -int PGTYPESnumeric_from_int(signed int, numeric *); -int PGTYPESnumeric_from_long(signed long int, numeric *); -int PGTYPESnumeric_copy(numeric *, numeric *); -int PGTYPESnumeric_from_double(double, numeric *); -int PGTYPESnumeric_to_double(numeric *, double *); -int PGTYPESnumeric_to_int(numeric *, int *); -int PGTYPESnumeric_to_long(numeric *, long *); -int PGTYPESnumeric_to_decimal(numeric *, decimal *); -int PGTYPESnumeric_from_decimal(decimal *, numeric *); +void PGTYPESnumeric_free(numeric *var); +void PGTYPESdecimal_free(decimal *var); +numeric *PGTYPESnumeric_from_asc(char *str, char **endptr); +char *PGTYPESnumeric_to_asc(numeric *num, int dscale); +int PGTYPESnumeric_add(numeric *var1, numeric *var2, numeric *result); +int PGTYPESnumeric_sub(numeric *var1, numeric *var2, numeric *result); +int PGTYPESnumeric_mul(numeric *var1, numeric *var2, numeric *result); +int PGTYPESnumeric_div(numeric *var1, numeric *var2, numeric *result); +int PGTYPESnumeric_cmp(numeric *var1, numeric *var2); +int PGTYPESnumeric_from_int(signed int int_val, numeric *var); +int PGTYPESnumeric_from_long(signed long int long_val, numeric *var); +int PGTYPESnumeric_copy(numeric *src, numeric *dst); +int PGTYPESnumeric_from_double(double d, numeric *dst); +int PGTYPESnumeric_to_double(numeric *nv, double *dp); +int PGTYPESnumeric_to_int(numeric *nv, int *ip); +int PGTYPESnumeric_to_long(numeric *nv, long *lp); +int PGTYPESnumeric_to_decimal(numeric *src, decimal *dst); +int PGTYPESnumeric_from_decimal(decimal *src, numeric *dst); #ifdef __cplusplus } diff --git a/src/interfaces/ecpg/include/pgtypes_timestamp.h b/src/interfaces/ecpg/include/pgtypes_timestamp.h index 3e298378912..412ecc2d411 100644 --- a/src/interfaces/ecpg/include/pgtypes_timestamp.h +++ b/src/interfaces/ecpg/include/pgtypes_timestamp.h @@ -15,12 +15,12 @@ extern "C" { #endif -extern timestamp PGTYPEStimestamp_from_asc(char *, char **); -extern char *PGTYPEStimestamp_to_asc(timestamp); -extern int PGTYPEStimestamp_sub(timestamp *, timestamp *, interval *); -extern int PGTYPEStimestamp_fmt_asc(timestamp *, char *, int, const char *); -extern void PGTYPEStimestamp_current(timestamp *); -extern int PGTYPEStimestamp_defmt_asc(const char *, const char *, timestamp *); +extern timestamp PGTYPEStimestamp_from_asc(char *str, char **endptr); +extern char *PGTYPEStimestamp_to_asc(timestamp tstamp); +extern int PGTYPEStimestamp_sub(timestamp * ts1, timestamp * ts2, interval * iv); +extern int PGTYPEStimestamp_fmt_asc(timestamp * ts, char *output, int str_len, const char *fmtstr); +extern void PGTYPEStimestamp_current(timestamp * ts); +extern int PGTYPEStimestamp_defmt_asc(const char *str, const char *fmt, timestamp * d); extern int PGTYPEStimestamp_add_interval(timestamp * tin, interval * span, timestamp * tout); extern int PGTYPEStimestamp_sub_interval(timestamp * tin, interval * span, timestamp * tout); |