X-Git-Url: http://git.tuebingen.mpg.de/?p=osl.git;a=blobdiff_plain;f=osl_core.h;h=b6d1f8222878de726dfadeced976fc1f9c99799f;hp=87a118803ea4165ab2a767dbda1f7607a1a8b91b;hb=02e6053e5976c6aa4bf538f3469335835d54e478;hpb=5952112a37ecdaedf3b76e08f97d307f1056c512 diff --git a/osl_core.h b/osl_core.h index 87a1188..b6d1f82 100644 --- a/osl_core.h +++ b/osl_core.h @@ -8,7 +8,6 @@ #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, ...); @@ -324,8 +323,11 @@ _static_inline_ void update_cell_index(char *row_index, struct osl_column *col, _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; } @@ -398,13 +400,13 @@ _static_inline_ int next_rbtree_column(int col_num, const struct osl_table *t, * * \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); } /** @@ -469,7 +471,7 @@ _static_inline_ char *disk_storage_name_of_hash(const struct osl_table *t, HASH_ 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); } /**