Dead code removal

This commit is contained in:
Shahram Najm 2024-01-26 12:55:05 +00:00
parent b186eccc4c
commit be94fed831
2 changed files with 43 additions and 52 deletions

View File

@ -1182,7 +1182,6 @@ int grib_get_string_array(const grib_handle* h, const char* name, char** val, si
int ecc__grib_get_long_array_internal(const grib_handle* h, grib_accessor* a, long* val, size_t buffer_len, size_t* decoded_length); int ecc__grib_get_long_array_internal(const grib_handle* h, grib_accessor* a, long* val, size_t buffer_len, size_t* decoded_length);
int grib_get_long_array_internal(grib_handle* h, const char* name, long* val, size_t* length); int grib_get_long_array_internal(grib_handle* h, const char* name, long* val, size_t* length);
int grib_get_long_array(const grib_handle* h, const char* name, long* val, size_t* length); int grib_get_long_array(const grib_handle* h, const char* name, long* val, size_t* length);
int grib_get_values(grib_handle* h, grib_values* args, size_t count);
int grib_set_values(grib_handle* h, grib_values* args, size_t count); int grib_set_values(grib_handle* h, grib_values* args, size_t count);
int grib_get_nearest_smaller_value(grib_handle* h, const char* name, double val, double* nearest); int grib_get_nearest_smaller_value(grib_handle* h, const char* name, double val, double* nearest);
void grib_print_values(const char* title, grib_values* values, FILE* out); void grib_print_values(const char* title, grib_values* values, FILE* out);

View File

@ -1705,57 +1705,49 @@ int grib_get_long_array(const grib_handle* h, const char* name, long* val, size_
// return ret; // return ret;
// } // }
int grib_get_values(grib_handle* h, grib_values* args, size_t count) // int grib_get_values(grib_handle* h, grib_values* args, size_t count)
{ // {
int ret = 0; // int ret = 0;
int i = 0; // int i = 0;
// for (i = 0; i < count; i++) {
for (i = 0; i < count; i++) { // char buff[1024] = {0,};
char buff[1024] = {0,}; // size_t len = sizeof(buff) / sizeof(*buff);
size_t len = sizeof(buff) / sizeof(*buff); // if (!args[i].name) {
// args[i].error = GRIB_INVALID_ARGUMENT;
if (!args[i].name) { // continue;
args[i].error = GRIB_INVALID_ARGUMENT; // }
continue; // if (args[i].type == 0) {
} // args[i].error = grib_get_native_type(h, args[i].name, &(args[i].type));
// if (args[i].error != GRIB_SUCCESS)
if (args[i].type == 0) { // ret = args[i].error;
args[i].error = grib_get_native_type(h, args[i].name, &(args[i].type)); // }
if (args[i].error != GRIB_SUCCESS) // switch (args[i].type) {
ret = args[i].error; // case GRIB_TYPE_LONG:
} // args[i].error = grib_get_long(h, args[i].name, &(args[i].long_value));
// if (args[i].error != GRIB_SUCCESS)
switch (args[i].type) { // ret = args[i].error;
case GRIB_TYPE_LONG: // break;
args[i].error = grib_get_long(h, args[i].name, &(args[i].long_value)); // case GRIB_TYPE_DOUBLE:
if (args[i].error != GRIB_SUCCESS) // args[i].error = grib_get_double(h, args[i].name, &(args[i].double_value));
ret = args[i].error; // if (args[i].error != GRIB_SUCCESS)
break; // ret = args[i].error;
// break;
case GRIB_TYPE_DOUBLE: // case GRIB_TYPE_STRING:
args[i].error = grib_get_double(h, args[i].name, &(args[i].double_value)); // args[i].error = grib_get_string(h, args[i].name, buff, &len);
if (args[i].error != GRIB_SUCCESS) // args[i].string_value = strdup(buff);
ret = args[i].error; // if (args[i].error != GRIB_SUCCESS)
break; // ret = args[i].error;
// break;
case GRIB_TYPE_STRING: // default:
args[i].error = grib_get_string(h, args[i].name, buff, &len); // args[i].error = grib_get_string(h, args[i].name, buff, &len);
args[i].string_value = strdup(buff); // args[i].string_value = strdup(buff);
if (args[i].error != GRIB_SUCCESS) // if (args[i].error != GRIB_SUCCESS)
ret = args[i].error; // ret = args[i].error;
break; // break;
// }
default: // }
args[i].error = grib_get_string(h, args[i].name, buff, &len); // return ret;
args[i].string_value = strdup(buff); // }
if (args[i].error != GRIB_SUCCESS)
ret = args[i].error;
break;
}
}
return ret;
}
int grib_set_values(grib_handle* h, grib_values* args, size_t count) int grib_set_values(grib_handle* h, grib_values* args, size_t count)
{ {