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 format_version[COLLATE_FORMAT_VERSION_LEN]; | ||||
char data_version[XLOCALE_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(format_version, 0, COLLATE_FORMAT_VERSION_LEN); | ||||
(void) strlcpy(vers, COLLATE_VERSION, sizeof (vers)); | (void) strlcpy(format_version, COLLATE_VERSION, | ||||
sizeof (format_version)); | |||||
(void) memset(data_version, 0, XLOCALE_VERSION_LEN); | |||||
if (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) strlcpy(data_version, version, sizeof (data_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. | |||||
/* Time to write the entire data set out */ | /* Time to write the entire data set out */ | ||||
if ((wr_category(vers, COLLATE_STR_LEN, f) < 0) || | if ((wr_category(format_version, COLLATE_FORMAT_VERSION_LEN, f) < 0) || | ||||
(wr_category(data_version, XLOCALE_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.