[New-bugs-announce] [issue10324] Modules/binascii.c: simplify expressions

Nicolas Kaiser report at bugs.python.org
Fri Nov 5 13:31:22 CET 2010


New submission from Nicolas Kaiser <nikai at nikai.net>:

Hi there!

I noticed two expressions that can be simplified like:
 (a || (!a && b)) => (a || b)

Best regards,
Nicolas Kaiser
---
--- a/Modules/binascii.c	2010-11-05 13:21:22.075303326 +0100
+++ b/Modules/binascii.c	2010-11-05 13:24:16.986174756 +0100
@@ -1337,8 +1337,7 @@ binascii_b2a_qp (PyObject *self, PyObjec
             ((data[in] == '\t' || data[in] == ' ') && (in + 1 == datalen)) ||
             ((data[in] < 33) &&
              (data[in] != '\r') && (data[in] != '\n') &&
-             (quotetabs ||
-            (!quotetabs && ((data[in] != '\t') && (data[in] != ' '))))))
+             (quotetabs || ((data[in] != '\t') && (data[in] != ' ')))))
         {
             if ((linelen + 3) >= MAXLINESIZE) {
                 linelen = 0;
@@ -1410,8 +1409,7 @@ binascii_b2a_qp (PyObject *self, PyObjec
             ((data[in] == '\t' || data[in] == ' ') && (in + 1 == datalen)) ||
             ((data[in] < 33) &&
              (data[in] != '\r') && (data[in] != '\n') &&
-             (quotetabs ||
-            (!quotetabs && ((data[in] != '\t') && (data[in] != ' '))))))
+             (quotetabs || ((data[in] != '\t') && (data[in] != ' ')))))
         {
             if ((linelen + 3 )>= MAXLINESIZE) {
                 odata[out++] = '=';

----------
components: Extension Modules
messages: 120490
nosy: nikai
priority: normal
severity: normal
status: open
title: Modules/binascii.c: simplify expressions
type: feature request
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10324>
_______________________________________


More information about the New-bugs-announce mailing list