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 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_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);
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;
// }
int grib_get_values(grib_handle* h, grib_values* args, size_t count)
{
int ret = 0;
int i = 0;
for (i = 0; i < count; i++) {
char buff[1024] = {0,};
size_t len = sizeof(buff) / sizeof(*buff);
if (!args[i].name) {
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)
ret = args[i].error;
}
switch (args[i].type) {
case GRIB_TYPE_LONG:
args[i].error = grib_get_long(h, args[i].name, &(args[i].long_value));
if (args[i].error != GRIB_SUCCESS)
ret = args[i].error;
break;
case GRIB_TYPE_DOUBLE:
args[i].error = grib_get_double(h, args[i].name, &(args[i].double_value));
if (args[i].error != GRIB_SUCCESS)
ret = args[i].error;
break;
case GRIB_TYPE_STRING:
args[i].error = grib_get_string(h, args[i].name, buff, &len);
args[i].string_value = strdup(buff);
if (args[i].error != GRIB_SUCCESS)
ret = args[i].error;
break;
default:
args[i].error = grib_get_string(h, args[i].name, buff, &len);
args[i].string_value = strdup(buff);
if (args[i].error != GRIB_SUCCESS)
ret = args[i].error;
break;
}
}
return ret;
}
// int grib_get_values(grib_handle* h, grib_values* args, size_t count)
// {
// int ret = 0;
// int i = 0;
// for (i = 0; i < count; i++) {
// char buff[1024] = {0,};
// size_t len = sizeof(buff) / sizeof(*buff);
// if (!args[i].name) {
// 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)
// ret = args[i].error;
// }
// switch (args[i].type) {
// case GRIB_TYPE_LONG:
// args[i].error = grib_get_long(h, args[i].name, &(args[i].long_value));
// if (args[i].error != GRIB_SUCCESS)
// ret = args[i].error;
// break;
// case GRIB_TYPE_DOUBLE:
// args[i].error = grib_get_double(h, args[i].name, &(args[i].double_value));
// if (args[i].error != GRIB_SUCCESS)
// ret = args[i].error;
// break;
// case GRIB_TYPE_STRING:
// args[i].error = grib_get_string(h, args[i].name, buff, &len);
// args[i].string_value = strdup(buff);
// if (args[i].error != GRIB_SUCCESS)
// ret = args[i].error;
// break;
// default:
// args[i].error = grib_get_string(h, args[i].name, buff, &len);
// 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)
{