Debugging: grib_vdarray print

This commit is contained in:
Shahram Najm 2018-04-12 12:36:39 +01:00
parent b136510fa1
commit fe4b23e135
2 changed files with 15 additions and 0 deletions

View File

@ -245,6 +245,7 @@ size_t grib_iarray_used_size(grib_iarray *v);
int grib_iarray_is_constant(grib_iarray *v);
/* grib_vdarray.c */
void grib_vdarray_print(const char* title, const grib_vdarray* vdarray);
grib_vdarray *grib_vdarray_new(grib_context *c, size_t size, size_t incsize);
grib_vdarray *grib_vdarray_resize(grib_context *c, grib_vdarray *v);
grib_vdarray *grib_vdarray_push(grib_context *c, grib_vdarray *v, grib_darray *val);

View File

@ -16,6 +16,20 @@
#include "grib_api_internal.h"
/* For debugging purposes */
void grib_vdarray_print(const char* title, const grib_vdarray* vdarray)
{
size_t i;
char text[100]={0,};
Assert(vdarray);
printf("%s: vdarray.n=%lu\n", title, (unsigned long)vdarray->n);
for (i=0; i<vdarray->n; i++) {
sprintf(text, " vdarray->v[%ld]", i);
grib_darray_print(text, vdarray->v[i]);
}
printf("\n");
}
grib_vdarray* grib_vdarray_new(grib_context* c,size_t size,size_t incsize)
{
grib_vdarray* v=NULL;