/** \file osl_core.h Object storage layer details, not visible to users. */
#include "rbtree.h"
-#include "osl.h"
-#include "string.h"
#include "hash.h"
static __must_check __printf_1_2 __malloc char *make_message(const char *fmt, ...);
index_offset = t->index_header_size + t->row_index_size * row_num;
if (index_offset + 8 > t->index_map.size) {
*row_index = NULL;
- return -E_INDEX_CORRUPTION;
+ return -E_OSL_INDEX_CORRUPTION;
}
*row_index = (char *)(t->index_map.data) + index_offset;
return 1;
_static_inline_ char *disk_storage_path(const struct osl_table *t,
unsigned col_num, const char *ds_name)
{
- char *dirname = column_filename(t, col_num);
- char *filename = make_message("%s/%s", dirname, ds_name);
+ char *filename, *dirname = column_filename(t, col_num);
+
+ if (!dirname)
+ return NULL;
+ filename = make_message("%s/%s", dirname, ds_name);
free(dirname);
return filename;
}
*
* \param num_rbtrees The number of rbtrees for this row.
*
- * \return A pointer to a zeroed-out area suitable for holding an osl row
- * with \a num_rbtrees rbtree columns.
+ * \return A pointer to a zeroed-out area suitable for holding an osl row with
+ * \a num_rbtrees rbtree columns or \p NULL if no memory could be allocated.
*/
_static_inline_ struct osl_row *allocate_row(unsigned num_rbtrees)
{
size_t s = RB_NODES_OFFSET + num_rbtrees * sizeof(struct rb_node);
- return para_calloc(s);
+ return calloc(1, s);
}
/**
hash_to_asc(hash, asc);
if (t->desc->flags & OSL_LARGE_TABLE)
return make_message("%.2s/%s", asc, asc + 2);
- return para_strdup(asc);
+ return strdup(asc);
}
/**