Changeset: 25440d27e642 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=25440d27e642 Modified Files: clients/Tests/exports.stable.out monetdb5/modules/atoms/mtime.c monetdb5/modules/atoms/mtime.h monetdb5/modules/atoms/mtime.mal sql/backends/monet5/sql_scenario.c sql/backends/monet5/vaults/vault.c Branch: default Log Message:
Cleanup of mtime. A lot of pointer parameters to functions turned into const. A lot of exported functions that only call a static function with the same arguments are now replaced by the static function. A bunch of variables that are not used elsewhere are made static. diffs (truncated from 3029 to 300 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -1637,131 +1637,130 @@ void MSresetInstructions(MalBlkPtr mb, i void MSresetVariables(Client cntxt, MalBlkPtr mb, MalStkPtr glb, int start); void MSscheduleClient(str command, str challenge, bstream *fin, stream *fout); void MSserveClient(void *dummy); -str MTIMEcompute_rule_foryear(date *ret, rule *val, int *year); +str MTIMEcompute_rule_foryear(date *ret, const rule *val, const int *year); str MTIMEcurrent_date(date *d); str MTIMEcurrent_date(date *d); str MTIMEcurrent_time(daytime *t); str MTIMEcurrent_time(daytime *t); str MTIMEcurrent_timestamp(timestamp *t); str MTIMEcurrent_timestamp(timestamp *t); -str MTIMEdate2date(date *ret, date *src); -str MTIMEdate_add_msec_interval_lng_wrap(date *ret, date *t, lng *msec); -str MTIMEdate_add_sec_interval_wrap(date *ret, date *t, int *sec); -str MTIMEdate_adddays(date *ret, date *v, int *delta); -str MTIMEdate_addmonths(date *ret, date *v, int *delta); -str MTIMEdate_addyears(date *ret, date *v, int *delta); -str MTIMEdate_create(date *ret, int *year, int *month, int *day); -str MTIMEdate_date(date *d, date *s); -str MTIMEdate_diff(int *ret, date *v1, date *v2); -str MTIMEdate_diff_bulk(bat *ret, bat *bid1, bat *bid2); -str MTIMEdate_extract_day(int *ret, date *v); -str MTIMEdate_extract_day_bulk(int *ret, int *bid); -str MTIMEdate_extract_dayofweek(int *ret, date *v); -str MTIMEdate_extract_dayofyear(int *ret, date *v); -str MTIMEdate_extract_month(int *ret, date *v); -str MTIMEdate_extract_month_bulk(int *ret, int *bid); -str MTIMEdate_extract_weekofyear(int *ret, date *v); -str MTIMEdate_extract_year(int *ret, date *v); -str MTIMEdate_extract_year_bulk(int *ret, int *bid); -str MTIMEdate_fromstr(date *ret, str *s); -str MTIMEdate_sub_msec_interval_lng_wrap(date *ret, date *t, lng *msec); -str MTIMEdate_sub_sec_interval_wrap(date *ret, date *t, int *sec); +str MTIMEdate2date(date *ret, const date *src); +str MTIMEdate_add_msec_interval_lng_wrap(date *ret, const date *t, const lng *msec); +str MTIMEdate_add_sec_interval_wrap(date *ret, const date *t, const int *sec); +str MTIMEdate_adddays(date *ret, const date *v, const int *delta); +str MTIMEdate_addmonths(date *ret, const date *v, const int *delta); +str MTIMEdate_addyears(date *ret, const date *v, const int *delta); +str MTIMEdate_create(date *ret, const int *year, const int *month, const int *day); +str MTIMEdate_date(date *d, const date *s); +str MTIMEdate_diff(int *ret, const date *v1, const date *v2); +str MTIMEdate_diff_bulk(bat *ret, const bat *bid1, const bat *bid2); +str MTIMEdate_extract_day(int *ret, const date *v); +str MTIMEdate_extract_day_bulk(bat *ret, const bat *bid); +str MTIMEdate_extract_dayofweek(int *ret, const date *v); +str MTIMEdate_extract_dayofyear(int *ret, const date *v); +str MTIMEdate_extract_month(int *ret, const date *v); +str MTIMEdate_extract_month_bulk(bat *ret, const bat *bid); +str MTIMEdate_extract_weekofyear(int *ret, const date *v); +str MTIMEdate_extract_year(int *ret, const date *v); +str MTIMEdate_extract_year_bulk(bat *ret, const bat *bid); +str MTIMEdate_fromstr(date *ret, const char **s); +str MTIMEdate_sub_msec_interval_lng_wrap(date *ret, const date *t, const lng *msec); +str MTIMEdate_sub_sec_interval_wrap(date *ret, const date *t, const int *sec); str MTIMEdate_tostr(str *ret, const date *d); -str MTIMEday_from_str(int *ret, str *day); -str MTIMEday_to_str(str *ret, int *day); -str MTIMEdaytime1(daytime *ret, int *h); -str MTIMEdaytime2(daytime *ret, int *h, int *m); -str MTIMEdaytime2daytime(daytime *ret, daytime *src); -str MTIMEdaytime3(daytime *ret, int *h, int *m, int *s); -str MTIMEdaytime_create(daytime *ret, int *hour, int *min, int *sec, int *msec); -str MTIMEdaytime_extract_hours(int *ret, daytime *v); -str MTIMEdaytime_extract_hours_bulk(int *ret, int *bid); -str MTIMEdaytime_extract_milliseconds(int *ret, daytime *v); -str MTIMEdaytime_extract_milliseconds_bulk(int *ret, int *bid); -str MTIMEdaytime_extract_minutes(int *ret, daytime *v); -str MTIMEdaytime_extract_minutes_bulk(int *ret, int *bid); -str MTIMEdaytime_extract_seconds(int *ret, daytime *v); -str MTIMEdaytime_extract_seconds_bulk(int *ret, int *bid); -str MTIMEdaytime_extract_sql_seconds(int *ret, daytime *v); -str MTIMEdaytime_extract_sql_seconds_bulk(int *ret, int *bid); -str MTIMEdaytime_fromstr(daytime *ret, str *s); +str MTIMEday_from_str(int *ret, const char **day); +str MTIMEday_to_str(str *ret, const int *day); +str MTIMEdaytime1(daytime *ret, const int *h); +str MTIMEdaytime2(daytime *ret, const int *h, const int *m); +str MTIMEdaytime2daytime(daytime *ret, const daytime *src); +str MTIMEdaytime3(daytime *ret, const int *h, const int *m, const int *s); +str MTIMEdaytime_create(daytime *ret, const int *hour, const int *min, const int *sec, const int *msec); +str MTIMEdaytime_extract_hours(int *ret, const daytime *v); +str MTIMEdaytime_extract_hours_bulk(bat *ret, const bat *bid); +str MTIMEdaytime_extract_milliseconds(int *ret, const daytime *v); +str MTIMEdaytime_extract_milliseconds_bulk(bat *ret, const bat *bid); +str MTIMEdaytime_extract_minutes(int *ret, const daytime *v); +str MTIMEdaytime_extract_minutes_bulk(bat *ret, const bat *bid); +str MTIMEdaytime_extract_seconds(int *ret, const daytime *v); +str MTIMEdaytime_extract_seconds_bulk(bat *ret, const bat *bid); +str MTIMEdaytime_extract_sql_seconds(int *ret, const daytime *v); +str MTIMEdaytime_extract_sql_seconds_bulk(bat *ret, const bat *bid); +str MTIMEdaytime_fromstr(daytime *ret, const char **s); str MTIMEdaytime_tostr(str *ret, const daytime *d); str MTIMEepilogue(void); -str MTIMEepoch(timestamp *ret); -str MTIMEepoch2int(int *res, timestamp *ts); +str MTIMEepoch2int(int *res, const timestamp *ts); str MTIMElocal_timezone(lng *res); -str MTIMEmonth_from_str(int *ret, str *month); -str MTIMEmonth_to_str(str *ret, int *month); +str MTIMEmonth_from_str(int *ret, const char **month); +str MTIMEmonth_to_str(str *ret, const int *month); str MTIMEmsec(lng *r); -str MTIMEmsecs(lng *ret, int *d, int *h, int *m, int *s, int *ms); -str MTIMEnil2date(date *ret, int *src); -str MTIMEolddate(date *d, str *buf); -str MTIMEoldduration(int *ndays, str *s); +str MTIMEmsecs(lng *ret, const int *d, const int *h, const int *m, const int *s, const int *ms); +str MTIMEnil2date(date *ret, const int *src); +str MTIMEolddate(date *d, const char **buf); +str MTIMEoldduration(int *ndays, const char **s); str MTIMEprelude(void); -str MTIMEruleDef0(rule *ret, int *m, int *d, int *w, int *h, int *mint); -str MTIMEruleDef1(rule *ret, int *m, str *dnme, int *w, int *h, int *mint); -str MTIMEruleDef2(rule *ret, int *m, str *dnme, int *w, int *mint); -str MTIMErule_create(rule *ret, int *month, int *day, int *weekday, int *minutes); -str MTIMErule_extract_day(int *ret, rule *r); -str MTIMErule_extract_minutes(int *ret, rule *r); -str MTIMErule_extract_month(int *ret, rule *r); -str MTIMErule_extract_weekday(int *ret, rule *r); -str MTIMErule_fromstr(rule *ret, str *s); -str MTIMErule_fromstr(rule *ret, str *s); +str MTIMEruleDef0(rule *ret, const int *m, const int *d, const int *w, const int *h, const int *mint); +str MTIMEruleDef1(rule *ret, const int *m, const char **dnme, const int *w, const int *h, const int *mint); +str MTIMEruleDef2(rule *ret, const int *m, const char **dnme, const int *w, const int *mint); +str MTIMErule_create(rule *ret, const int *month, const int *day, const int *weekday, const int *minutes); +str MTIMErule_extract_day(int *ret, const rule *r); +str MTIMErule_extract_minutes(int *ret, const rule *r); +str MTIMErule_extract_month(int *ret, const rule *r); +str MTIMErule_extract_weekday(int *ret, const rule *r); +str MTIMErule_fromstr(rule *ret, const char **s); +str MTIMErule_fromstr(rule *ret, const char **s); str MTIMErule_tostr(str *s, const rule *r); -str MTIMEsecs2daytime(daytime *ret, lng *src); -str MTIMEsql_day(lng *ret, lng *t); -str MTIMEsql_hours(int *ret, lng *t); -str MTIMEsql_minutes(int *ret, lng *t); -str MTIMEsql_month(int *ret, int *t); -str MTIMEsql_seconds(int *ret, lng *t); -str MTIMEsql_year(int *ret, int *t); -str MTIMEstrftime(str *s, date *d, str *format); -str MTIMEstrptime(date *d, str *s, str *format); -str MTIMEsynonyms(bit *allow); -str MTIMEtime_add_msec_interval_wrap(daytime *ret, daytime *t, lng *msec); -str MTIMEtime_sub_msec_interval_wrap(daytime *ret, daytime *t, lng *msec); -str MTIMEtimestamp(timestamp *ret, int *sec); -str MTIMEtimestamp2timestamp(timestamp *ret, timestamp *src); -str MTIMEtimestamp_GE(bit *retval, timestamp *val1, timestamp *val2); -str MTIMEtimestamp_GT(bit *retval, timestamp *val1, timestamp *val2); -str MTIMEtimestamp_LE(bit *retval, timestamp *val1, timestamp *val2); -str MTIMEtimestamp_LT(bit *retval, timestamp *val1, timestamp *val2); +str MTIMEsecs2daytime(daytime *ret, const lng *src); +str MTIMEsql_day(lng *ret, const lng *t); +str MTIMEsql_hours(int *ret, const lng *t); +str MTIMEsql_minutes(int *ret, const lng *t); +str MTIMEsql_month(int *ret, const int *t); +str MTIMEsql_seconds(int *ret, const lng *t); +str MTIMEsql_year(int *ret, const int *t); +str MTIMEstrftime(str *s, const date *d, const char **format); +str MTIMEstrptime(date *d, const char **s, const char **format); +str MTIMEsynonyms(const bit *allow); +str MTIMEtime_add_msec_interval_wrap(daytime *ret, const daytime *t, const lng *msec); +str MTIMEtime_sub_msec_interval_wrap(daytime *ret, const daytime *t, const lng *msec); +str MTIMEtimestamp(timestamp *ret, const int *sec); +str MTIMEtimestamp2timestamp(timestamp *ret, const timestamp *src); +str MTIMEtimestamp_GE(bit *retval, const timestamp *val1, const timestamp *val2); +str MTIMEtimestamp_GT(bit *retval, const timestamp *val1, const timestamp *val2); +str MTIMEtimestamp_LE(bit *retval, const timestamp *val1, const timestamp *val2); +str MTIMEtimestamp_LT(bit *retval, const timestamp *val1, const timestamp *val2); str MTIMEtimestamp_add(timestamp *ret, const timestamp *v, const lng *msecs); -str MTIMEtimestamp_add_month_interval_wrap(timestamp *ret, timestamp *t, int *months); -str MTIMEtimestamp_create(timestamp *ret, date *d, daytime *t, tzone *z); -str MTIMEtimestamp_create_default(timestamp *ret, date *d, daytime *t); -str MTIMEtimestamp_create_from_date(timestamp *ret, date *d); -str MTIMEtimestamp_day(int *ret, timestamp *t); -str MTIMEtimestamp_diff(lng *ret, timestamp *v1, timestamp *v2); -str MTIMEtimestamp_diff_bulk(bat *ret, bat *bid1, bat *bid2); -str MTIMEtimestamp_extract_date(date *ret, timestamp *t, tzone *z); -str MTIMEtimestamp_extract_date_default(date *ret, timestamp *t); -str MTIMEtimestamp_extract_daytime(daytime *ret, timestamp *t, tzone *z); -str MTIMEtimestamp_extract_daytime_default(daytime *ret, timestamp *t); -str MTIMEtimestamp_fromstr(timestamp *ret, str *d); -str MTIMEtimestamp_hours(int *ret, timestamp *t); -str MTIMEtimestamp_inside_dst(bit *ret, timestamp *p, tzone *z); -str MTIMEtimestamp_lng(timestamp *ret, lng *msecs); -str MTIMEtimestamp_milliseconds(int *ret, timestamp *t); -str MTIMEtimestamp_minutes(int *ret, timestamp *t); -str MTIMEtimestamp_month(int *ret, timestamp *t); -str MTIMEtimestamp_seconds(int *ret, timestamp *t); -str MTIMEtimestamp_sql_seconds(int *ret, timestamp *t); -str MTIMEtimestamp_sub_month_interval_wrap(timestamp *ret, timestamp *t, int *months); -str MTIMEtimestamp_sub_msec_interval_lng_wrap(timestamp *ret, timestamp *t, lng *msec); -str MTIMEtimestamp_timestamp(timestamp *d, timestamp *s); -str MTIMEtimestamp_year(int *ret, timestamp *t); -str MTIMEtimezone(tzone *z, str *name); -str MTIMEtzone_create(tzone *ret, int *minutes); -str MTIMEtzone_create_dst(tzone *ret, int *minutes, rule *start, rule *end); -str MTIMEtzone_extract_end(rule *ret, tzone *t); -str MTIMEtzone_extract_minutes(int *ret, tzone *t); -str MTIMEtzone_extract_start(rule *ret, tzone *t); -str MTIMEtzone_fromstr(tzone *ret, str *s); +str MTIMEtimestamp_add_month_interval_wrap(timestamp *ret, const timestamp *t, const int *months); +str MTIMEtimestamp_create(timestamp *ret, const date *d, const daytime *t, const tzone *z); +str MTIMEtimestamp_create_default(timestamp *ret, const date *d, const daytime *t); +str MTIMEtimestamp_create_from_date(timestamp *ret, const date *d); +str MTIMEtimestamp_day(int *ret, const timestamp *t); +str MTIMEtimestamp_diff(lng *ret, const timestamp *v1, const timestamp *v2); +str MTIMEtimestamp_diff_bulk(bat *ret, const bat *bid1, const bat *bid2); +str MTIMEtimestamp_extract_date(date *ret, const timestamp *t, const tzone *z); +str MTIMEtimestamp_extract_date_default(date *ret, const timestamp *t); +str MTIMEtimestamp_extract_daytime(daytime *ret, const timestamp *t, const tzone *z); +str MTIMEtimestamp_extract_daytime_default(daytime *ret, const timestamp *t); +str MTIMEtimestamp_fromstr(timestamp *ret, const char **d); +str MTIMEtimestamp_hours(int *ret, const timestamp *t); +str MTIMEtimestamp_inside_dst(bit *ret, const timestamp *p, const tzone *z); +str MTIMEtimestamp_lng(timestamp *ret, const lng *msecs); +str MTIMEtimestamp_milliseconds(int *ret, const timestamp *t); +str MTIMEtimestamp_minutes(int *ret, const timestamp *t); +str MTIMEtimestamp_month(int *ret, const timestamp *t); +str MTIMEtimestamp_seconds(int *ret, const timestamp *t); +str MTIMEtimestamp_sql_seconds(int *ret, const timestamp *t); +str MTIMEtimestamp_sub_month_interval_wrap(timestamp *ret, const timestamp *t, const int *months); +str MTIMEtimestamp_sub_msec_interval_lng_wrap(timestamp *ret, const timestamp *t, const lng *msec); +str MTIMEtimestamp_timestamp(timestamp *d, const timestamp *s); +str MTIMEtimestamp_year(int *ret, const timestamp *t); +str MTIMEtimezone(tzone *z, const char **name); +str MTIMEtzone_create(tzone *ret, const int *minutes); +str MTIMEtzone_create_dst(tzone *ret, const int *minutes, const rule *start, const rule *end); +str MTIMEtzone_extract_end(rule *ret, const tzone *t); +str MTIMEtzone_extract_minutes(int *ret, const tzone *t); +str MTIMEtzone_extract_start(rule *ret, const tzone *t); +str MTIMEtzone_fromstr(tzone *ret, const char **s); str MTIMEtzone_get_local(tzone *z); -str MTIMEtzone_isnil(bit *retval, tzone *val); -str MTIMEtzone_set_local(int res, tzone *z); +str MTIMEtzone_isnil(bit *retval, const tzone *val); +str MTIMEtzone_set_local(int res, const tzone *z); str MTIMEtzone_tostr(str *s, const tzone *ret); str MTIMEunix_epoch(timestamp *ret); str OCTOPUSbidding(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); @@ -2463,11 +2462,11 @@ str datacyclotronRef; int dataflowConflict(InstrPtr p); str dataflowRef; str dateRef; -int date_fromstr(str buf, int *len, date **d); +int date_fromstr(const char *buf, int *len, date **d); int date_tostr(str *buf, int *len, const date *val); -int daytime_fromstr(str buf, int *len, daytime **ret); +int daytime_fromstr(const char *buf, int *len, daytime **ret); int daytime_tostr(str *buf, int *len, const daytime *val); -int daytime_tz_fromstr(str buf, int *len, daytime **ret); +int daytime_tz_fromstr(const char *buf, int *len, daytime **ret); str dblRef; str deactivateCounter(str name); void debugLifespan(Client cntxt, MalBlkPtr mb, Lifespan span); @@ -2546,8 +2545,6 @@ void freeStack(MalStkPtr stk); void freeSymbol(Symbol s); void freeSymbolList(Symbol s); void freeVariable(MalBlkPtr mb, int varid); -void fromdate(int n, int *d, int *m, int *y); -void fromtime(int n, int *hour, int *min, int *sec, int *msec); str fstrcmp0_impl(dbl *ret, str *string1, str *string2); str fstrcmp_impl(dbl *ret, str *string1, str *string2, dbl *minimum); str function2str(MalBlkPtr mb, int flg); @@ -2978,7 +2975,7 @@ str reverseRef; int rowsProp; str rpcRef; str rsColumnRef; -int rule_fromstr(str buf, int *len, rule **d); +int rule_fromstr(const char *buf, int *len, rule **d); int rule_tostr(str *buf, int *len, const rule *r); str runFactory(Client cntxt, MalBlkPtr mb, MalBlkPtr mbcaller, MalStkPtr stk, InstrPtr pci); str runMAL(Client c, MalBlkPtr mb, MalBlkPtr mbcaller, MalStkPtr env); @@ -3118,7 +3115,7 @@ str thetasubselectRef; str thetauselectRef; str tidRef; str timestampRef; -int timestamp_fromstr(str buf, int *len, timestamp **ret); +int timestamp_fromstr(const char *buf, int *len, timestamp **ret); timestamp *timestamp_nil; int timestamp_tostr(str *buf, int *len, const timestamp *val); int timestamp_tostr(str *buf, int *len, const timestamp *val); @@ -3136,8 +3133,8 @@ void trimMalVariables_(MalBlkPtr mb, bit int tubProp; str tuniqueRef; void typeChecker(stream *out, Module scope, MalBlkPtr mb, InstrPtr p, int silent); -int tzone_fromstr(str buf, int *len, tzone **d); -int tzone_fromstr(str buf, int *len, tzone **d); +int tzone_fromstr(const char *buf, int *len, tzone **d); +int tzone_fromstr(const char *buf, int *len, tzone **d); tzone tzone_local; int tzone_tostr(str *buf, int *len, const tzone *z); str unescape_str(str *retval, str s); diff --git a/monetdb5/modules/atoms/mtime.c b/monetdb5/modules/atoms/mtime.c --- a/monetdb5/modules/atoms/mtime.c +++ b/monetdb5/modules/atoms/mtime.c _______________________________________________ checkin-list mailing list [email protected] https://www.monetdb.org/mailman/listinfo/checkin-list
