1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 14:56:39 +02:00

core: fix priority of logical operators in evaluation of expression

The AND ("&&") takes precedence over the OR ("||").

Before the fix:
>> 1 || 1 && 0
== [0]

After the fix:
>> 1 || 1 && 0
== [1]

Since the "&&" has higher priority, expression is evaluated as:
"1 || (1 && 0)".
This commit is contained in:
Sebastien Helleu
2013-07-24 08:15:17 +02:00
parent ea76cdb06e
commit 50ab62b75d
3 changed files with 6 additions and 4 deletions
+3 -1
View File
@@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.4.2-dev, 2013-07-22
v0.4.2-dev, 2013-07-24
This document lists all changes for each version.
@@ -14,6 +14,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
Version 0.4.2 (under dev!)
--------------------------
* core: fix priority of logical operators in evaluation of expression
(AND takes precedence over the OR)
* core: remove gap after read marker line when there is no bar on the right
(bug #39548)
* core: add CA_FILE option in cmake and configure to setup default
+1 -1
View File
@@ -40,7 +40,7 @@
#include "../plugins/plugin.h"
char *logical_ops[EVAL_NUM_LOGICAL_OPS] = { "&&", "||" };
char *logical_ops[EVAL_NUM_LOGICAL_OPS] = { "||", "&&" };
char *comparisons[EVAL_NUM_COMPARISONS] = { "==", "!=", "<=", "<", ">=", ">",
"=~", "!~" };
+2 -2
View File
@@ -27,8 +27,8 @@ struct t_hashtable;
enum t_eval_logical_op
{
EVAL_LOGICAL_OP_AND = 0,
EVAL_LOGICAL_OP_OR,
EVAL_LOGICAL_OP_OR = 0,
EVAL_LOGICAL_OP_AND,
/* number of comparison strings */
EVAL_NUM_LOGICAL_OPS,
};