Refactoring: removal of duplicated code (dump)

This commit is contained in:
shahramn 2024-03-08 12:08:39 +00:00
parent 73a147286f
commit 626aee752d
2 changed files with 4 additions and 16 deletions

View File

@ -16,7 +16,7 @@
CLASS = accessor CLASS = accessor
SUPER = grib_accessor_class_long SUPER = grib_accessor_class_long
IMPLEMENTS = unpack_long;pack_long IMPLEMENTS = unpack_long;pack_long
IMPLEMENTS = init;dump IMPLEMENTS = init
IMPLEMENTS = next_offset IMPLEMENTS = next_offset
IMPLEMENTS = value_count IMPLEMENTS = value_count
IMPLEMENTS = byte_offset IMPLEMENTS = byte_offset
@ -43,7 +43,6 @@ static int unpack_long(grib_accessor*, long* val, size_t* len);
static long byte_offset(grib_accessor*); static long byte_offset(grib_accessor*);
static long next_offset(grib_accessor*); static long next_offset(grib_accessor*);
static int value_count(grib_accessor*, long*); static int value_count(grib_accessor*, long*);
static void dump(grib_accessor*, grib_dumper*);
static void init(grib_accessor*, const long, grib_arguments*); static void init(grib_accessor*, const long, grib_arguments*);
static void update_size(grib_accessor*, size_t); static void update_size(grib_accessor*, size_t);
@ -68,7 +67,7 @@ static grib_accessor_class _grib_accessor_class_unexpanded_descriptors = {
&init, /* init */ &init, /* init */
0, /* post_init */ 0, /* post_init */
0, /* destroy */ 0, /* destroy */
&dump, /* dump */ 0, /* dump */
&next_offset, /* next_offset */ &next_offset, /* next_offset */
0, /* get length of string */ 0, /* get length of string */
&value_count, /* get number of values */ &value_count, /* get number of values */
@ -122,11 +121,6 @@ static void init(grib_accessor* a, const long len, grib_arguments* args)
a->length = 0; a->length = 0;
} }
static void dump(grib_accessor* a, grib_dumper* dumper)
{
grib_dump_long(dumper, a, NULL);
}
static int unpack_long(grib_accessor* a, long* val, size_t* len) static int unpack_long(grib_accessor* a, long* val, size_t* len)
{ {
grib_accessor_unexpanded_descriptors* self = (grib_accessor_unexpanded_descriptors*)a; grib_accessor_unexpanded_descriptors* self = (grib_accessor_unexpanded_descriptors*)a;

View File

@ -16,7 +16,7 @@
CLASS = accessor CLASS = accessor
SUPER = grib_accessor_class_long SUPER = grib_accessor_class_long
IMPLEMENTS = unpack_long;pack_long IMPLEMENTS = unpack_long;pack_long
IMPLEMENTS = init;dump IMPLEMENTS = init
IMPLEMENTS = next_offset IMPLEMENTS = next_offset
IMPLEMENTS = byte_count IMPLEMENTS = byte_count
IMPLEMENTS = value_count IMPLEMENTS = value_count
@ -45,7 +45,6 @@ static long byte_count(grib_accessor*);
static long byte_offset(grib_accessor*); static long byte_offset(grib_accessor*);
static long next_offset(grib_accessor*); static long next_offset(grib_accessor*);
static int value_count(grib_accessor*, long*); static int value_count(grib_accessor*, long*);
static void dump(grib_accessor*, grib_dumper*);
static void init(grib_accessor*, const long, grib_arguments*); static void init(grib_accessor*, const long, grib_arguments*);
static void update_size(grib_accessor*, size_t); static void update_size(grib_accessor*, size_t);
@ -70,7 +69,7 @@ static grib_accessor_class _grib_accessor_class_unsigned_bits = {
&init, /* init */ &init, /* init */
0, /* post_init */ 0, /* post_init */
0, /* destroy */ 0, /* destroy */
&dump, /* dump */ 0, /* dump */
&next_offset, /* next_offset */ &next_offset, /* next_offset */
0, /* get length of string */ 0, /* get length of string */
&value_count, /* get number of values */ &value_count, /* get number of values */
@ -149,11 +148,6 @@ static void init(grib_accessor* a, const long len, grib_arguments* args)
a->length = compute_byte_count(a); a->length = compute_byte_count(a);
} }
static void dump(grib_accessor* a, grib_dumper* dumper)
{
grib_dump_long(dumper, a, NULL);
}
static int unpack_long(grib_accessor* a, long* val, size_t* len) static int unpack_long(grib_accessor* a, long* val, size_t* len)
{ {
grib_accessor_unsigned_bits* self = (grib_accessor_unsigned_bits*)a; grib_accessor_unsigned_bits* self = (grib_accessor_unsigned_bits*)a;