Skip to content

Commit

Permalink
remove unused c code in rd_kw_grdecl
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindjahren committed Aug 23, 2024
1 parent 87a06e9 commit ad66439
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 53 deletions.
13 changes: 0 additions & 13 deletions lib/include/resdata/rd_kw_grdecl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,12 @@ rd_kw_type *rd_kw_fscanf_alloc_grdecl_dynamic__(FILE *stream, const char *kw,
rd_kw_type *rd_kw_fscanf_alloc_grdecl_dynamic(FILE *stream, const char *kw,
rd_data_type);

rd_kw_type *rd_kw_fscanf_alloc_grdecl_data__(FILE *stream, bool strict,
int size, rd_data_type data_type);
rd_kw_type *rd_kw_fscanf_alloc_grdecl_data(FILE *stream, int size,
rd_data_type data_type);

rd_kw_type *rd_kw_fscanf_alloc_grdecl__(FILE *stream, const char *kw,
bool strict, int size,
rd_data_type data_type);
rd_kw_type *rd_kw_fscanf_alloc_grdecl(FILE *stream, const char *kw, int size,
rd_data_type data_type);

rd_kw_type *rd_kw_fscanf_alloc_current_grdecl__(FILE *stream, bool strict,
rd_data_type data_type);
rd_kw_type *rd_kw_fscanf_alloc_current_grdecl(FILE *stream,
rd_data_type data_type);

bool rd_kw_grdecl_fseek_next_kw(FILE *stream);
char *rd_kw_grdecl_alloc_next_header(FILE *stream);

void rd_kw_fprintf_grdecl(const rd_kw_type *rd_kw, FILE *stream);
void rd_kw_fprintf_grdecl__(const rd_kw_type *rd_kw, const char *special_header,
FILE *stream);
Expand Down
47 changes: 7 additions & 40 deletions lib/resdata/rd_kw_grdecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
are ignored.
*/

bool rd_kw_grdecl_fseek_next_kw(FILE *stream) {
static bool rd_kw_grdecl_fseek_next_kw(FILE *stream) {
long start_pos = util_ftell(stream);
long current_pos;
char next_kw[MAX_GRDECL_HEADER_SIZE];
Expand Down Expand Up @@ -116,22 +116,6 @@ bool rd_kw_grdecl_fseek_next_kw(FILE *stream) {
}
}

/**
Will use the rd_kw_grdecl_fseek_next_header() to seek out the next
header string, and read and return that string. If no more headers
are found the function will return NULL. The storage allocated by
this function must be free'd by the calling scope.
*/

char *rd_kw_grdecl_alloc_next_header(FILE *stream) {
if (rd_kw_grdecl_fseek_next_kw(stream)) {
char next_kw[MAX_GRDECL_HEADER_SIZE];
fscanf(stream, "%s", next_kw);
return util_alloc_string_copy(next_kw);
} else
return NULL;
}

/**
This function will search through a GRDECL file to look for the
'kw'; input variables and return vales are similar to
Expand Down Expand Up @@ -455,24 +439,6 @@ static rd_kw_type *__rd_kw_fscanf_alloc_grdecl__(FILE *stream,
}
}

/**
This function assumes that the file pointer has already been
positioned at the beginning of a keyword header, and will just
start reading a header string right away; if the file pointer is
incorrectly positioned this will most probably blow up big time.
*/

rd_kw_type *rd_kw_fscanf_alloc_grdecl_data__(FILE *stream, bool strict,
int size, rd_data_type data_type) {
return __rd_kw_fscanf_alloc_grdecl__(stream, NULL, strict, size, data_type);
}

rd_kw_type *rd_kw_fscanf_alloc_grdecl_data(FILE *stream, int size,
rd_data_type data_type) {
bool strict = true;
return rd_kw_fscanf_alloc_grdecl_data__(stream, strict, size, data_type);
}

/*
This function will seek through the file and position the file
pointer at the beginning of @kw before starting to load (this
Expand Down Expand Up @@ -508,9 +474,9 @@ rd_kw_type *rd_kw_fscanf_alloc_grdecl_dynamic(FILE *stream, const char *kw,
size == 0.
*/

rd_kw_type *rd_kw_fscanf_alloc_grdecl__(FILE *stream, const char *kw,
bool strict, int size,
rd_data_type data_type) {
static rd_kw_type *rd_kw_fscanf_alloc_grdecl__(FILE *stream, const char *kw,
bool strict, int size,
rd_data_type data_type) {
return __rd_kw_fscanf_alloc_grdecl__(stream, kw, strict, size, data_type);
}

Expand All @@ -528,8 +494,9 @@ rd_kw_type *rd_kw_fscanf_alloc_grdecl(FILE *stream, const char *kw, int size,
that the input file is well formatted.
*/

rd_kw_type *rd_kw_fscanf_alloc_current_grdecl__(FILE *stream, bool strict,
rd_data_type data_type) {
static rd_kw_type *rd_kw_fscanf_alloc_current_grdecl__(FILE *stream,
bool strict,
rd_data_type data_type) {
return __rd_kw_fscanf_alloc_grdecl__(stream, NULL, strict, 0, data_type);
}

Expand Down

0 comments on commit ad66439

Please sign in to comment.