Dead code removal

This commit is contained in:
Shahram Najm 2023-06-22 11:21:39 +01:00
parent b57b79af78
commit 713e64eb4a
5 changed files with 30 additions and 70 deletions

View File

@ -882,18 +882,3 @@ void grib_accessors_list_delete(grib_context* c, grib_accessors_list* al)
al = tmp;
}
}
#if 0
void grib_print_accessor_flags(const grib_accessor* acc)
{
const unsigned long f = acc->flags;
if (f & GRIB_ACCESSOR_FLAG_READ_ONLY) printf("READ_ONLY ");
if (f & GRIB_ACCESSOR_FLAG_DUMP) printf("DUMP ");
if (f & GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC) printf("EDITION_SPECIFIC ");
if (f & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) printf("CAN_BE_MISSING ");
if (f & GRIB_ACCESSOR_FLAG_LOWERCASE) printf("LOWERCASE ");
if (f & GRIB_ACCESSOR_FLAG_HIDDEN) printf("HIDDEN ");
/* TODO: the rest */
}
#endif

View File

@ -2322,11 +2322,9 @@ static int is_bitmap_start_descriptor(grib_accessors_list* al, int* err)
case 237000:
/*case 243000:*/
{
#if 0
long index[1];
grib_accessor* anindex=grib_accessor_get_attribute(al->accessor,"index");
grib_unpack_long(anindex,index,&l);
#endif
//long index[1];
//grib_accessor* anindex=grib_accessor_get_attribute(al->accessor,"index");
//grib_unpack_long(anindex,index,&l);
return 1;
}
}
@ -2412,20 +2410,19 @@ static grib_accessor* accessor_or_attribute_with_same_name(grib_accessor* a, con
return ok;
}
}
#if 0
static int get_key_rank(grib_trie* accessorsRank,grib_accessor* a)
{
int* r=(int*)grib_trie_get(accessorsRank,a->name);
if (r) (*r)++;
else {
r=(int*)grib_context_malloc(a->context,sizeof(int));
*r=1;
grib_trie_insert(accessorsRank,a->name,(void*)r);
}
return *r;
}
#endif
// static int get_key_rank(grib_trie* accessorsRank,grib_accessor* a)
// {
// int* r=(int*)grib_trie_get(accessorsRank,a->name);
// if (r) (*r)++;
// else {
// r=(int*)grib_context_malloc(a->context,sizeof(int));
// *r=1;
// grib_trie_insert(accessorsRank,a->name,(void*)r);
// }
// return *r;
// }
static int grib_data_accessors_trie_push(grib_trie_with_rank* accessorsTrie, grib_accessor* a)
{
return grib_trie_with_rank_insert(accessorsTrie, a->name, a);

View File

@ -110,7 +110,6 @@ grib_accessor_class* grib_accessor_class_g1_section4_length = &_grib_accessor_cl
/* END_CLASS_IMP */
static void init(grib_accessor* a, const long len, grib_arguments* args)
{
grib_accessor_g1_section4_length* self = (grib_accessor_g1_section4_length*)a;
@ -119,36 +118,31 @@ static void init(grib_accessor* a, const long len, grib_arguments* args)
static int pack_long(grib_accessor* a, const long* val, size_t* len)
{
#if 0
grib_accessor_class* super = *(a->cclass->super);
// Old implementation:
// Here we assume that the totalLength will be coded AFTER the section4 length, and
// the section4 length will be overwritten by the totalLength accessor for large GRIBs
// grib_accessor_class* super = *(a->cclass->super);
// return super->pack_long(a,val,len);
/* Here we assume that the totalLength will be coded AFTER the section4 length, and
the section4 length will be overwritten by the totalLength accessor for large GRIBs */
/*printf("UPDATING sec4len %ld\n",*val);*/
return super->pack_long(a,val,len);
#endif
/* Do not directly call pack_long on base class */
/* because in this special case we want to skip the checks. */
/* So we call the helper function which has an extra argument */
// Note: Do not directly call pack_long on base class
// because in this special case we want to skip the checks.
// So we call the helper function which has an extra argument
return pack_long_unsigned_helper(a, val, len, /*check=*/0);
}
static int unpack_long(grib_accessor* a, long* val, size_t* len)
{
grib_accessor_g1_section4_length* self = (grib_accessor_g1_section4_length*)a;
int ret;
long total_length, sec4_length;
int ret = 0;
long total_length = 0, sec4_length = 0;
if ((ret = grib_get_g1_message_size(grib_handle_of_accessor(a),
grib_find_accessor(grib_handle_of_accessor(a), self->total_length),
a,
&total_length,
&sec4_length)) != GRIB_SUCCESS)
&sec4_length)) != GRIB_SUCCESS) {
return ret;
}
*val = sec4_length;

View File

@ -12,7 +12,6 @@
* Enrico Fucile
**************************************/
#include "grib_api_internal.h"
/*
This is used by make_class.pl
@ -124,11 +123,9 @@ static size_t preferred_size(grib_accessor* a, int from_handle)
grib_get_long_internal(grib_handle_of_accessor(a), self->section_length, &length);
if ((length % 2) && from_handle) {
#if 0
grib_context_log(a->context,
GRIB_LOG_ERROR,"GRIB message has an odd length section (%ld, %s)",
(long)length,a->name);
#endif
// grib_context_log(a->context,
// GRIB_LOG_ERROR,"GRIB message has an odd length section (%ld, %s)",
// (long)length,a->name);
return 0;
}

View File

@ -18,19 +18,6 @@ grib_rule_entry* grib_new_rule_entry(grib_context* c, const char* name, grib_exp
return e;
}
#if 0
/* GCC compiler complains function is defined but not used*/
static void grib_rule_entry_delete(grib_context* c,grib_rule_entry* e)
{
if(e) {
grib_context_free_persistent(c,e->name);
grib_rule_entry_delete(c,e->next);
grib_context_free_persistent(c,e);
}
}
#endif
grib_rule* grib_new_rule(grib_context* c, grib_expression* condition, grib_rule_entry* entries)
{
grib_rule* r = (grib_rule*)grib_context_malloc_clear_persistent(c, sizeof(grib_rule));