/*
- * Copyright (C) 2007-2009 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2007-2009 Andre Noll <maan@tuebingen.mpg.de>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
__printf_2_3 void __log(int ll, const char* fmt,...)
{
va_list argp;
- FILE *outfd;
struct tm *tm;
time_t t1;
char str[255] = "";
if (ll < loglevel)
return;
- outfd = stderr;
time(&t1);
tm = localtime(&t1);
strftime(str, sizeof(str), "%b %d %H:%M:%S", tm);
- fprintf(outfd, "%s ", str);
+ fprintf(stderr, "%s ", str);
va_start(argp, fmt);
- vfprintf(outfd, fmt, argp);
+ vfprintf(stderr, fmt, argp);
va_end(argp);
}
ret = -E_OSL_BAD_STORAGE_FLAGS;
if (st == OSL_DISK_STORAGE && sf & OSL_RBTREE)
goto err;
+ if ((sf & OSL_RBTREE) && !(sf & OSL_UNIQUE))
+ WARNING_LOG("invalid storage flags for column %s: "
+ "OSL_RBTREE && !OSL_UNIQUE\n", cd->name);
ret = -E_OSL_BAD_STORAGE_SIZE;
if (sf & OSL_FIXED_SIZE && !cd->data_size)
goto err;
strcpy(buf + offset + IDX_CD_NAME, cd->name);
offset += index_column_description_size(cd->name);
}
- assert(offset = size);
+ assert(offset == size);
filename = index_filename(t->desc);
if (filename)
ret = write_file(filename, buf, size);
/* add valid rows to rbtrees */
t->num_invalid_rows = 0;
for (i = 0; i < t->num_rows; i++) {
+ struct osl_object *volatile_objs;
ret = row_is_invalid(t, i);
if (ret < 0)
return ret;
t->num_invalid_rows++;
continue;
}
- ret = add_row_to_rbtrees(t, i, NULL, NULL);
+ if (t->num_volatile_columns > 0) {
+ volatile_objs = calloc(t->num_volatile_columns,
+ sizeof(struct osl_object));
+ if (!volatile_objs)
+ return -E_OSL_NOMEM;
+ } else
+ volatile_objs = NULL;
+ ret = add_row_to_rbtrees(t, i, volatile_objs, NULL);
if (ret < 0)
return ret;
}