Dead code removal

This commit is contained in:
shahramn 2024-10-12 17:06:11 +01:00
parent 60c1b88a7b
commit c71df54c8f
7 changed files with 20 additions and 21 deletions

View File

@ -141,7 +141,7 @@ void grib_accessor_expanded_descriptors_t::__expand(bufr_descriptors_array* unex
if (*err)
goto cleanup;
inner_unexpanded = grib_bufr_descriptors_array_new(c, DESC_SIZE_INIT, DESC_SIZE_INCR);
inner_unexpanded = grib_bufr_descriptors_array_new(DESC_SIZE_INIT, DESC_SIZE_INCR);
for (i = 0; i < size; i++) {
vv = grib_bufr_descriptor_new(tablesAccessor_, v_array[i], !SILENT, err);
inner_unexpanded = grib_bufr_descriptors_array_push(inner_unexpanded, vv);
@ -178,7 +178,7 @@ void grib_accessor_expanded_descriptors_t::__expand(bufr_descriptors_array* unex
grib_bufr_descriptors_array_push(expanded, u);
idx = expanded->n - 1;
size = 0;
inner_unexpanded = grib_bufr_descriptors_array_new(c, DESC_SIZE_INIT, DESC_SIZE_INCR);
inner_unexpanded = grib_bufr_descriptors_array_new(DESC_SIZE_INIT, DESC_SIZE_INCR);
/* Number of descriptors to replicate cannot be more than what's left */
if (us->X + 1 > unexpanded->n) {
@ -241,7 +241,7 @@ void grib_accessor_expanded_descriptors_t::__expand(bufr_descriptors_array* unex
printf("+++ pop %06ld [%s]\n", ur[j]->code, descriptor_type_name(ur[j]->type));
#endif
}
inner_unexpanded = grib_bufr_descriptors_array_new(c, DESC_SIZE_INIT, DESC_SIZE_INCR);
inner_unexpanded = grib_bufr_descriptors_array_new(DESC_SIZE_INIT, DESC_SIZE_INCR);
for (j = 0; j < us->X; j++) {
urc = grib_bufr_descriptor_clone(ur[j]);
grib_bufr_descriptors_array_push(inner_unexpanded, urc);
@ -404,13 +404,13 @@ cleanup:
bufr_descriptors_array* grib_accessor_expanded_descriptors_t::do_expand(bufr_descriptors_array* unexpanded, change_coding_params* ccp, int* err)
{
bufr_descriptors_array* expanded = NULL;
grib_context* c = context_;
#if MYDEBUG
int idepth;
global_depth++;
#endif
expanded = grib_bufr_descriptors_array_new(c, DESC_SIZE_INIT, DESC_SIZE_INCR);
expanded = grib_bufr_descriptors_array_new(DESC_SIZE_INIT, DESC_SIZE_INCR);
#if MYDEBUG
{
@ -533,8 +533,8 @@ int grib_accessor_expanded_descriptors_t::expand()
Assert(tablesAccessor_);
}
unexpanded = grib_bufr_descriptors_array_new(c, unexpandedSize, DESC_SIZE_INCR);
unexpanded_copy = grib_bufr_descriptors_array_new(c, unexpandedSize, DESC_SIZE_INCR);
unexpanded = grib_bufr_descriptors_array_new(unexpandedSize, DESC_SIZE_INCR);
unexpanded_copy = grib_bufr_descriptors_array_new(unexpandedSize, DESC_SIZE_INCR);
operator206yyy_width = 0;
for (i = 0; i < unexpandedSize; i++) {
bufr_descriptor *aDescriptor1, *aDescriptor2;

View File

@ -106,7 +106,7 @@ grib_concept_condition* grib_concept_condition_new(grib_context* c, const char*
void grib_concept_condition_delete(grib_context* c, grib_concept_condition* v);
/* grib_hash_array.cc */
grib_hash_array_value* grib_integer_hash_array_value_new(grib_context* c, const char* name, grib_iarray* array);
grib_hash_array_value* grib_integer_hash_array_value_new(const char* name, grib_iarray* array);
/* grib_bufr_descriptor.cc */
bufr_descriptor* grib_bufr_descriptor_new(grib_accessor* tables_accessor, int code, int silent, int* err);
@ -117,7 +117,7 @@ int grib_bufr_descriptor_can_be_missing(const bufr_descriptor* v);
void grib_bufr_descriptor_delete(bufr_descriptor* v);
/* grib_bufr_descriptors_array.cc */
bufr_descriptors_array* grib_bufr_descriptors_array_new(grib_context* c, size_t size, size_t incsize);
bufr_descriptors_array* grib_bufr_descriptors_array_new(size_t size, size_t incsize);
bufr_descriptor* grib_bufr_descriptors_array_pop_front(bufr_descriptors_array* a);
bufr_descriptors_array* grib_bufr_descriptors_array_push(bufr_descriptors_array* v, bufr_descriptor* val);
bufr_descriptors_array* grib_bufr_descriptors_array_append(bufr_descriptors_array* v, bufr_descriptors_array* ar);

View File

@ -13,12 +13,11 @@
#define DYN_ARRAY_SIZE_INIT 200 /* Initial size for grib_bufr_descriptors_array_new */
#define DYN_ARRAY_SIZE_INCR 400 /* Increment size for the above */
bufr_descriptors_array* grib_bufr_descriptors_array_new(grib_context* c, size_t size, size_t incsize)
bufr_descriptors_array* grib_bufr_descriptors_array_new(size_t size, size_t incsize)
{
bufr_descriptors_array* v = NULL;
if (!c)
c = grib_context_get_default();
grib_context* c = grib_context_get_default();
v = (bufr_descriptors_array*)grib_context_malloc(c, sizeof(bufr_descriptors_array));
if (!v) {
@ -100,7 +99,7 @@ bufr_descriptors_array* grib_bufr_descriptors_array_push(bufr_descriptors_array*
if (!v) {
size_t start_size = DYN_ARRAY_SIZE_INIT;
size_t start_incsize = DYN_ARRAY_SIZE_INCR;
v = grib_bufr_descriptors_array_new(0, start_size, start_incsize);
v = grib_bufr_descriptors_array_new(start_size, start_incsize);
}
if (v->n >= v->size - v->number_of_pop_front)
@ -119,7 +118,7 @@ bufr_descriptors_array* grib_bufr_descriptors_array_append(bufr_descriptors_arra
if (!v) {
size_t start_size = DYN_ARRAY_SIZE_INIT;
size_t start_incsize = DYN_ARRAY_SIZE_INCR;
v = grib_bufr_descriptors_array_new(0, start_size, start_incsize);
v = grib_bufr_descriptors_array_new(start_size, start_incsize);
}
for (i = 0; i < ar->n; i++) {
@ -139,7 +138,7 @@ bufr_descriptors_array* grib_bufr_descriptors_array_append(bufr_descriptors_arra
// if (!v) {
// size_t start_size = DYN_ARRAY_SIZE_INIT;
// size_t start_incsize = DYN_ARRAY_SIZE_INCR;
// v = grib_bufr_descriptors_array_new(0, start_size, start_incsize);
// v = grib_bufr_descriptors_array_new(start_size, start_incsize);
// }
// if (v->number_of_pop_front) {
// v->v--;

View File

@ -11,8 +11,9 @@
#include "grib_api_internal.h"
grib_hash_array_value* grib_integer_hash_array_value_new(grib_context* c, const char* name, grib_iarray* array)
grib_hash_array_value* grib_integer_hash_array_value_new(const char* name, grib_iarray* array)
{
grib_context* c = grib_context_get_default();
grib_hash_array_value* v = (grib_hash_array_value*)grib_context_malloc_clear_persistent(c, sizeof(grib_hash_array_value));
v->name = grib_context_strdup_persistent(c, name);

View File

@ -196,7 +196,6 @@ long* grib_iarray_get_array(grib_iarray* v)
{
long* vv;
size_t i;
DEBUG_ASSERT(c);
grib_context* c = grib_context_get_default();
vv = (long*)grib_context_malloc_clear(c, sizeof(long) * v->n);

View File

@ -3545,14 +3545,14 @@ grib_yyreduce:
case 214: /* hash_array_value: STRING '=' '[' integer_array ']' */
#line 772 "griby.y"
{
(grib_yyval.hash_array_value) = grib_integer_hash_array_value_new(grib_parser_context,(grib_yyvsp[-4].str),(grib_yyvsp[-1].ivalue)); free((grib_yyvsp[-4].str));}
(grib_yyval.hash_array_value) = grib_integer_hash_array_value_new((grib_yyvsp[-4].str),(grib_yyvsp[-1].ivalue)); free((grib_yyvsp[-4].str));}
#line 3550 "y.tab.c"
break;
case 215: /* hash_array_value: IDENT '=' '[' integer_array ']' */
#line 774 "griby.y"
{
(grib_yyval.hash_array_value) = grib_integer_hash_array_value_new(grib_parser_context,(grib_yyvsp[-4].str),(grib_yyvsp[-1].ivalue)); free((grib_yyvsp[-4].str));}
(grib_yyval.hash_array_value) = grib_integer_hash_array_value_new((grib_yyvsp[-4].str),(grib_yyvsp[-1].ivalue)); free((grib_yyvsp[-4].str));}
#line 3557 "y.tab.c"
break;

View File

@ -770,9 +770,9 @@ concept_condition: IDENT '=' expression ';' { $$ = grib_concept_condition_new(gr
hash_array_value: STRING '=' '[' integer_array ']' {
$$ = grib_integer_hash_array_value_new(grib_parser_context,$1,$4); free($1);}
$$ = grib_integer_hash_array_value_new($1,$4); free($1);}
| IDENT '=' '[' integer_array ']' {
$$ = grib_integer_hash_array_value_new(grib_parser_context,$1,$4); free($1);}
$$ = grib_integer_hash_array_value_new($1,$4); free($1);}
;
string_or_ident: SUBSTR '(' IDENT ',' INTEGER ',' INTEGER ')' { $$ = new_accessor_expression(grib_parser_context,$3,$5,$7); free($3); }