Skip to content

Commit

Permalink
Remove unused c functions in rd_file_kw
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindjahren committed Aug 22, 2024
1 parent 1323b69 commit ec70412
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 46 deletions.
5 changes: 0 additions & 5 deletions lib/include/resdata/rd_file_kw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,13 @@ rd_file_kw_type *rd_file_kw_alloc(const rd_kw_type *rd_kw, offset_type offset);
rd_file_kw_type *rd_file_kw_alloc0(const char *header, rd_data_type data_type,
int size, offset_type offset);
void rd_file_kw_free(rd_file_kw_type *file_kw);
void rd_file_kw_free__(void *arg);
rd_kw_type *rd_file_kw_get_kw(rd_file_kw_type *file_kw, fortio_type *fortio,
inv_map_type *inv_map);
rd_kw_type *rd_file_kw_get_kw_ptr(rd_file_kw_type *file_kw);
rd_file_kw_type *rd_file_kw_alloc_copy(const rd_file_kw_type *src);
const char *rd_file_kw_get_header(const rd_file_kw_type *file_kw);
int rd_file_kw_get_size(const rd_file_kw_type *file_kw);
rd_data_type rd_file_kw_get_data_type(const rd_file_kw_type *);
offset_type rd_file_kw_get_offset(const rd_file_kw_type *file_kw);
bool rd_file_kw_ptr_eq(const rd_file_kw_type *file_kw, const rd_kw_type *rd_kw);
void rd_file_kw_replace_kw(rd_file_kw_type *file_kw, fortio_type *target,
rd_kw_type *new_kw);
bool rd_file_kw_fskip_data(const rd_file_kw_type *file_kw, fortio_type *fortio);
void rd_file_kw_inplace_fwrite(rd_file_kw_type *file_kw, fortio_type *fortio);

Expand Down
41 changes: 0 additions & 41 deletions lib/resdata/rd_file_kw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,6 @@ rd_file_kw_type *rd_file_kw_alloc(const rd_kw_type *rd_kw, offset_type offset) {
offset);
}

/**
Does NOT copy the kw pointer which must be reloaded.
*/
rd_file_kw_type *rd_file_kw_alloc_copy(const rd_file_kw_type *src) {
return rd_file_kw_alloc0(src->header, rd_file_kw_get_data_type(src),
src->kw_size, src->file_offset);
}

void rd_file_kw_free(rd_file_kw_type *file_kw) {
if (file_kw->kw != NULL) {
rd_kw_free(file_kw->kw);
Expand All @@ -160,11 +152,6 @@ void rd_file_kw_free(rd_file_kw_type *file_kw) {
free(file_kw);
}

void rd_file_kw_free__(void *arg) {
rd_file_kw_type *file_kw = rd_file_kw_safe_cast(arg);
rd_file_kw_free(file_kw);
}

bool rd_file_kw_equal(const rd_file_kw_type *kw1, const rd_file_kw_type *kw2) {
if (kw1->file_offset != kw2->file_offset)
return false;
Expand Down Expand Up @@ -256,34 +243,6 @@ rd_kw_type *rd_file_kw_get_kw(rd_file_kw_type *file_kw, fortio_type *fortio,
return file_kw->kw;
}

bool rd_file_kw_ptr_eq(const rd_file_kw_type *file_kw,
const rd_kw_type *rd_kw) {
if (file_kw->kw == rd_kw)
return true;
else
return false;
}

void rd_file_kw_replace_kw(rd_file_kw_type *file_kw, fortio_type *target,
rd_kw_type *new_kw) {
if (!rd_type_is_equal(rd_file_kw_get_data_type(file_kw),
rd_kw_get_data_type(new_kw)))
util_abort("%s: sorry type mismatch between in-file keyword and new "
"keyword \n",
__func__);
if (file_kw->kw_size != rd_kw_get_size(new_kw))
util_abort("%s: sorry size mismatch between in-file keyword and new "
"keyword \n",
__func__);

if (file_kw->kw != NULL)
rd_kw_free(file_kw->kw);

file_kw->kw = new_kw;
fortio_fseek(target, file_kw->file_offset, SEEK_SET);
rd_kw_fwrite(file_kw->kw, target);
}

const char *rd_file_kw_get_header(const rd_file_kw_type *file_kw) {
return file_kw->header;
}
Expand Down

0 comments on commit ec70412

Please sign in to comment.