Module Name:    src
Committed By:   jruoho
Date:           Wed Mar 30 08:22:02 UTC 2011

Modified Files:
        src/lib/libc/citrus: citrus_iconv.c citrus_prop.c citrus_prop.h

Log Message:
>From Henning Petersen in PR # 44641: C99 primitive type 'bool' used
as a variable name. Also small KNF, as in FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/citrus/citrus_iconv.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/citrus/citrus_prop.c \
    src/lib/libc/citrus/citrus_prop.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/citrus/citrus_iconv.c
diff -u src/lib/libc/citrus/citrus_iconv.c:1.8 src/lib/libc/citrus/citrus_iconv.c:1.9
--- src/lib/libc/citrus/citrus_iconv.c:1.8	Sat Sep  5 06:44:27 2009
+++ src/lib/libc/citrus/citrus_iconv.c	Wed Mar 30 08:22:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: citrus_iconv.c,v 1.8 2009/09/05 06:44:27 dholland Exp $	*/
+/*	$NetBSD: citrus_iconv.c,v 1.9 2011/03/30 08:22:01 jruoho Exp $	*/
 
 /*-
  * Copyright (c)2003 Citrus Project,
@@ -28,22 +28,25 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_iconv.c,v 1.8 2009/09/05 06:44:27 dholland Exp $");
+__RCSID("$NetBSD: citrus_iconv.c,v 1.9 2011/03/30 08:22:01 jruoho Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
 #include "reentrant.h"
+
+#include <sys/types.h>
+#include <sys/queue.h>
+
 #include <assert.h>
+#include <dirent.h>
+#include <errno.h>
+#include <limits.h>
+#include <paths.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <errno.h>
-#include <limits.h>
 #include <unistd.h>
-#include <paths.h>
-#include <dirent.h>
-#include <sys/types.h>
-#include <sys/queue.h>
 
 #include "citrus_namespace.h"
 #include "citrus_bcs.h"
@@ -65,7 +68,8 @@
 #ifdef _REENTRANT
 static rwlock_t lock = RWLOCK_INITIALIZER;
 #endif
-static int isinit = 0;
+
+static bool isinit = false;
 static _CITRUS_HASH_HEAD(, _citrus_iconv_shared, CI_HASH_SIZE) shared_pool;
 static TAILQ_HEAD(, _citrus_iconv_shared) shared_unused;
 static int shared_num_unused, shared_max_reuse;
@@ -82,7 +86,7 @@
 			shared_max_reuse = atoi(getenv(CI_ENV_MAX_REUSE));
 		if (shared_max_reuse < 0)
 			shared_max_reuse = CI_INITIAL_MAX_REUSE;
-		isinit = 1;
+		isinit = true;
 	}
 	rwlock_unlock(&lock);
 }

Index: src/lib/libc/citrus/citrus_prop.c
diff -u src/lib/libc/citrus/citrus_prop.c:1.3 src/lib/libc/citrus/citrus_prop.c:1.4
--- src/lib/libc/citrus/citrus_prop.c:1.3	Wed Nov 22 23:47:21 2006
+++ src/lib/libc/citrus/citrus_prop.c	Wed Mar 30 08:22:01 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: citrus_prop.c,v 1.3 2006/11/22 23:47:21 tnozaki Exp $ */
+/* $NetBSD: citrus_prop.c,v 1.4 2011/03/30 08:22:01 jruoho Exp $ */
 
 /*-
  * Copyright (c)2006 Citrus Project,
@@ -29,12 +29,13 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_prop.c,v 1.3 2006/11/22 23:47:21 tnozaki Exp $");
+__RCSID("$NetBSD: citrus_prop.c,v 1.4 2011/03/30 08:22:01 jruoho Exp $");
 #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;
 		}
 	}
@@ -406,11 +408,25 @@
 	errnum = (*hint->cb._func_.func)(context,	\
 	    hint->name,	ostart.u._func_, oend.u._func_);\
 } while (/*CONSTCOND*/0)
+
 		switch (hint->type) {
-		case _CITRUS_PROP_BOOL: CALL0(bool); break;
-		case _CITRUS_PROP_STR : CALL0( str); break;
-		case _CITRUS_PROP_CHR : CALL1( chr); break;
-		case _CITRUS_PROP_NUM : CALL1( num); 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;
+
 		default:
 			abort();
 			/*NOTREACHED*/
Index: src/lib/libc/citrus/citrus_prop.h
diff -u src/lib/libc/citrus/citrus_prop.h:1.3 src/lib/libc/citrus/citrus_prop.h:1.4
--- src/lib/libc/citrus/citrus_prop.h:1.3	Thu Nov 23 13:59:03 2006
+++ src/lib/libc/citrus/citrus_prop.h	Wed Mar 30 08:22:01 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: citrus_prop.h,v 1.3 2006/11/23 13:59:03 tnozaki Exp $ */
+/* $NetBSD: citrus_prop.h,v 1.4 2011/03/30 08:22:01 jruoho Exp $ */
 
 /*-
  * Copyright (c)2006 Citrus Project,
@@ -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) \

Reply via email to