Dead code removal

This commit is contained in:
shahramn 2024-03-09 19:55:22 +00:00
parent 9c5df40768
commit 9ce9b1f41c
3 changed files with 11 additions and 20 deletions

View File

@ -918,7 +918,6 @@ grib_handle* grib_fieldset_retrieve(grib_fieldset* set, int i, int* err);
/* grib_filepool.cc*/ /* grib_filepool.cc*/
void grib_file_pool_clean(void); void grib_file_pool_clean(void);
grib_file* grib_file_pool_get_files(void);
grib_file* grib_file_open(const char* filename, const char* mode, int* err); grib_file* grib_file_open(const char* filename, const char* mode, int* err);
void grib_file_pool_delete_file(grib_file* file); void grib_file_pool_delete_file(grib_file* file);
void grib_file_close(const char* filename, int force, int* err); void grib_file_close(const char* filename, int force, int* err);

View File

@ -132,10 +132,10 @@ void grib_file_pool_clean()
// return grib_write_file(fh, file->next); // return grib_write_file(fh, file->next);
// } // }
grib_file* grib_file_pool_get_files() // grib_file* grib_file_pool_get_files()
{ // {
return file_pool.first; // return file_pool.first;
} // }
// int grib_file_pool_read(grib_context* c, FILE* fh) // int grib_file_pool_read(grib_context* c, FILE* fh)
// { // {

View File

@ -20,10 +20,9 @@ int main(int argc, char** argv)
codes_handle* h = NULL; codes_handle* h = NULL;
long* ivalues = NULL; long* ivalues = NULL;
const char* sampleName = "BUFR3_local"; const char* sampleName = "BUFR3_local";
char* outfilename = NULL;
assert(argc == 2); assert(argc == 2);
outfilename = argv[1]; char* outfilename = argv[1];
// Test non-existent sample file. Should fail // Test non-existent sample file. Should fail
h = codes_bufr_handle_new_from_samples(NULL, "some rubbish"); h = codes_bufr_handle_new_from_samples(NULL, "some rubbish");
@ -33,10 +32,8 @@ int main(int argc, char** argv)
assert(h); assert(h);
ivalues = (long*)malloc(1 * sizeof(long)); ivalues = (long*)malloc(1 * sizeof(long));
if (!ivalues) { assert(ivalues);
fprintf(stderr, "Failed to allocate memory (ivalues).\n");
return 1;
}
size = 1; size = 1;
ivalues[0] = 1; ivalues[0] = 1;
CODES_CHECK(codes_set_long_array(h, "inputDelayedDescriptorReplicationFactor", ivalues, size), 0); CODES_CHECK(codes_set_long_array(h, "inputDelayedDescriptorReplicationFactor", ivalues, size), 0);
@ -89,10 +86,8 @@ int main(int argc, char** argv)
free(ivalues); free(ivalues);
ivalues = (long*)malloc(9 * sizeof(long)); ivalues = (long*)malloc(9 * sizeof(long));
if (!ivalues) { assert(ivalues);
fprintf(stderr, "Failed to allocate memory (ivalues).\n");
return 1;
}
size = 4; size = 4;
ivalues[0] = 309052; ivalues[0] = 309052;
ivalues[1] = 5001; ivalues[1] = 5001;
@ -104,11 +99,8 @@ int main(int argc, char** argv)
CODES_CHECK(codes_set_long(h, "pack", 1), 0); CODES_CHECK(codes_set_long(h, "pack", 1), 0);
fout = fopen(outfilename, "wb"); fout = fopen(outfilename, "wb");
if (!fout) { assert(fout);
fprintf(stderr, "Failed to open (create) output file.\n");
free(ivalues);
return 1;
}
CODES_CHECK(codes_get_message(h, &buffer, &size), 0); CODES_CHECK(codes_get_message(h, &buffer, &size), 0);
CODES_CHECK(codes_check_message_header(buffer, size, PRODUCT_BUFR), 0); CODES_CHECK(codes_check_message_header(buffer, size, PRODUCT_BUFR), 0);
CODES_CHECK(codes_check_message_footer(buffer, size, PRODUCT_BUFR), 0); CODES_CHECK(codes_check_message_footer(buffer, size, PRODUCT_BUFR), 0);