* @param str string representation of flag (eg. 'on')
* @return numeric value of flag (0 or 1)
*/
-gchar rspamd_config_parse_flag (const gchar *str, guint len);
+gint rspamd_config_parse_flag (const gchar *str, guint len);
enum rspamd_post_load_options {
RSPAMD_CONFIG_INIT_URL = 1 << 0,
return res;
}
-gchar
+gint
rspamd_config_parse_flag (const gchar *str, guint len)
{
- gchar c;
+ gint c;
if (!str || !*str) {
return -1;
return ucl_object_toboolean(enabled);
}
else if (ucl_object_type(enabled) == UCL_STRING) {
- gchar ret;
-
- ret = rspamd_config_parse_flag(ucl_object_tostring(enabled), 0);
+ gint ret = rspamd_config_parse_flag(ucl_object_tostring(enabled), 0);
if (ret == 0) {
return FALSE;
return !ucl_object_toboolean(disabled);
}
else if (ucl_object_type(disabled) == UCL_STRING) {
- gchar ret;
-
- ret = rspamd_config_parse_flag(ucl_object_tostring(disabled), 0);
+ gint ret = rspamd_config_parse_flag(ucl_object_tostring(disabled), 0);
if (ret == 0) {
return TRUE;
if (page_size == -1) {
page_size = 4096;
}
- posix_memalign(&buf, page_size, unserialized_size);
- if (buf == nullptr) {
+ auto errcode = posix_memalign(&buf, page_size, unserialized_size);
+ if (errcode != 0 || buf == nullptr) {
return tl::make_unexpected(error {"Cannot allocate memory", errno, error_category::CRITICAL });
}