Dead code removal

This commit is contained in:
shahramn 2024-10-12 16:06:41 +01:00
parent eadb6dd661
commit 6276da63a7
12 changed files with 108 additions and 115 deletions

View File

@ -261,12 +261,12 @@ void grib_accessor_bufr_data_array_t::self_clear()
if (stringValues_) {
/*printf("dbg self_clear: clear %p\n", (void*)(stringValues_ ));*/
grib_vsarray_delete_content(context_, stringValues_);
grib_vsarray_delete(context_, stringValues_);
grib_vsarray_delete_content(stringValues_);
grib_vsarray_delete(stringValues_);
stringValues_ = NULL;
}
grib_viarray_delete_content(context_, elementsDescriptorsIndex_);
grib_viarray_delete(context_, elementsDescriptorsIndex_);
grib_viarray_delete_content(elementsDescriptorsIndex_);
grib_viarray_delete(elementsDescriptorsIndex_);
if (inputReplications_)
grib_context_free(context_, inputReplications_);
if (inputExtendedReplications_)
@ -369,7 +369,7 @@ int grib_accessor_bufr_data_array_t::decode_string_array(grib_context* c, unsign
int* err = &ret;
char* sval = 0;
int j, modifiedWidth, width;
grib_sarray* sa = grib_sarray_new(c, numberOfSubsets_, 10);
grib_sarray* sa = grib_sarray_new(numberOfSubsets_, 10);
int bufr_multi_element_constant_arrays = c->bufr_multi_element_constant_arrays;
modifiedWidth = bd->width;
@ -378,30 +378,30 @@ int grib_accessor_bufr_data_array_t::decode_string_array(grib_context* c, unsign
CHECK_END_DATA_RETURN(c, bd, this, modifiedWidth, *err);
if (*err) {
grib_sarray_push(c, sa, sval);
grib_vsarray_push(c, stringValues_, sa);
grib_sarray_push(sa, sval);
grib_vsarray_push(stringValues_, sa);
return ret;
}
grib_decode_string(data, pos, modifiedWidth / 8, sval);
CHECK_END_DATA_RETURN(c, bd, this, 6, *err);
if (*err) {
grib_sarray_push(c, sa, sval);
grib_vsarray_push(c, stringValues_, sa);
grib_sarray_push(sa, sval);
grib_vsarray_push(stringValues_, sa);
return ret;
}
width = grib_decode_unsigned_long(data, pos, 6);
if (width) {
CHECK_END_DATA_RETURN(c, bd, this, width * 8 * numberOfSubsets_, *err);
if (*err) {
grib_sarray_push(c, sa, sval);
grib_vsarray_push(c, stringValues_, sa);
grib_sarray_push(sa, sval);
grib_vsarray_push(stringValues_, sa);
return ret;
}
grib_context_free(c, sval);
for (j = 0; j < numberOfSubsets_; j++) {
sval = (char*)grib_context_malloc_clear(c, width + 1);
grib_decode_string(data, pos, width, sval);
grib_sarray_push(c, sa, sval);
grib_sarray_push(sa, sval);
}
}
else {
@ -410,14 +410,14 @@ int grib_accessor_bufr_data_array_t::decode_string_array(grib_context* c, unsign
char* pStr = sval;
if (j > 0)
pStr = strdup(sval);
grib_sarray_push(c, sa, pStr);
grib_sarray_push(sa, pStr);
}
}
else {
grib_sarray_push(c, sa, sval);
grib_sarray_push(sa, sval);
}
}
grib_vsarray_push(c, stringValues_, sa);
grib_vsarray_push(stringValues_, sa);
return ret;
}
@ -965,8 +965,8 @@ int decode_element(grib_context* c, grib_accessor_bufr_data_array_t* self, int s
else {
csval = self->decode_string_value(c, data, pos, bd, &err);
grib_context_log(c, GRIB_LOG_DEBUG, "BUFR data decoding: \t %s = %s", bd->shortName, csval);
sar = grib_sarray_push(c, sar, csval);
grib_vsarray_push(c, self->stringValues_, sar);
sar = grib_sarray_push(sar, csval);
grib_vsarray_push(self->stringValues_, sar);
stringValuesLen = grib_vsarray_used_size(self->stringValues_);
index = 0;
for (ii = 0; ii < stringValuesLen; ii++) {
@ -1160,11 +1160,11 @@ int encode_new_element(grib_context* c, grib_accessor_bufr_data_array_t* self, i
grib_context_log(c, GRIB_LOG_DEBUG, "BUFR data encoding: \t %s = %s",
bd->shortName, csval);
if (self->compressedData_) {
grib_sarray* stringValues = grib_sarray_new(c, 1, 1);
grib_sarray_push(c, stringValues, csval);
grib_sarray* stringValues = grib_sarray_new(1, 1);
grib_sarray_push(stringValues, csval);
err = self->encode_string_array(c, buff, pos, bd, stringValues);
grib_sarray_delete_content(c, stringValues);
grib_sarray_delete(c, stringValues);
grib_sarray_delete_content(stringValues);
grib_sarray_delete(stringValues);
}
else {
err = encode_string_value(c, buff, pos, bd, csval);
@ -1820,7 +1820,7 @@ grib_accessor* grib_accessor_bufr_data_array_t::create_accessor_from_descriptor(
creator.name = grib_context_strdup(context_, expanded_->v[idx]->shortName);
/* ECC-325: store alloc'd string (due to strdup) for clean up later */
grib_sarray_push(context_, tempStrings_, creator.name);
grib_sarray_push(tempStrings_, creator.name);
accessor = grib_accessor_factory(section, &creator, 0, NULL);
if (canBeMissing_[idx])
accessor->flags_ |= GRIB_ACCESSOR_FLAG_CAN_BE_MISSING;
@ -1859,7 +1859,7 @@ grib_accessor* grib_accessor_bufr_data_array_t::create_accessor_from_descriptor(
attribute = create_attribute_variable("code", section, GRIB_TYPE_STRING, temp_str, 0, 0, flags);
if (!attribute)
return NULL;
grib_sarray_push(context_, tempStrings_, temp_str); /* ECC-325: store alloc'd string (due to strdup) for clean up later */
grib_sarray_push(tempStrings_, temp_str); /* ECC-325: store alloc'd string (due to strdup) for clean up later */
accessor->add_attribute(attribute, 0);
if (add_extra_attributes) {
@ -2319,11 +2319,11 @@ int grib_accessor_bufr_data_array_t::create_keys(long onlySubset, long startSubs
dataAccessorsTrie_ = grib_trie_with_rank_new(c);
if (tempStrings_) {
grib_sarray_delete_content(c, tempStrings_);
grib_sarray_delete(c, tempStrings_);
grib_sarray_delete_content(tempStrings_);
grib_sarray_delete(tempStrings_);
tempStrings_ = NULL;
}
tempStrings_ = numberOfSubsets_ ? grib_sarray_new(c, numberOfSubsets_, 500) : NULL;
tempStrings_ = numberOfSubsets_ ? grib_sarray_new(numberOfSubsets_, 500) : NULL;
end = compressedData_ ? 1 : numberOfSubsets_;
// groupNumber = 1;
@ -2531,7 +2531,7 @@ int grib_accessor_bufr_data_array_t::create_keys(long onlySubset, long startSubs
grib_accessor* newAccessor = elementAccessor->clone(section, &err);
newAccessor->parent_ = groupSection;
newAccessor->name_ = aname;
grib_sarray_push(context_, tempStrings_, aname);
grib_sarray_push(tempStrings_, aname);
grib_push_accessor(newAccessor, groupSection->block);
rank = grib_data_accessors_trie_push(dataAccessorsTrie_, newAccessor);
dataAccessors_->push(newAccessor, rank);
@ -2780,20 +2780,20 @@ int grib_accessor_bufr_data_array_t::process_elements(int flag, long onlySubset,
grib_vdarray_delete_content(numericValues_);
grib_vdarray_delete(numericValues_);
/*printf("dbg process_elements: clear %p\n", (void*)(stringValues_ ));*/
grib_vsarray_delete_content(c, stringValues_);
grib_vsarray_delete(c, stringValues_);
grib_vsarray_delete_content(stringValues_);
grib_vsarray_delete(stringValues_);
stringValues_ = NULL;
}
if (flag != PROCESS_ENCODE) {
numericValues_ = grib_vdarray_new(1000, 1000);
stringValues_ = grib_vsarray_new(c, 10, 10);
stringValues_ = grib_vsarray_new(10, 10);
if (elementsDescriptorsIndex_) {
grib_viarray_delete_content(c, elementsDescriptorsIndex_);
grib_viarray_delete(c, elementsDescriptorsIndex_);
grib_viarray_delete_content(elementsDescriptorsIndex_);
grib_viarray_delete(elementsDescriptorsIndex_);
}
elementsDescriptorsIndex_ = grib_viarray_new(c, 100, 100);
elementsDescriptorsIndex_ = grib_viarray_new(100, 100);
}
if (flag == PROCESS_NEW_DATA) {
tempDoubleValues_ = grib_vdarray_new(1000, 1000);
@ -3196,7 +3196,7 @@ int grib_accessor_bufr_data_array_t::process_elements(int flag, long onlySubset,
} /* for all descriptors */
if (flag != PROCESS_ENCODE) {
grib_viarray_push(c, elementsDescriptorsIndex_, elementsDescriptorsIndex);
grib_viarray_push(elementsDescriptorsIndex_, elementsDescriptorsIndex);
/*grib_iarray_print("DBG process_elements::elementsDescriptorsIndex", elementsDescriptorsIndex);*/
}
if (decoding && !compressedData_) {
@ -3324,8 +3324,8 @@ void grib_accessor_bufr_data_array_t::destroy(grib_context* c)
dataAccessorsTrie_ = NULL;
}
if (tempStrings_) {
grib_sarray_delete_content(c, tempStrings_);
grib_sarray_delete(c, tempStrings_);
grib_sarray_delete_content(tempStrings_);
grib_sarray_delete(tempStrings_);
}
if (tempDoubleValues_) {
/* ECC-1172: Clean up to avoid memory leaks */

View File

@ -137,12 +137,12 @@ int grib_accessor_bufr_data_element_t::pack_string_array(const char** v, size_t*
descriptors_->v[elementsDescriptorsIndex_->v[0]->v[idx]]->shortName, *len, numberOfSubsets_);
return GRIB_ARRAY_TOO_SMALL;
}
grib_sarray_delete_content(c, stringValues_->v[idx]); /* ECC-1172 */
grib_sarray_delete(c, stringValues_->v[idx]);
stringValues_->v[idx] = grib_sarray_new(c, *len, 1);
grib_sarray_delete_content(stringValues_->v[idx]); /* ECC-1172 */
grib_sarray_delete(stringValues_->v[idx]);
stringValues_->v[idx] = grib_sarray_new(*len, 1);
for (i = 0; i < *len; i++) {
s = grib_context_strdup(c, v[i]);
grib_sarray_push(c, stringValues_->v[idx], s);
grib_sarray_push(stringValues_->v[idx], s);
}
}
else {
@ -246,11 +246,11 @@ int grib_accessor_bufr_data_element_t::pack_string(const char* val, size_t* len)
else {
idx = (int)numericValues_->v[subsetNumber_]->v[index_] / 1000 - 1;
}
grib_sarray_delete_content(c, stringValues_->v[idx]); /* ECC-1172 */
grib_sarray_delete(c, stringValues_->v[idx]);
stringValues_->v[idx] = grib_sarray_new(c, 1, 1);
grib_sarray_delete_content(stringValues_->v[idx]); /* ECC-1172 */
grib_sarray_delete(stringValues_->v[idx]);
stringValues_->v[idx] = grib_sarray_new(1, 1);
s = grib_context_strdup(c, val);
grib_sarray_push(c, stringValues_->v[idx], s);
grib_sarray_push(stringValues_->v[idx], s);
return ret;
}

View File

@ -363,12 +363,12 @@ static int grib_concept_apply(grib_accessor* a, const char* name)
return err;
}
e = c->conditions;
sa = grib_sarray_new(h->context, 10, 10);
sa = grib_sarray_new(10, 10);
while (e) {
concept_conditions_apply(h, e, values, sa, &count);
e = e->next;
}
grib_sarray_delete(h->context, sa);
grib_sarray_delete(sa);
if (count)
err = grib_set_values(h, values, count);

View File

@ -113,7 +113,7 @@ static void destroy(grib_context* context, grib_action* act)
grib_action_set_sarray* a = (grib_action_set_sarray*)act;
grib_context_free_persistent(context, a->name);
grib_sarray_delete(context, a->sarray);
grib_sarray_delete(a->sarray);
grib_context_free_persistent(context, act->name);
grib_context_free_persistent(context, act->op);
}

View File

@ -73,7 +73,7 @@ char** codes_bufr_copy_data_return_copied_keys(grib_handle* hin, grib_handle* ho
kiter = codes_bufr_data_section_keys_iterator_new(hin);
if (!kiter)
return NULL;
k = grib_sarray_new(hin->context, 50, 10);
k = grib_sarray_new(50, 10);
while (codes_bufr_keys_iterator_next(kiter)) {
char* name = codes_bufr_keys_iterator_get_name(kiter);
@ -85,12 +85,12 @@ char** codes_bufr_copy_data_return_copied_keys(grib_handle* hin, grib_handle* ho
if (*err == 0) {
// 'name' will be freed when we call codes_bufr_keys_iterator_delete so copy
char* copied_name = strdup(name);
k = grib_sarray_push(hin->context, k, copied_name);
k = grib_sarray_push(k, copied_name);
}
}
*nkeys = grib_sarray_used_size(k);
keys = grib_sarray_get_array(hin->context, k);
grib_sarray_delete(hin->context, k);
keys = grib_sarray_get_array(k);
grib_sarray_delete(k);
if (*nkeys > 0) {
// Do the pack if something was copied
*err = grib_set_long(hout, "pack", 1);

View File

@ -136,11 +136,11 @@ size_t grib_darray_used_size(grib_darray* v);
/* grib_sarray.cc */
void grib_sarray_print(const char* title, const grib_sarray* sarray);
grib_sarray* grib_sarray_new(grib_context* c, size_t size, size_t incsize);
grib_sarray* grib_sarray_push(grib_context* c, grib_sarray* v, char* val);
void grib_sarray_delete(grib_context* c, grib_sarray* v);
void grib_sarray_delete_content(grib_context* c, grib_sarray* v);
char** grib_sarray_get_array(grib_context* c, grib_sarray* v);
grib_sarray* grib_sarray_new(size_t size, size_t incsize);
grib_sarray* grib_sarray_push(grib_sarray* v, char* val);
void grib_sarray_delete(grib_sarray* v);
void grib_sarray_delete_content(grib_sarray* v);
char** grib_sarray_get_array(grib_sarray* v);
size_t grib_sarray_used_size(grib_sarray* v);
/* grib_oarray.cc */
@ -170,18 +170,18 @@ size_t grib_vdarray_used_size(grib_vdarray* v);
/* grib_vsarray.cc */
void grib_vsarray_print(const char* title, const grib_vsarray* vdarray);
grib_vsarray* grib_vsarray_new(grib_context* c, size_t size, size_t incsize);
grib_vsarray* grib_vsarray_push(grib_context* c, grib_vsarray* v, grib_sarray* val);
void grib_vsarray_delete(grib_context* c, grib_vsarray* v);
void grib_vsarray_delete_content(grib_context* c, grib_vsarray* v);
grib_vsarray* grib_vsarray_new(size_t size, size_t incsize);
grib_vsarray* grib_vsarray_push(grib_vsarray* v, grib_sarray* val);
void grib_vsarray_delete(grib_vsarray* v);
void grib_vsarray_delete_content(grib_vsarray* v);
size_t grib_vsarray_used_size(grib_vsarray* v);
/* grib_viarray.cc */
void grib_viarray_print(const char* title, const grib_viarray* viarray);
grib_viarray* grib_viarray_new(grib_context* c, size_t size, size_t incsize);
grib_viarray* grib_viarray_push(grib_context* c, grib_viarray* v, grib_iarray* val);
void grib_viarray_delete(grib_context* c, grib_viarray* v);
void grib_viarray_delete_content(grib_context* c, grib_viarray* v);
grib_viarray* grib_viarray_new(size_t size, size_t incsize);
grib_viarray* grib_viarray_push(grib_viarray* v, grib_iarray* val);
void grib_viarray_delete(grib_viarray* v);
void grib_viarray_delete_content(grib_viarray* v);
/* grib_accessor_class_ascii.cc*/

View File

@ -22,11 +22,10 @@ void grib_sarray_print(const char* title, const grib_sarray* sarray)
printf("\n");
}
grib_sarray* grib_sarray_new(grib_context* c, size_t size, size_t incsize)
grib_sarray* grib_sarray_new(size_t size, size_t incsize)
{
grib_sarray* v = NULL;
if (!c)
c = grib_context_get_default();
grib_context* c = grib_context_get_default();
v = (grib_sarray*)grib_context_malloc_clear(c, sizeof(grib_sarray));
if (!v) {
grib_context_log(c, GRIB_LOG_ERROR,
@ -63,12 +62,12 @@ static grib_sarray* grib_sarray_resize(grib_sarray* v)
return v;
}
grib_sarray* grib_sarray_push(grib_context* c, grib_sarray* v, char* val)
grib_sarray* grib_sarray_push(grib_sarray* v, char* val)
{
size_t start_size = 100;
size_t start_incsize = 100;
if (!v)
v = grib_sarray_new(c, start_size, start_incsize);
v = grib_sarray_new(start_size, start_incsize);
if (v->n >= v->size)
v = grib_sarray_resize(v);
@ -77,24 +76,22 @@ grib_sarray* grib_sarray_push(grib_context* c, grib_sarray* v, char* val)
return v;
}
void grib_sarray_delete(grib_context* c, grib_sarray* v)
void grib_sarray_delete(grib_sarray* v)
{
if (!v)
return;
if (!c)
c = grib_context_get_default();
grib_context* c = grib_context_get_default();
if (v->v)
grib_context_free(c, v->v);
grib_context_free(c, v);
}
void grib_sarray_delete_content(grib_context* c, grib_sarray* v)
void grib_sarray_delete_content(grib_sarray* v)
{
size_t i = 0;
if (!v || !v->v)
return;
if (!c)
c = grib_context_get_default();
grib_context* c = grib_context_get_default();
for (i = 0; i < v->n; i++) {
if (v->v[i]) {
/*printf("grib_sarray_delete_content: %s %p\n", v->v[i], (void*)v->v[i]);*/
@ -105,12 +102,13 @@ void grib_sarray_delete_content(grib_context* c, grib_sarray* v)
v->n = 0;
}
char** grib_sarray_get_array(grib_context* c, grib_sarray* v)
char** grib_sarray_get_array(grib_sarray* v)
{
char** ret = NULL;
size_t i = 0;
if (!v)
return NULL;
grib_context* c = grib_context_get_default();
ret = (char**)grib_context_malloc_clear(c, sizeof(char*) * v->n);
for (i = 0; i < v->n; i++)
ret[i] = v->v[i];

View File

@ -25,11 +25,10 @@ void grib_viarray_print(const char* title, const grib_viarray* viarray)
printf("\n");
}
grib_viarray* grib_viarray_new(grib_context* c, size_t size, size_t incsize)
grib_viarray* grib_viarray_new(size_t size, size_t incsize)
{
grib_viarray* v = NULL;
if (!c)
c = grib_context_get_default();
grib_context* c = grib_context_get_default();
v = (grib_viarray*)grib_context_malloc_clear(c, sizeof(grib_viarray));
if (!v) {
grib_context_log(c, GRIB_LOG_ERROR,
@ -66,12 +65,12 @@ static grib_viarray* grib_viarray_resize(grib_viarray* v)
return v;
}
grib_viarray* grib_viarray_push(grib_context* c, grib_viarray* v, grib_iarray* val)
grib_viarray* grib_viarray_push(grib_viarray* v, grib_iarray* val)
{
size_t start_size = 100;
size_t start_incsize = 100;
if (!v)
v = grib_viarray_new(c, start_size, start_incsize);
v = grib_viarray_new(start_size, start_incsize);
if (v->n >= v->size)
v = grib_viarray_resize(v);
@ -80,18 +79,17 @@ grib_viarray* grib_viarray_push(grib_context* c, grib_viarray* v, grib_iarray* v
return v;
}
void grib_viarray_delete(grib_context* c, grib_viarray* v)
void grib_viarray_delete(grib_viarray* v)
{
if (!v)
return;
if (!c)
c = grib_context_get_default();
grib_context* c = grib_context_get_default();
if (v->v)
grib_context_free(c, v->v);
grib_context_free(c, v);
}
void grib_viarray_delete_content(grib_context* c, grib_viarray* v)
void grib_viarray_delete_content(grib_viarray* v)
{
size_t i=0;
if (!v || !v->v)

View File

@ -27,11 +27,11 @@ void grib_vsarray_print(const char* title, const grib_vsarray* vsarray)
printf("\n");
}
grib_vsarray* grib_vsarray_new(grib_context* c, size_t size, size_t incsize)
grib_vsarray* grib_vsarray_new(size_t size, size_t incsize)
{
grib_vsarray* v = NULL;
if (!c)
c = grib_context_get_default();
grib_context* c = grib_context_get_default();
v = (grib_vsarray*)grib_context_malloc_clear(c, sizeof(grib_vsarray));
if (!v) {
grib_context_log(c, GRIB_LOG_ERROR,
@ -68,12 +68,12 @@ static grib_vsarray* grib_vsarray_resize(grib_vsarray* v)
return v;
}
grib_vsarray* grib_vsarray_push(grib_context* c, grib_vsarray* v, grib_sarray* val)
grib_vsarray* grib_vsarray_push(grib_vsarray* v, grib_sarray* val)
{
size_t start_size = 100;
size_t start_incsize = 100;
if (!v)
v = grib_vsarray_new(c, start_size, start_incsize);
v = grib_vsarray_new(start_size, start_incsize);
if (v->n >= v->size)
v = grib_vsarray_resize(v);
@ -82,27 +82,24 @@ grib_vsarray* grib_vsarray_push(grib_context* c, grib_vsarray* v, grib_sarray* v
return v;
}
void grib_vsarray_delete(grib_context* c, grib_vsarray* v)
void grib_vsarray_delete(grib_vsarray* v)
{
if (!v)
return;
if (!c)
c = grib_context_get_default();
grib_context* c = grib_context_get_default();
if (v->v)
grib_context_free(c, v->v);
grib_context_free(c, v);
}
void grib_vsarray_delete_content(grib_context* c, grib_vsarray* v)
void grib_vsarray_delete_content(grib_vsarray* v)
{
size_t i = 0;
if (!v || !v->v)
return;
if (!c)
c = grib_context_get_default();
for (i = 0; i < v->n; i++) {
grib_sarray_delete_content(c, v->v[i]);
grib_sarray_delete(c, v->v[i]);
grib_sarray_delete_content(v->v[i]);
grib_sarray_delete(v->v[i]);
v->v[i] = 0;
}
v->n = 0;

View File

@ -2411,13 +2411,13 @@ grib_yyreduce:
case 13: /* svalues: STRING */
#line 283 "griby.y"
{ (grib_yyval.svalue)=grib_sarray_push(grib_parser_context,0,(grib_yyvsp[0].str));}
{ (grib_yyval.svalue)=grib_sarray_push(0,(grib_yyvsp[0].str));}
#line 2416 "y.tab.c"
break;
case 14: /* svalues: svalues ',' STRING */
#line 284 "griby.y"
{ (grib_yyval.svalue)=grib_sarray_push(grib_parser_context,(grib_yyvsp[-2].svalue),(grib_yyvsp[0].str));}
{ (grib_yyval.svalue)=grib_sarray_push((grib_yyvsp[-2].svalue),(grib_yyvsp[0].str));}
#line 2422 "y.tab.c"
break;

View File

@ -280,8 +280,8 @@ dvalues: FLOAT { $$=grib_darray_push(0,$1);}
| dvalues ',' INTEGER { $$=grib_darray_push($1,$3);}
;
svalues: STRING { $$=grib_sarray_push(grib_parser_context,0,$1);}
| svalues ',' STRING { $$=grib_sarray_push(grib_parser_context,$1,$3);}
svalues: STRING { $$=grib_sarray_push(0,$1);}
| svalues ',' STRING { $$=grib_sarray_push($1,$3);}
;

View File

@ -611,7 +611,7 @@ void test_scale_factor_scaled_values()
void test_iarray()
{
printf("Running %s ...\n", __func__);
grib_context* c = grib_context_get_default();
grib_iarray* a = grib_iarray_new(10, 10);
grib_iarray_push(a, 42);
grib_iarray_push(a, 10000);
@ -622,14 +622,14 @@ void test_iarray()
grib_iarray_push(b, -1);
grib_iarray_push(b, +1);
grib_viarray* va = grib_viarray_new(c, 1, 1);
grib_viarray_push(c, va, a);
grib_viarray_push(c, va, b);
grib_viarray* va = grib_viarray_new(1, 1);
grib_viarray_push(va, a);
grib_viarray_push(va, b);
grib_viarray_print("viarray", va);
grib_iarray_delete(a);
grib_iarray_delete(b);
grib_viarray_delete(c, va);
grib_viarray_delete(va);
}
void test_darray()
@ -659,21 +659,21 @@ void test_darray()
void test_sarray()
{
printf("Running %s ...\n", __func__);
grib_context* c = grib_context_get_default();
grib_sarray* a = grib_sarray_new(c, 10, 10);
grib_sarray* a = grib_sarray_new(10, 10);
char ants_s[] = "ants";
char bugs_s[] = "bugs";
grib_sarray_push(c, a, ants_s);
grib_sarray_push(c, a, bugs_s);
grib_sarray_push(a, ants_s);
grib_sarray_push(a, bugs_s);
grib_sarray_print("sarray", a);
grib_vsarray* va = grib_vsarray_new(c, 1, 1);
grib_vsarray_push(c, va, a);
grib_vsarray* va = grib_vsarray_new(1, 1);
grib_vsarray_push(va, a);
grib_vsarray_print("vsarray", va);
grib_sarray_delete(c, a);
grib_vsarray_delete(c, va);
grib_sarray_delete(a);
grib_vsarray_delete(va);
}
void test_codes_get_product_name()