Rename blacklist to blocklist

This commit is contained in:
Shahram Najm 2020-09-24 15:54:33 +01:00
parent f37fe8889b
commit f94a5f0928
7 changed files with 82 additions and 82 deletions

View File

@ -20,7 +20,7 @@
IMPLEMENTS = compare;unpack_string;value_count;destroy
MEMBERS = const char* offset
MEMBERS = grib_expression* length
MEMBERS = grib_string_list* blacklist
MEMBERS = grib_string_list* blocklist
END_CLASS_DEF
*/
@ -50,7 +50,7 @@ typedef struct grib_accessor_md5
/* Members defined in md5 */
const char* offset;
grib_expression* length;
grib_string_list* blacklist;
grib_string_list* blocklist;
} grib_accessor_md5;
extern grib_accessor_class* grib_accessor_class_gen;
@ -146,12 +146,12 @@ static void init(grib_accessor* a, const long len, grib_arguments* arg)
self->offset = grib_arguments_get_name(grib_handle_of_accessor(a), arg, n++);
self->length = grib_arguments_get_expression(grib_handle_of_accessor(a), arg, n++);
self->blacklist = NULL;
self->blocklist = NULL;
while ((b = (char*)grib_arguments_get_name(grib_handle_of_accessor(a), arg, n++)) != NULL) {
if (!self->blacklist) {
self->blacklist = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
self->blacklist->value = grib_context_strdup(context, b);
current = self->blacklist;
if (!self->blocklist) {
self->blocklist = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
self->blocklist->value = grib_context_strdup(context, b);
current = self->blocklist;
}
else {
Assert(current);
@ -204,7 +204,7 @@ static int unpack_string(grib_accessor* a, char* v, size_t* len)
unsigned char* mess;
unsigned char* p;
long offset = 0, length = 0;
grib_string_list* blacklist = NULL;
grib_string_list* blocklist = NULL;
grib_accessor* b = NULL;
int ret = 0;
int i = 0;
@ -223,14 +223,14 @@ static int unpack_string(grib_accessor* a, char* v, size_t* len)
memcpy(mess, grib_handle_of_accessor(a)->buffer->data + offset, length);
mess_len = length;
blacklist = a->context->blacklist;
/* passed blacklist overrides context blacklist.
Consider to modify following line to extend context blacklist.
blocklist = a->context->blocklist;
/* passed blocklist overrides context blocklist.
Consider to modify following line to extend context blocklist.
*/
if (self->blacklist)
blacklist = self->blacklist;
while (blacklist && blacklist->value) {
b = grib_find_accessor(grib_handle_of_accessor(a), blacklist->value);
if (self->blocklist)
blocklist = self->blocklist;
while (blocklist && blocklist->value) {
b = grib_find_accessor(grib_handle_of_accessor(a), blocklist->value);
if (!b) {
grib_context_free(a->context, mess);
return GRIB_NOT_FOUND;
@ -240,7 +240,7 @@ static int unpack_string(grib_accessor* a, char* v, size_t* len)
for (i = 0; i < b->length; i++)
*(p++) = 0;
blacklist = blacklist->next;
blocklist = blocklist->next;
}
grib_md5_init(&md5c);
@ -255,8 +255,8 @@ static int unpack_string(grib_accessor* a, char* v, size_t* len)
static void destroy(grib_context* c, grib_accessor* a)
{
grib_accessor_md5* self = (grib_accessor_md5*)a;
if (self->blacklist) {
grib_string_list* next = self->blacklist;
if (self->blocklist) {
grib_string_list* next = self->blocklist;
grib_string_list* cur = NULL;
while (next) {
cur = next;

View File

@ -1094,7 +1094,7 @@ struct grib_context
int hash_array_count;
grib_hash_array_value* hash_array[MAX_NUM_HASH_ARRAY];
grib_trie* def_files;
grib_string_list* blacklist;
grib_string_list* blocklist;
int ieee_packing;
int bufrdc_mode;
int bufr_set_to_missing_if_out_of_range;

View File

@ -354,7 +354,7 @@ static grib_context default_grib_context = {
0, /* hash_array_count */
{0,}, /* hash_array */
0, /* def_files */
0, /* blacklist */
0, /* blocklist */
0, /* ieee_packing */
0, /* bufrdc_mode */
0, /* bufr_set_to_missing_if_out_of_range */

View File

@ -54,7 +54,7 @@ static grib_error* error_summary;
static compare_double_proc compare_double;
static double global_tolerance = 0;
static int packingCompare = 0;
static grib_string_list* blacklist = 0;
static grib_string_list* blocklist = 0;
static grib_string_list* keys_list = NULL; /* Used to determine rank of key */
static int isLeafKey = 0; /* 0 if key is top-level, 1 if key has no children attributes */
static int compareAbsolute = 1;
@ -177,9 +177,9 @@ static double compare_double_relative(double* a, double* b, double* err)
return relativeError > *err ? relativeError : 0;
}
static int blacklisted(const char* name)
static int blocklisted(const char* name)
{
grib_string_list* b = blacklist;
grib_string_list* b = blocklist;
if (!name) return 0;
while (b) {
Assert(b->value);
@ -314,15 +314,15 @@ int grib_tool_init(grib_runtime_options* options)
if (grib_options_on("b:")) {
grib_string_list* next = 0;
int ii = 0;
blacklist = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
blacklist->value = grib_context_strdup(context, options->set_values[0].name);
next = blacklist;
blocklist = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
blocklist->value = grib_context_strdup(context, options->set_values[0].name);
next = blocklist;
for (ii = 1; ii < options->set_values_count; ii++) {
next->next = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
next->next->value = grib_context_strdup(context, options->set_values[ii].name);
next = next->next;
}
context->blacklist = blacklist;
context->blocklist = blocklist;
}
/* Check 1st file is not a directory */
@ -1280,7 +1280,7 @@ static int compare_all_dump_keys(grib_handle* handle1, grib_handle* handle2, gri
isLeafKey = 0; /* clear global variable for each key */
name = grib_keys_iterator_get_name(iter);
if (blacklisted(name))
if (blocklisted(name))
continue;
if (xa == NULL || (xa->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0)
continue;
@ -1296,7 +1296,7 @@ static int compare_all_dump_keys(grib_handle* handle1, grib_handle* handle2, gri
prefix = (char*)xa->name;
}
if (blacklisted(prefix)) {
if (blocklisted(prefix)) {
if (dofree) grib_context_free(context, prefix);
continue;
}
@ -1330,10 +1330,10 @@ static int compare_handles(grib_handle* handle1, grib_handle* handle2, grib_runt
const char* name = NULL;
/* mask only if no -c option or headerMode (-H)*/
if (blacklist && (!listFromCommandLine || headerMode)) {
if (blocklist && (!listFromCommandLine || headerMode)) {
/* See ECC-245, GRIB-573, GRIB-915: Do not change handles in memory */
/*
grib_string_list* nextb=blacklist;
grib_string_list* nextb=blocklist;
while (nextb) {
grib_clear(handle1,nextb->value);
grib_clear(handle2,nextb->value);
@ -1343,7 +1343,7 @@ static int compare_handles(grib_handle* handle1, grib_handle* handle2, grib_runt
if (listFromCommandLine && onlyListed) {
for (i = 0; i < options->compare_count; i++) {
if (blacklisted(options->compare[i].name))
if (blocklisted(options->compare[i].name))
continue;
if (options->compare[i].type == GRIB_NAMESPACE) {
iter = grib_keys_iterator_new(handle1, 0, options->compare[i].name);
@ -1355,7 +1355,7 @@ static int compare_handles(grib_handle* handle1, grib_handle* handle2, grib_runt
name = grib_keys_iterator_get_name(iter);
/*printf("----- comparing %s\n",name);*/
if (blacklisted(name))
if (blocklisted(name))
continue;
if (compare_values(options, handle1, handle2, name, GRIB_TYPE_UNDEFINED)) {
err++;
@ -1405,7 +1405,7 @@ static int compare_handles(grib_handle* handle1, grib_handle* handle2, grib_runt
if (listFromCommandLine) {
for (i = 0; i < options->compare_count; i++) {
if (blacklisted(name))
if (blocklisted(name))
continue;
if (options->compare[i].type == GRIB_NAMESPACE) {
iter = grib_keys_iterator_new(handle1, 0, options->compare[i].name);
@ -1418,7 +1418,7 @@ static int compare_handles(grib_handle* handle1, grib_handle* handle2, grib_runt
name = grib_keys_iterator_get_name(iter);
/*printf("----- comparing %s\n",name);*/
if (blacklisted(name))
if (blocklisted(name))
continue;
if (compare_values(options, handle1, handle2, name, GRIB_TYPE_UNDEFINED)) {
err++;

View File

@ -54,7 +54,7 @@ static grib_error* error_summary;
static compare_double_proc compare_double;
static double global_tolerance = 0;
static int packingCompare = 0;
static grib_string_list* blacklist = 0;
static grib_string_list* blocklist = 0;
static int compareAbsolute = 1;
static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_options* options);
@ -108,9 +108,9 @@ static double compare_double_relative(double* a, double* b, double tolerance)
return relativeError > tolerance ? relativeError : 0;
}
static int blacklisted(const char* name)
static int blocklisted(const char* name)
{
grib_string_list* b = blacklist;
grib_string_list* b = blocklist;
while (b) {
Assert(b->value);
if (!strcmp(name, b->value))
@ -237,15 +237,15 @@ int grib_tool_init(grib_runtime_options* options)
if (grib_options_on("b:")) {
grib_string_list* next = 0;
blacklist = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
blacklist->value = grib_context_strdup(context, options->set_values[0].name);
next = blacklist;
blocklist = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
blocklist->value = grib_context_strdup(context, options->set_values[0].name);
next = blocklist;
for (i = 1; i < options->set_values_count; i++) {
next->next = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
next->next->value = grib_context_strdup(context, options->set_values[i].name);
next = next->next;
}
context->blacklist = blacklist;
context->blocklist = blocklist;
}
if (grib_options_on("r")) {
@ -653,8 +653,8 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
if (verbose)
printf(" comparing %s", name);
/* If key was blacklisted, then we should not have got here */
DebugAssert(!blacklisted(name));
/* If key was blocklisted, then we should not have got here */
DebugAssert(!blocklisted(name));
if (type1 == GRIB_TYPE_UNDEFINED && (err = grib_get_native_type(h1, name, &type1)) != GRIB_SUCCESS) {
printInfo(h1);
@ -1130,9 +1130,9 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
grib_keys_iterator* iter = NULL;
/* mask only if no -c option or headerMode (-H)*/
if (blacklist && (!listFromCommandLine || headerMode)) {
if (blocklist && (!listFromCommandLine || headerMode)) {
/* See ECC-245, GRIB-573, GRIB-915: Do not change handles in memory */
/* grib_string_list* nextb=blacklist;
/* grib_string_list* nextb=blocklist;
while (nextb) {
grib_clear(h1,nextb->value);
grib_clear(h2,nextb->value);
@ -1164,7 +1164,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
name = grib_keys_iterator_get_name(iter);
/*printf("----- comparing %s\n",name);*/
if (blacklisted(name))
if (blocklisted(name))
continue;
if (compare_values(options, h11, h22, name, GRIB_TYPE_UNDEFINED))
err++;
@ -1178,7 +1178,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
if (listFromCommandLine && onlyListed) {
for (i = 0; i < options->compare_count; i++) {
if (blacklisted(options->compare[i].name))
if (blocklisted(options->compare[i].name))
continue;
if (options->compare[i].type == GRIB_NAMESPACE) {
iter = grib_keys_iterator_new(h1, 0, options->compare[i].name);
@ -1190,7 +1190,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
name = grib_keys_iterator_get_name(iter);
/*printf("----- comparing %s\n",name);*/
if (blacklisted(name))
if (blocklisted(name))
continue;
if (compare_values(options, h1, h2, name, GRIB_TYPE_UNDEFINED))
err++;
@ -1222,7 +1222,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
name = grib_keys_iterator_get_name(iter);
/*printf("----- comparing %s\n",name);*/
if (blacklisted(name))
if (blocklisted(name))
continue;
if (compare_values(options, h1, h2, name, GRIB_TYPE_UNDEFINED))
err++;
@ -1232,7 +1232,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
if (listFromCommandLine) {
for (i = 0; i < options->compare_count; i++) {
if (blacklisted(options->compare[i].name))
if (blocklisted(options->compare[i].name))
continue;
if (options->compare[i].type == GRIB_NAMESPACE) {
iter = grib_keys_iterator_new(h1, 0, options->compare[i].name);
@ -1244,7 +1244,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
name = grib_keys_iterator_get_name(iter);
/*printf("----- comparing %s\n",name);*/
if (blacklisted(name))
if (blocklisted(name))
continue;
if (compare_values(options, h1, h2, name, GRIB_TYPE_UNDEFINED))
err++;

View File

@ -34,7 +34,7 @@ struct grib_error
grib_error* error_summary;
compare_double_proc compare_double;
grib_string_list* blacklist = 0;
grib_string_list* blocklist = 0;
static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_options* options);
static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_handle* h2, const char* name, int type);
@ -90,9 +90,9 @@ static void write_messages(grib_handle* h1, grib_handle* h2)
write_message(h2, "error2");
}
static int blacklisted(const char* name)
static int blocklisted(const char* name)
{
grib_string_list* b = blacklist;
grib_string_list* b = blocklist;
if (!name) return 0;
while (b) {
Assert(b->value);
@ -205,15 +205,15 @@ int grib_tool_init(grib_runtime_options* options)
if (grib_options_on("b:")) {
grib_string_list* next = 0;
int i = 0;
blacklist = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
blacklist->value = grib_context_strdup(context, options->set_values[0].name);
next = blacklist;
blocklist = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
blocklist->value = grib_context_strdup(context, options->set_values[0].name);
next = blocklist;
for (i = 1; i < options->set_values_count; i++) {
next->next = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
next->next->value = grib_context_strdup(context, options->set_values[i].name);
next = next->next;
}
context->blacklist = blacklist;
context->blocklist = blocklist;
}
if (grib_options_on("r")) {
@ -789,7 +789,7 @@ static int compare_all_dump_keys(grib_handle* h1, grib_handle* h2, grib_runtime_
name = grib_keys_iterator_get_name(iter);
/* printf("----- comparing %s\n",name); */
if (blacklisted(name))
if (blocklisted(name))
continue;
if (xa == NULL || (xa->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0)
continue;
@ -812,8 +812,8 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
const char* name = NULL;
/* mask only if no -c option or headerMode (-H)*/
if (blacklist && (!listFromCommandLine || headerMode)) {
grib_string_list* nextb = blacklist;
if (blocklist && (!listFromCommandLine || headerMode)) {
grib_string_list* nextb = blocklist;
while (nextb) {
grib_clear(h1, nextb->value);
grib_clear(h2, nextb->value);
@ -846,7 +846,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
name = grib_keys_iterator_get_name(iter);
/*printf("----- comparing %s\n",name);*/
if (blacklisted(name))
if (blocklisted(name))
continue;
if (compare_values(options, h11, h22, name, GRIB_TYPE_UNDEFINED)) {
err++;
@ -862,7 +862,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
if (listFromCommandLine && onlyListed) {
for (i = 0; i < options->compare_count; i++) {
if (blacklisted((char*)options->compare[i].name))
if (blocklisted((char*)options->compare[i].name))
continue;
if (options->compare[i].type == GRIB_NAMESPACE) {
iter = grib_keys_iterator_new(h1, 0, options->compare[i].name);
@ -874,7 +874,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
name = grib_keys_iterator_get_name(iter);
/*printf("----- comparing %s\n",name);*/
if (blacklisted(name))
if (blocklisted(name))
continue;
if (compare_values(options, h1, h2, name, GRIB_TYPE_UNDEFINED)) {
err++;
@ -925,7 +925,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
if (listFromCommandLine) {
for (i = 0; i < options->compare_count; i++) {
if (blacklisted(name))
if (blocklisted(name))
continue;
if (options->compare[i].type == GRIB_NAMESPACE) {
iter = grib_keys_iterator_new(h1, 0, options->compare[i].name);
@ -937,7 +937,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
name = grib_keys_iterator_get_name(iter);
/*printf("----- comparing %s\n",name);*/
if (blacklisted(name))
if (blocklisted(name))
continue;
if (compare_values(options, h1, h2, name, GRIB_TYPE_UNDEFINED)) {
err++;

View File

@ -55,7 +55,7 @@ grib_error* error_summary;
compare_double_proc compare_double;
double global_tolerance = 0;
int packingCompare = 0;
grib_string_list* blacklist = 0;
grib_string_list* blocklist = 0;
int compareAbsolute = 1;
static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_options* options);
@ -137,9 +137,9 @@ static double compare_double_relative(double* a, double* b, double* err)
return relativeError > *err ? relativeError : 0;
}
static int blacklisted(const char* name)
static int blocklisted(const char* name)
{
grib_string_list* b = blacklist;
grib_string_list* b = blocklist;
if (!name) return 0;
while (b) {
Assert(b->value);
@ -268,15 +268,15 @@ int grib_tool_init(grib_runtime_options* options)
if (grib_options_on("b:")) {
grib_string_list* next = 0;
blacklist = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
blacklist->value = grib_context_strdup(context, options->set_values[0].name);
next = blacklist;
blocklist = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
blocklist->value = grib_context_strdup(context, options->set_values[0].name);
next = blocklist;
for (i = 1; i < options->set_values_count; i++) {
next->next = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
next->next->value = grib_context_strdup(context, options->set_values[i].name);
next = next->next;
}
context->blacklist = blacklist;
context->blocklist = blocklist;
}
if (grib_options_on("r")) {
@ -1031,7 +1031,7 @@ static int compare_all_dump_keys(grib_handle* h1, grib_handle* h2, grib_runtime_
name = grib_keys_iterator_get_name(iter);
/* printf("----- comparing %s\n",name); */
if (blacklisted(name))
if (blocklisted(name))
continue;
if (xa == NULL || (xa->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0)
continue;
@ -1054,8 +1054,8 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
const char* name = NULL;
/* mask only if no -c option or headerMode (-H)*/
if (blacklist && (!listFromCommandLine || headerMode)) {
grib_string_list* nextb = blacklist;
if (blocklist && (!listFromCommandLine || headerMode)) {
grib_string_list* nextb = blocklist;
while (nextb) {
grib_clear(h1, nextb->value);
grib_clear(h2, nextb->value);
@ -1088,7 +1088,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
name = grib_keys_iterator_get_name(iter);
/*printf("----- comparing %s\n",name);*/
if (blacklisted(name))
if (blocklisted(name))
continue;
if (compare_values(options, h11, h22, name, GRIB_TYPE_UNDEFINED)) {
err++;
@ -1104,7 +1104,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
if (listFromCommandLine && onlyListed) {
for (i = 0; i < options->compare_count; i++) {
if (blacklisted((char*)options->compare[i].name))
if (blocklisted((char*)options->compare[i].name))
continue;
if (options->compare[i].type == GRIB_NAMESPACE) {
iter = grib_keys_iterator_new(h1, 0, options->compare[i].name);
@ -1116,7 +1116,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
name = grib_keys_iterator_get_name(iter);
/*printf("----- comparing %s\n",name);*/
if (blacklisted(name))
if (blocklisted(name))
continue;
if (compare_values(options, h1, h2, name, GRIB_TYPE_UNDEFINED)) {
err++;
@ -1167,7 +1167,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
if (listFromCommandLine) {
for (i = 0; i < options->compare_count; i++) {
if (blacklisted(name))
if (blocklisted(name))
continue;
if (options->compare[i].type == GRIB_NAMESPACE) {
iter = grib_keys_iterator_new(h1, 0, options->compare[i].name);
@ -1179,7 +1179,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
name = grib_keys_iterator_get_name(iter);
/*printf("----- comparing %s\n",name);*/
if (blacklisted(name))
if (blocklisted(name))
continue;
if (compare_values(options, h1, h2, name, GRIB_TYPE_UNDEFINED)) {
err++;