Changeset: cbd1beffcffb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/cbd1beffcffb
Modified Files:
        sql/server/sql_semantic.c
Branch: Dec2025
Log Message:

Use ?: operator.


diffs (49 lines):

diff --git a/sql/server/sql_semantic.c b/sql/server/sql_semantic.c
--- a/sql/server/sql_semantic.c
+++ b/sql/server/sql_semantic.c
@@ -595,15 +595,19 @@ sql_bind_func__(mvc *sql, list *ff, cons
 
                                if ((f->type != type && f->type != filt) || 
(f->private && !private))
                                        continue;
-                               if (strcmp(f->base.name, fname) == 0 && 
((!exact && (list_length(f->ops) == list_length(ops) || (list_length(f->ops) <= 
list_length(ops) && f->vararg))) || (exact && list_cmp(f->ops, ops, (fcmp) 
&arg_subtype_cmp) == 0))) {
+                               if (strcmp(f->base.name, fname) == 0 &&
+                                       (exact
+                                        ? list_cmp(f->ops, ops, (fcmp) 
&arg_subtype_cmp) == 0
+                                        : (list_length(f->ops) == 
list_length(ops) ||
+                                               (list_length(f->ops) <= 
list_length(ops) && f->vararg)))) {
                                        int npoints = score_func(f, ops, exact, 
&downcast);
                                        if (downcast) {
-                                               if ((!dcand && (npoints || 
exact)) || (dcand && npoints > dpoints)) {
+                                               if (dcand ? npoints > dpoints : 
npoints || exact) {
                                                        dcand = f;
                                                        dpoints = npoints;
                                                }
                                        } else {
-                                               if ((!cand && (npoints || 
exact)) || (cand && npoints > points)) {
+                                               if (cand ? npoints > points : 
npoints || exact) {
                                                        cand = f;
                                                        points = npoints;
                                                }
@@ -618,15 +622,19 @@ sql_bind_func__(mvc *sql, list *ff, cons
 
                                if ((f->type != type && f->type != filt) || 
(f->private && !private))
                                        continue;
-                               if (strcmp(f->base.name, fname) == 0 && 
((!exact && (list_length(f->ops) == list_length(ops) || (list_length(f->ops) <= 
list_length(ops) && f->vararg))) || (exact && list_cmp(f->ops, ops, (fcmp) 
&arg_subtype_cmp) == 0))) {
+                               if (strcmp(f->base.name, fname) == 0 &&
+                                       (exact
+                                        ? list_cmp(f->ops, ops, (fcmp) 
&arg_subtype_cmp) == 0
+                                        : (list_length(f->ops) == 
list_length(ops) ||
+                                               (list_length(f->ops) <= 
list_length(ops) && f->vararg)))) {
                                        int npoints = score_func(f, ops, exact, 
&downcast);
                                        if (downcast) {
-                                               if ((!dcand && (npoints || 
exact)) || (dcand && npoints > dpoints)) {
+                                               if (dcand ? npoints > dpoints : 
npoints || exact) {
                                                        dcand = f;
                                                        dpoints = npoints;
                                                }
                                        } else {
-                                               if ((!cand && (npoints || 
exact)) || (cand && npoints > points)) {
+                                               if (cand ? npoints > points : 
npoints || exact) {
                                                        cand = f;
                                                        points = npoints;
                                                }
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to