Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/localedef/collate.c
Context not available. | |||||
collelem_t *ce; | collelem_t *ce; | ||||
collchar_t *cc; | collchar_t *cc; | ||||
subst_t *sb; | subst_t *sb; | ||||
char vers[COLLATE_STR_LEN]; | char fmt_version[COLLATE_FMT_VERSION_LEN]; | ||||
char def_version[XLOCALE_DEF_VERSION_LEN]; | |||||
collate_char_t chars[UCHAR_MAX + 1]; | collate_char_t chars[UCHAR_MAX + 1]; | ||||
collate_large_t *large; | collate_large_t *large; | ||||
collate_subst_t *subst[COLL_WEIGHTS_MAX]; | collate_subst_t *subst[COLL_WEIGHTS_MAX]; | ||||
Context not available. | |||||
} | } | ||||
(void) memset(&chars, 0, sizeof (chars)); | (void) memset(&chars, 0, sizeof (chars)); | ||||
(void) memset(vers, 0, COLLATE_STR_LEN); | (void) memset(fmt_version, 0, COLLATE_FMT_VERSION_LEN); | ||||
(void) strlcpy(vers, COLLATE_VERSION, sizeof (vers)); | (void) strlcpy(fmt_version, COLLATE_FMT_VERSION, sizeof (fmt_version)); | ||||
yuripv: Just a nit: I know that current localedef code does that a lot, but still `version != NULL`… | |||||
Done Inline ActionsHmm well it'd look odd next to all the nearby uses of implicit NULL comparison in this file, so I think it's probably better to keep it that way. munro_ip9.org: Hmm well it'd look odd next to all the nearby uses of implicit NULL comparison in this file, so… | |||||
(void) memset(def_version, 0, XLOCALE_DEF_VERSION_LEN); | |||||
if (version) | |||||
(void) strlcpy(def_version, version, sizeof (def_version)); | |||||
/* | /* | ||||
* We need to make sure we arrange for the UNDEFINED field | * We need to make sure we arrange for the UNDEFINED field | ||||
Context not available. | |||||
collinfo.chain_count = htote(chain_count); | collinfo.chain_count = htote(chain_count); | ||||
collinfo.large_count = htote(large_count); | collinfo.large_count = htote(large_count); | ||||
if ((wr_category(vers, COLLATE_STR_LEN, f) < 0) || | if ((wr_category(fmt_version, COLLATE_FMT_VERSION_LEN, f) < 0) || | ||||
(wr_category(def_version, XLOCALE_DEF_VERSION_LEN, f) < 0) || | |||||
(wr_category(&collinfo, sizeof (collinfo), f) < 0) || | (wr_category(&collinfo, sizeof (collinfo), f) < 0) || | ||||
(wr_category(&chars, sizeof (chars), f) < 0)) { | (wr_category(&chars, sizeof (chars), f) < 0)) { | ||||
return; | return; | ||||
Context not available. |
Just a nit: I know that current localedef code does that a lot, but still version != NULL would be a proper comparison here.