}
case SET_ENUM: {
const char *const *val = value;
- const char *const *_dval = default_value;
- const char *dval = _dval == NULL ? NULL : *_dval;
unsigned int len = strlen(*val);
- if (dump_default || strncmp(*val, dval, len) != 0 ||
- ((*val)[len] != ':' && (*val)[len] != '\0'))
+ if (dump_default)
str_append(str, *val);
+ else {
+ const char *const *_dval = default_value;
+ const char *dval = _dval == NULL ? NULL : *_dval;
+
+ i_assert(dval != NULL);
+ if (strncmp(*val, dval, len) != 0 ||
+ ((*val)[len] != ':' && (*val)[len] != '\0'))
+ str_append(str, *val);
+ }
break;
}
default:
idx = cache->field_file_map[i];
if (idx != (uint32_t)-1) {
i_assert(idx < used_fields_count &&
+ cache->file_field_map != NULL &&
cache->file_field_map[idx] == 0);
cache->file_field_map[idx] = i;
j++;
ctx.buffer = buffer_create_dynamic(default_pool, 4096);
ctx.field_seen = buffer_create_dynamic(default_pool, 64);
ctx.field_seen_value = 0;
- ctx.field_file_map = t_new(uint32_t, cache->fields_count);
+ ctx.field_file_map = t_new(uint32_t, cache->fields_count + 1);
t_array_init(&ctx.bitmask_pos, 32);
/* @UNSAFE: drop unused fields and create a field mapping for
name_pos += size;
} else {
/* existing record. need to find its name_offset */
+ i_assert(dir != NULL);
for (orig = 0; orig < dir->count; orig++) {
if (recs[orig].uid == sync_recs[src].uid)
break;
add_append_record(log->head, &append_rec);
view = mail_transaction_log_view_open(log);
- test_assert(view != NULL && log->views == view &&
+ i_assert(view != NULL);
+ test_assert(log->views == view &&
!view_is_file_refed(1) && !view_is_file_refed(2) &&
view_is_file_refed(3));
test_end();
test_begin("message id parser");
for (i = 0, j = 0; i < N_ELEMENTS(input); i++) {
msgid = input[i];
- while ((next_msgid = message_id_get_next(&msgid)) != NULL)
+ while ((next_msgid = message_id_get_next(&msgid)) != NULL) {
+ if (output[j] == NULL)
+ break;
test_assert(strcmp(output[j++], next_msgid) == 0);
- test_assert(output[j++] == NULL);
+ }
+ test_assert(output[j++] == NULL && next_msgid == NULL);
}
test_assert(j == N_ELEMENTS(output));
test_end();
ctx->set_roots =
p_new(pool, const struct setting_parser_info *, count + 2);
ctx->set_roots[0] = &mail_user_setting_parser_info;
- memcpy(ctx->set_roots + 1, set_roots, sizeof(*ctx->set_roots) * count);
+ if (set_roots != NULL) {
+ memcpy(ctx->set_roots + 1, set_roots,
+ sizeof(*ctx->set_roots) * count);
+ }
/* do all the global initialization. delay initializing plugins until
we drop privileges the first time. */
{
string_t *output;
const unsigned char *data;
- size_t size;
+ size_t size = 0;
ssize_t ret1, ret2;
unsigned int i, j, pos, input_len = strlen(input);
struct istream *istream, *crlf_istream;