NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/44641: Word bool used as variable name.



>Number:         44641
>Category:       lib
>Synopsis:       Word bool used as variable name.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 26 12:20:01 +0000 2011
>Originator:     Henning Petersen
>Release:        NetBSD-current
>Organization:
>Environment:
>Description:
Word bool used as variable name , rename bool to boolean.
>How-To-Repeat:

>Fix:
        diff -u -r1.3 citrus_prop.c
--- lib/libc/citrus/citrus_prop.c       22 Nov 2006 23:47:21 -0000      1.3
+++ lib/libc/citrus/citrus_prop.c       26 Feb 2011 09:41:47 -0000
@@ -33,8 +33,9 @@
 #endif /* LIBC_SCCS and not lint */
 
 #include <assert.h>
-#include <limits.h>
 #include <errno.h>
+#include <limits.h>
+#include <stdbool.h>
 #include <stddef.h>
 #include <stdio.h>
 #include <stdint.h>
@@ -51,7 +52,8 @@
        _citrus_prop_type_t type;
        union {
                const char *str;
-               int bool, chr;
+               int chr;
+               bool boolean;
                uint64_t num;
        } u;
 } _citrus_prop_object_t;
@@ -228,7 +230,7 @@
                if (_bcs_tolower(_memstream_getc(ms)) == 'r' &&
                    _bcs_tolower(_memstream_getc(ms)) == 'u' &&
                    _bcs_tolower(_memstream_getc(ms)) == 'e') {
-                       obj->u.bool = 1;
+                       obj->u.boolean = true;
                        return 0;
                }
                break;
@@ -237,7 +239,7 @@
                    _bcs_tolower(_memstream_getc(ms)) == 'l' &&
                    _bcs_tolower(_memstream_getc(ms)) == 's' &&
                    _bcs_tolower(_memstream_getc(ms)) == 'e') {
-                       obj->u.bool = 0;
+                       obj->u.boolean = false;
                        return 0;
                }
        }
@@ -407,7 +409,7 @@
            hint->name, ostart.u._func_, oend.u._func_);\
 } while (/*CONSTCOND*/0)
                switch (hint->type) {
-               case _CITRUS_PROP_BOOL: CALL0(bool); break;
+               case _CITRUS_PROP_BOOL: CALL0(boolean); break;
                case _CITRUS_PROP_STR : CALL0( str); break;
                case _CITRUS_PROP_CHR : CALL1( chr); break;
                case _CITRUS_PROP_NUM : CALL1( num); break;
Index: lib/libc/citrus/citrus_prop.h
===================================================================


diff -u -r1.3 citrus_prop.h
--- lib/libc/citrus/citrus_prop.h       23 Nov 2006 13:59:03 -0000      1.3
+++ lib/libc/citrus/citrus_prop.h       26 Feb 2011 09:41:47 -0000
@@ -45,7 +45,7 @@
 typedef struct { \
        _citrus_prop_##_func_##_cb_func_t func; \
 } _citrus_prop_##_func_##_cb_t;
-_CITRUS_PROP_CB0_T(bool, int)
+_CITRUS_PROP_CB0_T(boolean, int)
 _CITRUS_PROP_CB0_T(str, const char *)
 #undef _CITRUS_PROP_CB0_T
 
@@ -65,7 +65,7 @@
 #define _CITRUS_PROP_CB_T_OPS(_name_) \
        _citrus_prop_##_name_##_cb_t _name_
        union {
-               _CITRUS_PROP_CB_T_OPS(bool);
+               _CITRUS_PROP_CB_T_OPS(boolean);
                _CITRUS_PROP_CB_T_OPS(str);
                _CITRUS_PROP_CB_T_OPS(chr);
                _CITRUS_PROP_CB_T_OPS(num);
@@ -73,7 +73,7 @@
 };
 
 #define _CITRUS_PROP_HINT_BOOL(name, cb) \
-       { name, _CITRUS_PROP_BOOL, { .bool = { cb } } }
+       { name, _CITRUS_PROP_BOOL, { .boolean = { cb } } }
 #define _CITRUS_PROP_HINT_STR(name, cb) \
        { name, _CITRUS_PROP_STR, { .str = { cb } } }
 #define _CITRUS_PROP_HINT_CHR(name, cb) \



Home | Main Index | Thread Index | Old Index