Error messages

This commit is contained in:
shahramn 2024-02-24 22:07:55 +00:00
parent 18edad5b52
commit e7e8e5f9a2
4 changed files with 44 additions and 48 deletions

View File

@ -169,7 +169,7 @@ static int unpack_string_array(grib_accessor* a, char** buffer, size_t* len)
tableAccessor = (grib_accessor_smart_table*)grib_find_accessor(grib_handle_of_accessor(a), self->smartTable);
if (!tableAccessor) {
grib_context_log(a->context, GRIB_LOG_ERROR,
"unable to find accessor %s", self->smartTable);
"Unable to find accessor %s", self->smartTable);
return GRIB_NOT_FOUND;
}
@ -226,7 +226,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
tableAccessor = (grib_accessor_smart_table*)grib_find_accessor(grib_handle_of_accessor(a), self->smartTable);
if (!tableAccessor) {
grib_context_log(a->context, GRIB_LOG_ERROR,
"unable to find accessor %s", self->smartTable);
"Unable to find accessor %s", self->smartTable);
return GRIB_NOT_FOUND;
}

View File

@ -17,8 +17,6 @@ grib_oarray* grib_oarray_new(grib_context* c, size_t size, size_t incsize)
c = grib_context_get_default();
v = (grib_oarray*)grib_context_malloc_clear(c, sizeof(grib_oarray));
if (!v) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_oarray_new unable to allocate %zu bytes", sizeof(grib_oarray));
return NULL;
}
v->size = size;
@ -27,8 +25,7 @@ grib_oarray* grib_oarray_new(grib_context* c, size_t size, size_t incsize)
v->v = (void**)grib_context_malloc_clear(c, sizeof(char*) * size);
v->context = c;
if (!v->v) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_oarray_new unable to allocate %zu bytes", sizeof(char*) * size);
grib_context_log(c, GRIB_LOG_ERROR, "%s: Unable to allocate %zu bytes", __func__, sizeof(char*) * size);
return NULL;
}
return v;
@ -44,8 +41,7 @@ static grib_oarray* grib_oarray_resize(grib_oarray* v)
v->v = (void**)grib_context_realloc(c, v->v, newsize * sizeof(char*));
v->size = newsize;
if (!v->v) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_oarray_resize unable to allocate %zu bytes", sizeof(char*) * newsize);
grib_context_log(c, GRIB_LOG_ERROR, "%s: Unable to allocate %zu bytes", __func__, sizeof(char*) * newsize);
return NULL;
}
return v;

View File

@ -30,7 +30,7 @@ grib_sarray* grib_sarray_new(grib_context* c, size_t size, size_t incsize)
v = (grib_sarray*)grib_context_malloc_clear(c, sizeof(grib_sarray));
if (!v) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_sarray_new unable to allocate %lu bytes\n", sizeof(grib_sarray));
"%s: Unable to allocate %zu bytes", __func__, sizeof(grib_sarray));
return NULL;
}
v->size = size;
@ -40,7 +40,7 @@ grib_sarray* grib_sarray_new(grib_context* c, size_t size, size_t incsize)
v->v = (char**)grib_context_malloc_clear(c, sizeof(char*) * size);
if (!v->v) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_sarray_new unable to allocate %lu bytes\n", sizeof(char*) * size);
"%s: Unable to allocate %zu bytes", __func__, sizeof(char*) * size);
return NULL;
}
return v;
@ -57,7 +57,7 @@ static grib_sarray* grib_sarray_resize(grib_sarray* v)
v->size = newsize;
if (!v->v) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_sarray_resize unable to allocate %lu bytes\n", sizeof(char*) * newsize);
"%s: Unable to allocate %zu bytes", __func__, sizeof(char*) * newsize);
return NULL;
}
return v;