Changeset: f3f1965bf509 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f3f1965bf509
Modified Files:
sql/backends/monet5/sql.c
sql/backends/monet5/sql_cast.c
sql/backends/monet5/sql_fround.c
sql/backends/monet5/sql_round.c
sql/server/sql_atom.c
sql/server/sql_atom.h
Branch: Oct2014
Log Message:
Code de-duplication. We really don't need five copies!
diffs (152 lines):
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -3186,28 +3186,6 @@ PBATSQLidentity(Client cntxt, MalBlkPtr
}
-lng scales[20] = {
- LL_CONSTANT(1),
- LL_CONSTANT(10),
- LL_CONSTANT(100),
- LL_CONSTANT(1000),
- LL_CONSTANT(10000),
- LL_CONSTANT(100000),
- LL_CONSTANT(1000000),
- LL_CONSTANT(10000000),
- LL_CONSTANT(100000000),
- LL_CONSTANT(1000000000),
- LL_CONSTANT(10000000000),
- LL_CONSTANT(100000000000),
- LL_CONSTANT(1000000000000),
- LL_CONSTANT(10000000000000),
- LL_CONSTANT(100000000000000),
- LL_CONSTANT(1000000000000000),
- LL_CONSTANT(10000000000000000),
- LL_CONSTANT(100000000000000000),
- LL_CONSTANT(1000000000000000000)
-};
-
/*
* The core modules of Monet provide just a limited set of
* mathematical operators. The extensions required to support
diff --git a/sql/backends/monet5/sql_cast.c b/sql/backends/monet5/sql_cast.c
--- a/sql/backends/monet5/sql_cast.c
+++ b/sql/backends/monet5/sql_cast.c
@@ -37,28 +37,6 @@
#include "clients.h"
#include "mal_instruction.h"
-static lng scales[20] = {
- LL_CONSTANT(1),
- LL_CONSTANT(10),
- LL_CONSTANT(100),
- LL_CONSTANT(1000),
- LL_CONSTANT(10000),
- LL_CONSTANT(100000),
- LL_CONSTANT(1000000),
- LL_CONSTANT(10000000),
- LL_CONSTANT(100000000),
- LL_CONSTANT(1000000000),
- LL_CONSTANT(10000000000),
- LL_CONSTANT(100000000000),
- LL_CONSTANT(1000000000000),
- LL_CONSTANT(10000000000000),
- LL_CONSTANT(100000000000000),
- LL_CONSTANT(1000000000000000),
- LL_CONSTANT(10000000000000000),
- LL_CONSTANT(100000000000000000),
- LL_CONSTANT(1000000000000000000)
-};
-
str
nil_2_timestamp(timestamp *res, void *val)
{
diff --git a/sql/backends/monet5/sql_fround.c b/sql/backends/monet5/sql_fround.c
--- a/sql/backends/monet5/sql_fround.c
+++ b/sql/backends/monet5/sql_fround.c
@@ -34,28 +34,6 @@
#include "clients.h"
#include "mal_instruction.h"
-static lng scales[20] = {
- LL_CONSTANT(1),
- LL_CONSTANT(10),
- LL_CONSTANT(100),
- LL_CONSTANT(1000),
- LL_CONSTANT(10000),
- LL_CONSTANT(100000),
- LL_CONSTANT(1000000),
- LL_CONSTANT(10000000),
- LL_CONSTANT(100000000),
- LL_CONSTANT(1000000000),
- LL_CONSTANT(10000000000),
- LL_CONSTANT(100000000000),
- LL_CONSTANT(1000000000000),
- LL_CONSTANT(10000000000000),
- LL_CONSTANT(100000000000000),
- LL_CONSTANT(1000000000000000),
- LL_CONSTANT(10000000000000000),
- LL_CONSTANT(100000000000000000),
- LL_CONSTANT(1000000000000000000)
-};
-
/* Windows doesn't have round or trunc, but it does have floor and ceil */
#ifndef HAVE_ROUND
static inline double
diff --git a/sql/backends/monet5/sql_round.c b/sql/backends/monet5/sql_round.c
--- a/sql/backends/monet5/sql_round.c
+++ b/sql/backends/monet5/sql_round.c
@@ -34,28 +34,6 @@
#include "clients.h"
#include "mal_instruction.h"
-static lng scales[20] = {
- LL_CONSTANT(1),
- LL_CONSTANT(10),
- LL_CONSTANT(100),
- LL_CONSTANT(1000),
- LL_CONSTANT(10000),
- LL_CONSTANT(100000),
- LL_CONSTANT(1000000),
- LL_CONSTANT(10000000),
- LL_CONSTANT(100000000),
- LL_CONSTANT(1000000000),
- LL_CONSTANT(10000000000),
- LL_CONSTANT(100000000000),
- LL_CONSTANT(1000000000000),
- LL_CONSTANT(10000000000000),
- LL_CONSTANT(100000000000000),
- LL_CONSTANT(1000000000000000),
- LL_CONSTANT(10000000000000000),
- LL_CONSTANT(100000000000000000),
- LL_CONSTANT(1000000000000000000)
-};
-
#define CONCAT_2(a, b) a##b
#define CONCAT_3(a, b, c) a##b##c
diff --git a/sql/server/sql_atom.c b/sql/server/sql_atom.c
--- a/sql/server/sql_atom.c
+++ b/sql/server/sql_atom.c
@@ -499,7 +499,7 @@ atom_num_digits( atom *a )
return inlen;
}
-static lng scales[] = {
+lng scales[19] = {
LL_CONSTANT(1),
LL_CONSTANT(10),
LL_CONSTANT(100),
diff --git a/sql/server/sql_atom.h b/sql/server/sql_atom.h
--- a/sql/server/sql_atom.h
+++ b/sql/server/sql_atom.h
@@ -59,5 +59,8 @@ extern void atom_dump(atom *a, stream *s
extern lng atom_get_int(atom *a);
extern int atom_cmp(atom *a1, atom *a2);
+
+extern lng scales[19];
+
#endif /* _SQL_ATOM_H_ */
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list