summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/intl/intl_data.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/ext/intl/intl_data.h b/ext/intl/intl_data.h
index 74b7092fbb..898a174a22 100644
--- a/ext/intl/intl_data.h
+++ b/ext/intl/intl_data.h
@@ -103,19 +103,23 @@ typedef struct _intl_data {
RETVAL_NEW_STR(u8str); \
}
-#define INTL_MAX_LOCALE_LEN 80
+#define INTL_MAX_LOCALE_LEN (ULOC_FULLNAME_CAPACITY-1)
#define INTL_CHECK_LOCALE_LEN(locale_len) \
if((locale_len) > INTL_MAX_LOCALE_LEN) { \
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, \
- "Locale string too long, should be no longer than 80 characters", 0 ); \
+ char *_msg; \
+ spprintf(&_msg, 0, "Locale string too long, should be no longer than %d characters", INTL_MAX_LOCALE_LEN); \
+ intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, _msg, 1); \
+ efree(_msg); \
RETURN_NULL(); \
}
#define INTL_CHECK_LOCALE_LEN_OR_FAILURE(locale_len) \
if((locale_len) > INTL_MAX_LOCALE_LEN) { \
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, \
- "Locale string too long, should be no longer than 80 characters", 0 ); \
+ char *_msg; \
+ spprintf(&_msg, 0, "Locale string too long, should be no longer than %d characters", INTL_MAX_LOCALE_LEN); \
+ intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, _msg, 1); \
+ efree(_msg); \
return FAILURE; \
}