Accessors: Dead code removal

This commit is contained in:
Shahram Najm 2024-01-21 16:38:00 +00:00
parent 6cc13b3853
commit 1df68d88c4
2 changed files with 12 additions and 18 deletions

View File

@ -112,15 +112,14 @@ static void rename_accessor(grib_accessor* a, char* name)
static int create_accessor(grib_section* p, grib_action* act, grib_loader* h) static int create_accessor(grib_section* p, grib_action* act, grib_loader* h)
{ {
grib_action_rename* a = (grib_action_rename*)act; grib_action_rename* a = (grib_action_rename*)act;
grib_accessor* ga = NULL; grib_accessor* ga = grib_find_accessor(p->h, a->the_old);
ga = grib_find_accessor(p->h, a->the_old);
if (ga) { if (ga) {
rename_accessor(ga, a->the_new); rename_accessor(ga, a->the_new);
} }
else { else {
grib_context_log(act->context, GRIB_LOG_DEBUG, "Action_class_rename : create_accessor_buffer : No accessor named %s to rename ", a->the_old); grib_context_log(act->context, GRIB_LOG_DEBUG,
"Action_class_rename::create_accessor: No accessor named %s to rename", a->the_old);
} }
return GRIB_SUCCESS; return GRIB_SUCCESS;
@ -128,14 +127,12 @@ static int create_accessor(grib_section* p, grib_action* act, grib_loader* h)
static void dump(grib_action* act, FILE* f, int lvl) static void dump(grib_action* act, FILE* f, int lvl)
{ {
grib_action_rename* a = (grib_action_rename*)act; // grib_action_rename* a = (grib_action_rename*)act;
// int i = 0;
// for (i = 0; i < lvl; i++)
// grib_context_print(act->context, f, " ");
int i = 0; // grib_context_print(act->context, f, "rename %s as %s in %s\n", a->the_old, act->name, a->the_new);
for (i = 0; i < lvl; i++)
grib_context_print(act->context, f, " ");
grib_context_print(act->context, f, "rename %s as %s in %s\n", a->the_old, act->name, a->the_new);
} }
static void destroy(grib_context* context, grib_action* act) static void destroy(grib_context* context, grib_action* act)

View File

@ -151,7 +151,6 @@ static int get_native_type(grib_accessor* a)
static grib_section* sub_section(grib_accessor* a) static grib_section* sub_section(grib_accessor* a)
{ {
/* grib_accessor_section* self = (grib_accessor_section*)a; */
return a->sub_section; return a->sub_section;
} }
@ -163,17 +162,15 @@ static void update_size(grib_accessor* a, size_t length)
if (a->sub_section->aclength) { if (a->sub_section->aclength) {
int e = grib_pack_long(a->sub_section->aclength, &len, &size); int e = grib_pack_long(a->sub_section->aclength, &len, &size);
Assert(e == GRIB_SUCCESS); Assert(e == GRIB_SUCCESS);
printf("update_length %s %ld %ld\n", a->sub_section->aclength->name, // printf("update_length %s %ld %ld\n", a->sub_section->aclength->name,
(long)a->sub_section->aclength->offset, // (long)a->sub_section->aclength->offset,
(long)a->sub_section->aclength->length // (long)a->sub_section->aclength->length);
);
} }
a->sub_section->length = a->length = length; a->sub_section->length = a->length = length;
a->sub_section->padding = 0; a->sub_section->padding = 0;
printf("update_size %s %ld\n", a->name, a->length); // printf("update_size %s %ld\n", a->name, a->length);
Assert(a->length >= 0); Assert(a->length >= 0);
} }