DragonFly submit List (threaded) for 2007-09
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
[PATCH] Make lconv structure conform to standards
# HG changeset patch
# User Hasso Tepper <hasso@estpak.ee>
# Date 1190036068 -10800
# Branch HEAD
# Node ID 51e8f74fa249c71245397caa7c5621de9b747b85
# Parent 88abc9bd0f9f92e14429142e68b28b87123fb20f
Make lconv structure conform to standards.
Unconstify members of the lconv structure to make it conform to the C89
and C99 standards. At the moment the code snippets like this will compile
without warning on every platform I looked at except DragonFly:
char *foo = lconv->thousands_sep;
In DragonFly we get warning while using C and error while using C++.
If there is no significant objections, I'll commit it in Wednesday.
diff --git a/include/locale.h b/include/locale.h
--- a/include/locale.h
+++ b/include/locale.h
@@ -36,16 +36,16 @@
#define _LOCALE_H_
struct lconv {
- const char *decimal_point;
- const char *thousands_sep;
- const char *grouping;
- const char *int_curr_symbol;
- const char *currency_symbol;
- const char *mon_decimal_point;
- const char *mon_thousands_sep;
- const char *mon_grouping;
- const char *positive_sign;
- const char *negative_sign;
+ char *decimal_point;
+ char *thousands_sep;
+ char *grouping;
+ char *int_curr_symbol;
+ char *currency_symbol;
+ char *mon_decimal_point;
+ char *mon_thousands_sep;
+ char *mon_grouping;
+ char *positive_sign;
+ char *negative_sign;
char int_frac_digits;
char frac_digits;
char p_cs_precedes;
diff --git a/lib/libc/locale/localeconv.c b/lib/libc/locale/localeconv.c
--- a/lib/libc/locale/localeconv.c
+++ b/lib/libc/locale/localeconv.c
@@ -31,15 +31,20 @@ localeconv(void)
if (__mlocale_changed) {
/* LC_MONETARY */
- ret.int_curr_symbol = _CurrentMonetaryLocale->int_curr_symbol;
- ret.currency_symbol = _CurrentMonetaryLocale->currency_symbol;
+ ret.int_curr_symbol =
+ (char *)_CurrentMonetaryLocale->int_curr_symbol;
+ ret.currency_symbol =
+ (char *)_CurrentMonetaryLocale->currency_symbol;
ret.mon_decimal_point =
- _CurrentMonetaryLocale->mon_decimal_point;
+ (char *)_CurrentMonetaryLocale->mon_decimal_point;
ret.mon_thousands_sep =
- _CurrentMonetaryLocale->mon_thousands_sep;
- ret.mon_grouping = _CurrentMonetaryLocale->mon_grouping;
- ret.positive_sign = _CurrentMonetaryLocale->positive_sign;
- ret.negative_sign = _CurrentMonetaryLocale->negative_sign;
+ (char *)_CurrentMonetaryLocale->mon_thousands_sep;
+ ret.mon_grouping =
+ (char *)_CurrentMonetaryLocale->mon_grouping;
+ ret.positive_sign =
+ (char *)_CurrentMonetaryLocale->positive_sign;
+ ret.negative_sign =
+ (char *)_CurrentMonetaryLocale->negative_sign;
ret.int_frac_digits = _CurrentMonetaryLocale->int_frac_digits;
ret.frac_digits = _CurrentMonetaryLocale->frac_digits;
ret.p_cs_precedes = _CurrentMonetaryLocale->p_cs_precedes;
@@ -63,14 +68,12 @@ localeconv(void)
if (__nlocale_changed) {
/* LC_NUMERIC */
- /* LINTED const castaway */
ret.decimal_point =
(char *)_CurrentNumericLocale->decimal_point;
- /* LINTED const castaway */
ret.thousands_sep =
(char *)_CurrentNumericLocale->thousands_sep;
- /* LINTED const castaway */
- ret.grouping = (char *) _CurrentNumericLocale->grouping;
+ ret.grouping =
+ (char *)_CurrentNumericLocale->grouping;
__nlocale_changed = 0;
}
diff --git a/usr.bin/locale/locale.c b/usr.bin/locale/locale.c
--- a/usr.bin/locale/locale.c
+++ b/usr.bin/locale/locale.c
@@ -56,8 +56,8 @@ void list_charmaps(void);
void list_charmaps(void);
void list_locales(void);
const char *lookup_localecat(int);
-const char *kwval_lconv(int);
-int kwval_lookup(char *, const char **, int *, int *);
+char *kwval_lconv(int);
+int kwval_lookup(char *, char **, int *, int *);
void showdetails(char *);
void showkeywordslist(void);
void showlocale(void);
@@ -473,11 +473,11 @@ showlocale(void)
/*
* keyword value lookup helper (via localeconv())
*/
-const char *
+char *
kwval_lconv(int id)
{
struct lconv *lc;
- const char *rval;
+ char *rval;
rval = NULL;
lc = localeconv();
@@ -558,7 +558,7 @@ kwval_lconv(int id)
* keyword value and properties lookup
*/
int
-kwval_lookup(char *kwname, const char **kwval, int *cat, int *isstr)
+kwval_lookup(char *kwname, char **kwval, int *cat, int *isstr)
{
int rval;
size_t i;
@@ -589,7 +589,7 @@ showdetails(char *kw)
showdetails(char *kw)
{
int isstr, cat, tmpval;
- const char *kwval;
+ char *kwval;
if (kwval_lookup(kw, &kwval, &cat, &isstr) == 0) {
/*
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]